• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

JASS Code Organization Problem

Status
Not open for further replies.
Level 6
Joined
Jan 17, 2010
Messages
149
SOLVED

Solution:
Create a trigger you want to put the "library" in and put it above all other triggers that are to call the library functions. Any functions that are written in that library trigger will be accessible to the triggers below it. Now here is the catch, in order for it to work you absolutely have to restart the map or the compiler will whine and complain that it cannot find those library functions.

Stupid, I know, but that's how it works with the classic world editor.




Original Issue:
When you put functions in the map header, those functions will be accessible globally. This method however, can spam the map header with a lot of code and make it extremely hard to maintain and expand as more code is added in.

My question is: What are the ways of mimicking this global function sharing effect?

I know it is possible because I've seen map triggers sharing code in between triggers and their functions. But when I try to do the same thing, the compiler complains it cannot find the functions I want to call.

I've tried 5 different tutorials on JASS but none of them seemed to address map headers or "global" functions. Any help is greatly appreciated.
 
Last edited:
When you put functions in the map header, those functions will be accessible globally. This method however, can spam the map header with a lot of code and make it extremely hard to maintain and expand as more code is added in.

My question is: What are the ways of mimicking this global function sharing effect?

I know it is possible because I've seen map triggers sharing code in between triggers and their functions. But when I try to do the same thing, the compiler complains it cannot find the functions I want to call.

I've tried 5 different tutorials on JASS but none of them seemed to address map headers or "global" functions. Any help is greatly appreciated.

try vJass, then you can use library or scope. use the latest Jass NewGen Pack and the latest JassHelper
 
Level 6
Joined
Jan 17, 2010
Messages
149
The problem with vJass for me is that I am unfamiliar with it and I'll probably have a lot of trouble transferring to vJass (I'm scared of new stuff =| ). Thanks for the links though, I would defiantly look into that.

Still this thing greatly puzzles me, I've seen regular Jass code doing the same thing vJass libraries do.

Edit: Found solution myself, can't believe that it was that simple which is why it took me so long to find the solution, even caused me to make a post here =.= ...

P.S was an absolute fluke I found it too...
 
Last edited:
SOLVED

Solution:
Create a trigger you want to put the "library" in and put it above all other triggers that are to call the library functions. Any functions that are written in that library trigger will be accessible to the triggers below it. Now here is the catch, in order for it to work you absolutely have to restart the map or the compiler will whine and complain that it cannot find those library functions.

Stupid, I know, but that's how it works with the classic world editor.




Original Issue:
When you put functions in the map header, those functions will be accessible globally. This method however, can spam the map header with a lot of code and make it extremely hard to maintain and expand as more code is added in.

My question is: What are the ways of mimicking this global function sharing effect?

I know it is possible because I've seen map triggers sharing code in between triggers and their functions. But when I try to do the same thing, the compiler complains it cannot find the functions I want to call.

I've tried 5 different tutorials on JASS but none of them seemed to address map headers or "global" functions. Any help is greatly appreciated.

if you will use JNGP you can place that "library" into any place and you won't need to restart the WE. You just need to place the word library and endlibrary in that trigger

JASS:
library yourlibrary

//Your code here
endlibrary
 
Status
Not open for further replies.
Top