Psilocybe 3 Posted March 24, 2013 Hi guys. I have spend the last few days reading and re reading the Wiki on scripting basics, i now know how to do more things than just copying and pasting other peoples scripts, but I want to know more. My first question is with variables. Example: "myVariable = 0;" Why is it = 0? I am able to translate control structures and other bits of script so that when I read them into lamens terms that I can freely understand, but when I do the "myVariable = 0;" I feel as though I am just "doing as the Romans do". I want to get myself to the level where everything or at least the language, makes sense. Share this post Link to post Share on other sites
Tisor 17 Posted March 24, 2013 = 0 means you are assigning that variable a value of 0. In that case, variable is an integer. You can also use boolean (You'll assign True or False) or an array (more complex stuff). Remember that, if you want to make a condition like "When myVariable equals 0 then..." you will have to use MyVariable == 0 instead of only one equal sign. = is to assign a value and == to check if something is equal than. Share this post Link to post Share on other sites
ceeeb 147 Posted March 24, 2013 It's most likely an example of correct syntax (showing how, not why). How a variable is used is more significant than it's initial value, although it's initial value does define it's type (0 is a number). Without the context of a mission or remaining script(s), to see where the variable is used again, it is pretty meaningless. Share this post Link to post Share on other sites
tet5uo 4 Posted March 25, 2013 Is this scripting language at all like javascript? I just started teaching myself that a few weeks ago. Seems like some arma scripting might be good practice. Share this post Link to post Share on other sites
Psilocybe 3 Posted March 25, 2013 (edited) Reserving this space, I had written somthing, but i have made more head way. Edited March 25, 2013 by RAINF Share this post Link to post Share on other sites
tet5uo 4 Posted March 25, 2013 Okay, so the number 0 is like in, for example, in UPSMON there ais://1=Enable or 0=disable debug. In debug could see a mark positioning de leader and another mark of the destination of movement, very useful for editing mission KRON_UPS_Debug = 1; 0 being that I cannot see the debug monitor, and one being that I can see the debug monitor? In that case the variable is a boolean and is only true (1) or false (0). Variable doesn't only have to be boolean value , you can also assign it a number , or it can even be an array or object. It's just a way to be able to store information and represent it by the variable's name. Share this post Link to post Share on other sites
Psilocybe 3 Posted March 26, 2013 So a Boolean is a true or false, but its always one or the other, where as assigning a number, for example, 0-1 has the possibility of 0.1, 0.2 etc etc allowing me to have > < = etc etc. Share this post Link to post Share on other sites