HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Questions on Custom UDG scripts

03-12-2005, 12:37 AM#1
MeTaCo
if your variables are arrays, how would u put them on a custom udg script?

example:
var tempcast[1]

"call RemoveLocation(udg_TempCast)"

how can you put that into array in custom scripts?

thanks in advance!

another question is if you are able to put a number into the custom scripts, how could you make the custom script local?

does this work?
"Call RemoveLocation(udg_TempCast[local])"
03-12-2005, 04:11 AM#2
Raptor--
arrays are treated as yourvariable[index] so globally defined variables would be udg_variable[index]

local variables are treated the exact same
03-12-2005, 06:41 AM#3
Guest
call RemoveLocation(udg_TempCast[1])
03-12-2005, 01:13 PM#4
johnfn
Yes.

And if you ever want to know how variables are defined in JASS, convert a useless trigger to JASS, make an error in it, disable and re-enable, then scroll to the top of the code it gives you, where all the variables are defined. Thats really helpful for getting the types of variables.
03-12-2005, 03:59 PM#5
shadow1500
arrays are defined as "local <var type> array <var name>"
example: "local boolean array myBoolean", and used as "set <Var Name>[index] = <value>"
Example: "set myBoolean[0] = true"

and i dont know what you mean by making a custom script local, plz explain.
03-14-2005, 02:51 AM#6
MeTaCo
Quote:
Originally Posted by johnfn
Yes.

And if you ever want to know how variables are defined in JASS, convert a useless trigger to JASS, make an error in it, disable and re-enable, then scroll to the top of the code it gives you, where all the variables are defined. Thats really helpful for getting the types of variables.

very interesting how you put it that way, + rep for u and shadow1500! and thank you shadow thats exactly what I needed to know! :)

btw thanks all for replying!
03-14-2005, 03:53 AM#7
MeTaCo
Quote:
Originally Posted by shadow1500
arrays are defined as "local <var type> array <var name>"
example: "local boolean array myBoolean", and used as "set <Var Name>[index] = <value>"
Example: "set myBoolean[0] = true"

and i dont know what you mean by making a custom script local, plz explain.

well when I say local, what I mean is like this, the example I used in destroying a point, I want it kind of like for integer A 1 to 10 do (the call action thingy[integerA]) so that for each triggering player it will destroy "it's own point"
03-14-2005, 08:53 AM#8
Raptor--
seeing as how arrays are simply a series of variables referenced in a different way, wherever you use local non-array variables you can substitute it with the local array variable

ie,
Call RemoveLocation( udg_Temp[GetForLoopIntegerA()] ) works
Call RemoveLocation( localArray[GetForLoopIntegerA()] ) works
Call RemoveLocation( udg_Temp[localinteger] ) works
Call RemoveLocation( localArray[localinteger] ) works
etc...
03-15-2005, 12:23 AM#9
MeTaCo
Quote:
Originally Posted by Raptor--
seeing as how arrays are simply a series of variables referenced in a different way, wherever you use local non-array variables you can substitute it with the local array variable

ie,
Call RemoveLocation( udg_Temp[GetForLoopIntegerA()] ) works
Call RemoveLocation( localArray[GetForLoopIntegerA()] ) works
Call RemoveLocation( udg_Temp[localinteger] ) works
Call RemoveLocation( localArray[localinteger] ) works
etc...

thx, this answer serves a purpose even tho I did what johnfn said, and found another way around it.