issue with using 'and' statement

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

issue with using 'and' statement

#1 Post by lisa »

This is no doubt purely an issue with how I am trying to use it but I just can't seem to get the code to work.

This code sets player.Class2 == CLASS_SCOUT even though there is no class2 yet. So amu will only = 1 if second class is set to scout.

Code: Select all

if  _charclass2answer == "2" then
		_charclass2 = "_scout"
		mpuser2 = "1"
		amu = "1"
end
Next code always returns mpuser = 99, never makes it = 0

Code: Select all

if player.Class1 == CLASS_ROGUE and mpuser2 == "1" then mpuser = "0" else mpuser = "99" end
but the following code works perfectly

Code: Select all

if player.Class1 == CLASS_SCOUT or amu == "1" then buyarrows = "2" else buyarrows = "0" end
Only difference is the usage of 'and' and 'or'
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
User avatar
Administrator
Site Admin
Posts: 5353
Joined: Sat Jan 05, 2008 4:21 pm

Re: issue with using 'and' statement

#2 Post by Administrator »

I think part of your problem is that you're using strings to compare numbers. Why are you putting those integers in quotes?
User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: issue with using 'and' statement

#3 Post by lisa »

that would explain it, numbers = no "" , otherstuff = "" lol
Only been at this coding stuff 3-4 weeks =)


Works perfectly now, ty
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
Post Reply