Baron of Hell
Register | User Profile | Member List | F.A.Q | Privacy Policy | New Blog | Search Forums | Forums Home
Doomworld Forums : Powered by vBulletin version 2.2.5 Doomworld Forums > Classic Doom > Doom Editing > Adding to Variables
 
Author
All times are GMT. The time now is 11:22. Post New Thread    Post A Reply
cyber-menace
Forum Regular


Posts: 922
Registered: 03-03


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!)

Old Post 08-19-03 11:26 #
cyber-menace is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
Darkstalker
Should be mapping


Posts: 1107
Registered: 12-01


code:
If (i==6) { ACS_Terminate(bombscript#,map); } else { i++; }

Could be something like that.

Last edited by Darkstalker on 08-19-03 at 11:46

Old Post 08-19-03 11:37 #
Darkstalker is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
cyber-menace
Forum Regular


Posts: 922
Registered: 03-03


Hey that will work perfectly! And it makes it so I only have to use one script. Thanks Much!

Old Post 08-19-03 11:51 #
cyber-menace is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
cyber-menace
Forum Regular


Posts: 922
Registered: 03-03


Ok, so I found out I need more than one script... but it still works perfectly so thanks.

Old Post 08-19-03 12:41 #
cyber-menace is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
boris
meow


Posts: 3743
Registered: 05-00


Did you consider to RTFM???

__________________
this sig is in my pants | WIP - WADs In Progress: post your WADs!

Old Post 08-19-03 13:40 #
boris is offline Profile || Blog || PM || Search || Add Buddy IP || Edit/Delete || Quote
Ultraviolet
933-phunk-5up4h-94n9574


Posts: 3241
Registered: 03-02



boris said:
Did you consider to RTFM???
Pardon me sir, but do you have any grey poupon?

__________________
Everything is under control.

Old Post 08-19-03 13:48 #
Ultraviolet is offline Profile || Blog || PM || Search || Add Buddy IP || Edit/Delete || Quote
Epyo
Dude


Posts: 2921
Registered: 06-02


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.

__________________
Pacman Doom 2 Play with latest version of ZDoom!

Old Post 08-19-03 15:01 #
Epyo is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
Carnevil
I fail it.


Posts: 1317
Registered: 05-00



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?!?!?

__________________
Skulltag project leader
---
<smcn> one of these days
<smcn> i'm going to hunt down and kill whoever invented emoticons
<smcn> then i'm going to look at him and go >=D

Old Post 08-19-03 21:40 #
Carnevil is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
Cyb


Posts: 2726
Registered: 07-02


omg!%^

code:
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;

Old Post 08-19-03 23:11 #
Cyb is offline Profile || Blog || PM || Search || Add Buddy IP || Edit/Delete || Quote
Nanami
not a woman


Posts: 2655
Registered: 07-02


What if we want to add, subtract, multiply, or divide two-digit numbers Cyb?

__________________
ZooM, the ZDoom Racing Mod

Old Post 08-20-03 00:52 #
Nanami is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
Cyb


Posts: 2726
Registered: 07-02


uh,

code:
x += 10; x /= 1728; x *= 751;


tada!

you can also do stuff like:

code:
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:

code:
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 )

Old Post 08-20-03 03:50 #
Cyb is offline Profile || Blog || PM || Search || Add Buddy IP || Edit/Delete || Quote
Nanami
not a woman


Posts: 2655
Registered: 07-02


You didn't explain how to subtract two-digit numbers. =/

__________________
ZooM, the ZDoom Racing Mod

Old Post 08-21-03 03:48 #
Nanami is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
Cyb


Posts: 2726
Registered: 07-02



Nanami said:
You didn't explain how to subtract two-digit numbers. =/


rofl the same exact way

x -= 25;
x -= 38343;

Old Post 08-21-03 06:44 #
Cyb is offline Profile || Blog || PM || Search || Add Buddy IP || Edit/Delete || Quote
boris
meow


Posts: 3743
Registered: 05-00



Cyb said:


rofl the same exact way

x -= 25;
x -= 38343;


What if my variable is not named "x"?

__________________
this sig is in my pants | WIP - WADs In Progress: post your WADs!

Old Post 08-21-03 13:46 #
boris is offline Profile || Blog || PM || Search || Add Buddy IP || Edit/Delete || Quote
cyber-menace
Forum Regular


Posts: 922
Registered: 03-03


OMG even I can answer that!

code:
y -= 25; whatever -= 25; something *= 25; etc /= 25;

Old Post 08-21-03 14:41 #
cyber-menace is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
Anders
No one knows I'm schepe


Posts: 427
Registered: 03-02


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.

__________________
++++++++++[>++++++++++>++++++++++++>+++++++++++>++
+>+<<<<<-]>.>-.>>++.<<<++.>>+.+++.<--.>-----.+++++
+.>.<<<-----.>>-.<<++++.>>>.<<<++.------.>++++.>>>.

Old Post 08-21-03 15:34 #
Anders is offline Profile || Blog || PM || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
Cyb


Posts: 2726
Registered: 07-02


after careful testing I can indeed say he is correct. however you need to uh, initalize those varible thingies otherwise it won't work...

Old Post 08-21-03 15:39 #
Cyb is offline Profile || Blog || PM || Search || Add Buddy IP || Edit/Delete || Quote
Nanami
not a woman


Posts: 2655
Registered: 07-02


Cyb you're confusing me!

__________________
ZooM, the ZDoom Racing Mod

Old Post 08-21-03 15:45 #
Nanami is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
boris
meow


Posts: 3743
Registered: 05-00



Cyb said:
however you need to uh, initalize those varible thingies otherwise it won't work...

Where can I do that? Is it expensive?

__________________
this sig is in my pants | WIP - WADs In Progress: post your WADs!

Old Post 08-21-03 17:05 #
boris is offline Profile || Blog || PM || Search || Add Buddy IP || Edit/Delete || Quote
Nanami
not a woman


Posts: 2655
Registered: 07-02


I don't think it's legal in your country.

__________________
ZooM, the ZDoom Racing Mod

Old Post 08-21-03 17:22 #
Nanami is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
cyber-menace
Forum Regular


Posts: 922
Registered: 03-03


Initializing is done before the scripts. It's quite simple. Here's a couple of examples.

code:
#include "zcommon.acs" int variablename int forcef (Scripts go here)


See it's that simple. So give'er a try.

Old Post 08-21-03 17:44 #
cyber-menace is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
Nanami
not a woman


Posts: 2655
Registered: 07-02


Actually, you need semicolons.

__________________
ZooM, the ZDoom Racing Mod

Old Post 08-21-03 17:46 #
Nanami is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
Carnevil
I fail it.


Posts: 1317
Registered: 05-00



boris said:

What if my variable is not named "x"?

rofl

__________________
Skulltag project leader
---
<smcn> one of these days
<smcn> i'm going to hunt down and kill whoever invented emoticons
<smcn> then i'm going to look at him and go >=D

Old Post 08-21-03 18:02 #
Carnevil is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
Cyb


Posts: 2726
Registered: 07-02



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

Old Post 08-21-03 20:01 #
Cyb is offline Profile || Blog || PM || Search || Add Buddy IP || Edit/Delete || Quote
cyber-menace
Forum Regular


Posts: 922
Registered: 03-03


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.

Old Post 08-21-03 20:44 #
cyber-menace is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
All times are GMT. The time now is 11:22. Post New Thread    Post A Reply
 
Doomworld Forums : Powered by vBulletin version 2.2.5 Doomworld Forums > Classic Doom > Doom Editing > Adding to Variables

Show Printable Version | Email this Page | Subscribe to this Thread

 

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are OFF
[IMG] code is ON
 

< Contact Us - Doomworld >

Powered by: vBulletin Version 2.2.5
Copyright ©2000, 2001, Jelsoft Enterprises Limited.

Forums Directory