Oh common... Is Jass that stupid?

Genyuumaru

New Member
Reaction score
15
I have a trigger that I converted to custom text and wrote a function called "Text" in it.

In other GUI triggers I want to sometimes use this function.

I use a GUI line:
Code:
custom script: call Text()

Simple, no?

And get a pretty "Expected a function name" text.

Is WE just beeing stupid -_- ?

And also I heard a GUI that was talking about private functions like]
private function Text

But all that line gives me is a error. I even think that it doesn't exist, because functions can't run from other triggers like in my situation :(

So, what's going on around here? Any help please?
 

Vexorian

Why no custom sig?
Reaction score
187
functions need to be above the place where you call them. This wouldn't matter that much if it wasn't for the fact that WE adds the triggers' contents basically at random positions...

So, someone should design a way to for example use special syntax to tell a preprocessor where specifically to put each function, hmnn, sounds like a great idea...
 

Genyuumaru

New Member
Reaction score
15
But that sux :(

Is there some way I may skip on compiling the trigger so that maybe it works ingame?
 

phyrex1an

Staff Member and irregular helper
Reaction score
447
It won't work in game either. The rules are the same there. The easiest thing to do is to move the Text function to the "custom script section", that's the icon with your map name on the top of the trigger list.

The only real solution is to stop using the GUI and use jass with newgen. That way you have the "special syntax to tell a preprocessor where specifically to put each function" that Vexorian is talking about.
 

Darius34

New Member
Reaction score
30
Trigger code is ordered in the map script in the order in which the triggers were created. So, you could also put the Test() function in the first trigger you created in your map.

Edit: Since this wasn't covered...

If you wanted to use the NewGen pack (sticky in this forum), you could libraries to order code.

JASS:
library MiscFunctions
function Test takes nothing returns nothing
...
endfunction
endlibrary

That'd move the function Test() above the Custom Script section. You'd then be able to call it anywhere.
 

Cheesy

some fucker
Reaction score
95
How would that make it complicated? It's very simple. Just convert a trigger to Custom Text and write out the code he put.
 

Genyuumaru

New Member
Reaction score
15
I already wrote my own code and did as phyrex1an described. Everything works, why do I need to complicate my life if everything is working?

It won't work in game either. The rules are the same there. The easiest thing to do is to move the Text function to the "custom script section", that's the icon with your map name on the top of the trigger list.
 

Viikuna

No Marlo no game.
Reaction score
265
There is nothing wrong with "custom script section".
Libraries just make it easier for you to organize your functions.
It is pain in the ass to try to find and edit some function from custom script section, when you have few thousands lines of code in there.
And libraries allow you to use private and public keywords.


Libraries make everything a lot of easier and that is the reason why you should use them.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top