• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Solved] JASS Undeclared function?!?!?

Status
Not open for further replies.
Level 5
Joined
Oct 9, 2008
Messages
112
Hi Guys

i hope you can help me again. Yesterday i saved the map normally but today the jass helper give me an error i dont know whats wrong with him!

Undeclared function DoT_Action
And the trigger where the Jasshelper says is this:
Custom script: call DoT_Action()
The function is this:
function DoT_Action takes nothing returns nothing
functions
endfunction

I hope you can help me!
Thank you in advance!

-Atami
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
Make sure the function is declared above its call. The code is read from top to bottom while compiling.

Code in trigger leaves are sorted after the leaves' order in the list on the left. But you'll have to reload the map to update this order for newly created leaves. That's a possibility why it has worked yesterday.
 
Level 5
Joined
Oct 9, 2008
Messages
112
Make sure the function is declared above its call. The code is read from top to bottom while compiling.

Code in trigger leaves are sorted after the leaves' order in the list on the left. But you'll have to reload the map to update this order for newly created leaves. That's a possibility why it has worked yesterday.

I thinkl i need to explain more... I want to call the function with a GUI trigger. And if i save the jass helper give me a error the undeclared function variable.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
I'm positive that GUI triggers are below Jass ones if they are also placed below them in the list. Never had a problem with it in test maps. But vJass can influence the visibility between parts of code, so I only speak for normal Jass.

You can also put the function into the header (select the root in the trigger list's spire that is named after the map's file name). This should be above all other triggers.

If you use vJass, more details/parts of code would be good.

Code:
function DoT_Action takes nothing returns nothing
functions
endfunction

There is not really "functions" written between start and end of the function, is there?
 
Level 5
Joined
Oct 9, 2008
Messages
112
I'm positive that GUI triggers are below Jass ones if they are also placed below them in the list. Never had a problem with it in test maps. But vJass can influence the visibility between parts of code, so I only speak for normal Jass.

You can also put the function into the header (select the root in the trigger list's spire that is named after the map's file name). This should be above all other triggers.

If you use vJass, more details/parts of code would be good.

Code:
function DoT_Action takes nothing returns nothing
functions
endfunction
There is not really "functions" written between start and end of the function, is there?

if you wnat i can send u the map to take a look on it!
 
Level 8
Joined
Jun 13, 2008
Messages
346
I have the exact same problem...original map is compiled perfectly but when I import the spell and the functions that it uses to my map, it says that undeclared function error..like wtf?....everything else are all set, like variables and stuff...I even ordered the files like the original map but it still doesn't compile it but it does for the original map:S
 
Make a copy of your trigger where it says "undeclared function" and delete the original one. It should work now if the function exists.

But the better way is to put the function to call into the trigger header or to put it into a library (requires JessHelper).


1-png.249314


  1. click on map header
  2. insert your code
 

Attachments

  • 1.PNG
    1.PNG
    21.9 KB · Views: 516
Level 13
Joined
Nov 7, 2014
Messages
571
If I remember correctly the order WE puts the contents of each Category/Folder and the triggers inside of them to war3map.j is the order the user has arranged them:

category A
trigger A1
function A1a
function A1b​
trigger A2
function A2a
function A2b​

category B
trigger B1
function B1a; can call A1a, A1b, A2a and A2b
I.e you have to manually sort the dependencies of each function if you don't want to use jasshelper/vJass/libraries.

 
Status
Not open for further replies.
Top