Quick question, public functions

Amn

Member
Reaction score
18
is it possible to store public functions in some other way than pile them up all inside that trigger general section ?

it gets kinda messy after some code, maybe i could have some sort of sections or something. how about gui triggers, on each trigger i put a function in there, easier to code, cleaner. but this triggers cant have public functions, its scope dies there. so any ideas for this? thx
 

PurgeandFire

zxcvmkgdfg
Reaction score
509
I'm not sure what you are asking. You don't have to make things public, and if a scope ends with your function out of it, then just don't add a public prefix and name it something else. =)
 

Amn

Member
Reaction score
18
oh ok, let me elaborate

i have a new function to make units fade out when they die, its name is unit_fade ( which unit )
any trigger can call it but over time my general functions section got too big and it's hard to work now having that many functions

so my question is; is there any way to organize functions on separate sections ?
can i have my unit_fade function on a new trigger and still be able to call it from anywhere ?
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
to do this you use a library:

JASS:
library MiscFunctions
    function this takes nothing returns nothing
    endfunction

    function otherFunction takes nothing returns nothing
        call this()
    endfunction
endlibrary


notice the function this is above the function otherFunction because it is used by otherFunction, anything that calls a function must be below that function when the script compiles, libraries are automatically at the top when it compiles
 

Amn

Member
Reaction score
18
to do this you use a library
exactly! it worked, thx!.

pd: last time i tried libraries jasshelper gave me sintax errors so i gave up on that, but now that u mentioned it again i tried to solve the errors and it worked.

in case anyone needs it i solved those sintax errors by adding this reg key
"HKEY_CURRENT_USER\Software\Blizzard Entertainment\Software\Grimoire\War3InstallPath" value = your war3 path
then make sure u have jasshelper enabled on worldeditor>menu jasshelper> enable jasshelper.
and save before test, if not it crashes.

:)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top