cyber-menace Posted August 19, 2003 I have an easy question this time. What is one easy line of scripting that will add 1 to a variable. I'm going to have this adding up to six. I need it for my current map. (Disabling bombs gives the variable a point, if all 6 are disabled script 1, the bomb script, stops!) 0 Share this post Link to post
Darkstalker Posted August 19, 2003 If (i==6) { ACS_Terminate(bombscript#,map); } else { i++; } Could be something like that. 0 Share this post Link to post
cyber-menace Posted August 19, 2003 Hey that will work perfectly! And it makes it so I only have to use one script. Thanks Much! 0 Share this post Link to post
cyber-menace Posted August 19, 2003 Ok, so I found out I need more than one script... but it still works perfectly so thanks. 0 Share this post Link to post
Ultraviolet Posted August 19, 2003 boris said:Did you consider to RTFM??? Pardon me sir, but do you have any grey poupon? 0 Share this post Link to post
Epyo Posted August 19, 2003 Wanna know how to add 2? variable = variable + 2; Wanna know how to add 3? variable = variable + 3; Wanna know how to add 4? variable = variable + 4; Wanna know how to add 5? variable = variable + 5; Wanna know how to add 2 variables together? combo = variableA + varibleB; Wanna know how to subtract 2 from a variable? variable = variable - 2; Wanna know how to add 2 variables then subtract 2? combo = varA + varB -2; Heh, you know about the Zdoom reference right? Well Randy's making a new one since this one is so old. Cool. 0 Share this post Link to post
Carnevil Posted August 19, 2003 Epyo said:Wanna know how to add 2? variable = variable + 2; Wanna know how to add 3? variable = variable + 3; Wanna know how to add 4? variable = variable + 4; Wanna know how to add 5? variable = variable + 5; Wanna know how to add 2 variables together? combo = variableA + varibleB; Wanna know how to subtract 2 from a variable? variable = variable - 2; Wanna know how to add 2 variables then subtract 2? combo = varA + varB -2; Heh, you know about the Zdoom reference right? Well Randy's making a new one since this one is so old. Cool. Yes but how do you add 1?!?!? 0 Share this post Link to post
Cyb Posted August 19, 2003 omg!%^ var++; //add one to var var += 2; //add two to var var += 3; //add three to var var += x; //add x to var var -= 7; //subtract 7 from var var--; //subtract 1 from var var *= 2; //same as var = var * 2; var /= 4; //same as var = var / 4; 0 Share this post Link to post
Nanami Posted August 19, 2003 What if we want to add, subtract, multiply, or divide two-digit numbers Cyb? 0 Share this post Link to post
Cyb Posted August 20, 2003 uh, x += 10; x /= 1728; x *= 751; tada! you can also do stuff like: x *= 0.75; //75% of x x /= 0.5; //double x but those will only work if x is an int, not fixed point. if x is fixed point (1.2 or something like that) you need to do: x = fixedmul(x, 0.75); x = fixeddiv(x, 0.5); (aside from the last two lines, this is all fairly standard programming stuff avaliable in most (if not all) programming languages, in case you wanted to know or something :P ) 0 Share this post Link to post
Nanami Posted August 21, 2003 You didn't explain how to subtract two-digit numbers. =/ 0 Share this post Link to post
Cyb Posted August 21, 2003 Nanami said:You didn't explain how to subtract two-digit numbers. =/ rofl the same exact way x -= 25; x -= 38343; 0 Share this post Link to post
boris Posted August 21, 2003 Cyb said:rofl the same exact way x -= 25; x -= 38343; What if my variable is not named "x"? 0 Share this post Link to post
cyber-menace Posted August 21, 2003 OMG even I can answer that! y -= 25; whatever -= 25; something *= 25; etc /= 25; 0 Share this post Link to post
Anders Posted August 21, 2003 Can anyone else confirm that cyber-menace is right? I really need this in a script I'm writing. But I don't want it to go havoc and break my computer or something. 0 Share this post Link to post
Cyb Posted August 21, 2003 after careful testing I can indeed say he is correct. however you need to uh, initalize those varible thingies otherwise it won't work... 0 Share this post Link to post
boris Posted August 21, 2003 Cyb said:however you need to uh, initalize those varible thingies otherwise it won't work... Where can I do that? Is it expensive? 0 Share this post Link to post
Nanami Posted August 21, 2003 I don't think it's legal in your country. 0 Share this post Link to post
cyber-menace Posted August 21, 2003 Initializing is done before the scripts. It's quite simple. Here's a couple of examples. #include "zcommon.acs" int variablename int forcef (Scripts go here) See it's that simple. So give'er a try. 0 Share this post Link to post
Carnevil Posted August 21, 2003 boris said:What if my variable is not named "x"? rofl 0 Share this post Link to post
Cyb Posted August 21, 2003 boris said:Where can I do that? Is it expensive? nah, it's like 10 bucks/euros a variable or something so I guess you should try not to use too many. head to your local variable initilization store (if you don't have one there's an internet site, variableinitilizationsonline.com) and pay them and they'll get it done for you 0 Share this post Link to post
cyber-menace Posted August 21, 2003 If you guys keep joking around like this someone might just put this in post hell... I know I can't, but maybe someone else can. 0 Share this post Link to post