ID:174581
 
I can't seem to get this... I'm trying to get the ammo var. to equal another variable. so if pistol==1 then ammo = pbullets. if rifle==1 then ammo = rbullets... I cant seem to create this.
Cloudiroth wrote:
I can't seem to get this... I'm trying to get the ammo var. to equal another variable. so if pistol==1 then ammo = pbullets. if rifle==1 then ammo = rbullets... I cant seem to create this.

Well use src or usr (Only use usr in verbs, src is what goes in procs), try and use src more however.

like this: (in verb)

usr.pbullets=usr.rbullets

or like this (in proc)

src.pbullets=src.rbullets
In response to Wanabe
thats helps but still confused, im trying to get where if usr.pistol = 1 then usr.ammo = usr.pbullets
Cloudiroth wrote:
I can't seem to get this... I'm trying to get the ammo var. to equal another variable. so if pistol==1 then ammo = pbullets. if rifle==1 then ammo = rbullets... I cant seem to create this.


I think I get what you're trying to say, but let me suggest a better way of doing it. Instead of having yes or not flags for every possible type of gun you could have, have one variable that supports all gun types.

<code>var/gun = 1</code>

Then have the number determine which gun is being used.

1 is pistol
2 is rifle
3 is lasermajig, etc...

Then you can use a simple switch statement to determine the ammo type to use.

<code>switch(gun) if(1) ammo = pbullets if(2) ammo = rbullets if(3) ammo = lbullets</code>

You could also use text strings instead of numbers, so gun = "pistol" or gun = "rifle", etc...

Does that help any?


Other than that, I'm not sure what you're trying to do with the bullets variables, so I'm not sure how to help.
In response to Cloudiroth
Saying usr.whatever all the time will lead to confusion, use of usr in procs, and Lummox JR saying "Ungh."