• 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] Question about function argument

Status
Not open for further replies.
Level 9
Joined
Jan 15, 2008
Messages
235
Hello to all people,
im kinda new to jass...
but im not new to coding things...

i was trying to make something
and i saw some dumb thing in we.
I cannot add action function to trigger if it have some argument like "takes integer i" string or whatever...

Is it possible or impossible ?

for those who didnt understood me, here is an example
JASS:
function Repeat_Actions takes integer i returns nothing
//do anything... but i need that variable i for it
endfunction


function Trig_Main_Actions takes nothing returns nothing
	local trigger repeatme
	set repeatme = CreateTrigger(  )
	call TriggerRegisterTimerEventPeriodic( repeatme, 2 )
	call TriggerAddAction( repeatme, function Repeat_Actions(0) )

endfunction
its stupid example, and it doesnt do anything wise, but its way how things should work, make function, define arguments and then send arguments when call function... its not rocket science but seams that blizzard's people made it kinda crappy...

and btw. i use simple WE. and i kinda want to stay on it. i saw NewGen thing what have struct, its nice but ... its long story... let's just say that i want this to make works on simple WE.
ps. i dont want to use any global variable

Thanks for your time,
I hope that this can be done somehow

Markone
 
Last edited by a moderator:
Level 11
Joined
Feb 18, 2004
Messages
394
It is not possible to pass values to callbacks like that. You would need to attatch the value to an element in common between the caller and callback. (In the case of a trigger, the trigger object. In the case of a timer, the timer object.) vJASS systems to help with that: http://wc3campaigns.net/pastebint.php?t=93235&code=29e26baa170b05af2d3ffd04408ae7e1 (Requires NewGen, like all sane JASS code...) There is likely an alternate solution for your issue that won't require that.

Refusing to use NewGen for any reason beyond being solely a mac / linux user is just stupid. Use NewGen if you are able to use it. You're a fool to not, if it is an active choice. It doesn't just include vJASS, but also stops the editor from crashing upon some syntax errors, and so, so much more.

Also, use
JASS:
 tags instead of [code] ones...
 
Level 9
Joined
Jan 15, 2008
Messages
235
well its not like u helped me, ... u said me all what i did know ...that is that it can be done using newgen and vjass.

I want to find way to do it without that, cause i cant belive that blizz's people made it so crappy...
 
Level 9
Joined
Jan 15, 2008
Messages
235
i never said that its not sane... nor i asked is it sane, i dont get why u keep telling that.
do u want good reason why im asking for making it without newgen? i have it, but its not point. if i asked how to solve something and gave conditions, and if condition exclude newgen then why u are talking abt it all the time :S

so if its possible would u be so nice to tell me how :)
Do you mean with handles attached to new trigger? Or there is another way?
 
Level 9
Joined
Jan 15, 2008
Messages
235
i dont have anything against it, but i like to know how things work and i never belive that there is just 1 way to do something, cause coding was never like that in any language, so why it should be in we ;)
 
Level 11
Joined
Feb 18, 2004
Messages
394
i dont have anything against it, but i like to know how things work and i never belive that there is just 1 way to do something, cause coding was never like that in any language, so why it should be in we ;)

http://en.wikipedia.org/wiki/Python_(programming_language)
Python 3.0 is being developed with the same philosophy as in prior versions, so any reference to Python philosophy will apply to Python 3.0 as well. However, as Python has accumulated new and redundant ways to program the same task, Python 3.0 has an emphasis on removing duplicative constructs and modules, in keeping with "There should be one—and preferably only one—obvious way to do it".

as a minor example...

Just because there is more than one way to do something, does not mean you should so something in a stupidly inferior way, just because. Learn how to understand and use the best methods at your disposal, or forever suck.
 
Level 9
Joined
Jan 15, 2008
Messages
235
oh guys, what is problem with u all, new gen new gen new gen, its nice tool, but what if noone ever made it...? i didnt opened topic to talk abt should u use newgen, answer is simple yes u should. so plz stop be annoying with that!!!
 
Level 17
Joined
Apr 13, 2008
Messages
1,608
Yea, well, what if noone ever would have made fire. We should eat out food uncooked.
I was merely asking why are you against NewGen Pack (since it wasn't clear why do you want experience crashes and a retarded syntax checker and whatnot).
We should all program in computer code and play Pacman because what if Wc3 was never made.

Okay, sorry for going half-offtopic.
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
markone, we were around before NewGen, and we got along without it just fine. It seemed to be the best of times, because there were no alternatives.

Then a better alternative came around (NewGen)... why not use it? As emperor_d3st said, it's like the fact that we would just eat our food uncooked if we never acquired fire. However, if we did acquire it, continuing to eat everything uncooked when the alternative is preferable would be a rather odd choice indeed.
 
Level 11
Joined
Feb 18, 2004
Messages
394
I'll make a really simple comparison:

If I had to code in normal JASS, and not use any of NewGen's additions to WC3, I would not still be here, because it would have driven me insane a long time ago.

There is a reason that NewGen (Or really, any modding tool) was created. Tools are created to add functionality that is needed. Are you going to convert textures by hand, instead of using a JPEG/PNG -> BLP converter?.. Are you going to edit MPQ archives with a hex editor, just because we had no import manager in RoC days?.. Are you going to edit SLK files in notepad, because thats what we had to do in RoC to add spells / doodads / destructables / buffs?.. These are all basically equivalent to choosing to not use NewGen... Hell, even Pyrogasm, who only has a Mac (Which can't run NewGen!) managed to get the vJASS compiler working so he didn't have to code in normal JASS anymore...
 
Level 9
Joined
Jan 15, 2008
Messages
235
omfg, i will say once again from begining, although its totally of this topic.

I respect NewGen thing, i am thanksfull to Vex who made it, and all other people who helped or worked with him.

I do not find hard to use it, its like any other programing language, maybe even easier, whole we doesnt have any dynamic memory, pointers and similar things, WE is not rocket science. Every 3rd kid use it.

I do not think that code what is not made in NewGen sux.

Im electronic engineer, as any other engineer i like to know how does it work. if u want stupid example then i will tell u (i see that u guys really like to talk with examples... and with bad words)

u can fuck girl on 100+ ways... there is book abt that, its called kamasutra.
http://en.wikipedia.org/wiki/Kama_Sutra

Someone ways are better, some are not. that doesnt mean that if u know the best way that u shouldnt know others. for general understanding

i think that i was clear enough

plz any mod lock this thread.
im sad that i lost my time with so hard headed people.
@Purple Poot thanks for your help and understanding my questions.

regards
Markone
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
If you want to know how NewGen works, it's nothing to do with this. It has to do with a ton of arrays with the struct itself being an integer which is an index in all the relevant arrays, which is more efficient than GameCache but terribly ugly to maintain in code which doesn't have it simplified as syntax (like vJass does).
 
Last edited:
Status
Not open for further replies.
Top