ID:147085
 
When I added 5-9 on the misc.skills list and compiled an error came up and said expected end of statement for statpanel("Skills") and there was another error for that same line it said missing comma',' or right paren. ')'.Then for the if usr.combats = 1 and the other 2 like it, it says and error and it says the error is missing condition.Can anyone fix this?


statpanel("Skills")
stat("-=Major Skills=-")
stat("[usr.mname1]:","[usr.mskill1]")
stat("[usr.mname2]:","[usr.mskill2]")
stat("[usr.mname3]:","[usr.mskill3]")
stat("[usr.mname4]:","[usr.mskill4]")
stat("-=Minor Skills=-")
stat("[usr.miname1]:","[usr.miskill1]")
stat("[usr.miname2]:","[usr.miskill2]")
stat("[usr.miname3]:","[usr.miskill3]")
stat("[usr.miname4]:","[usr.miskill4]")
stat("-=Miscellaneous Skills=-")
stat("[usr.misname1]:","[usr.misskill1]")
stat("[usr.misname2]:","[usr.misskill2]")
stat("[usr.misname3]:","[usr.misskill3]")
stat("[usr.misname4]:","[usr.misskill4]")
stat("[usr.misname5]:","[usr.misskill5]")
stat("[usr.misname6]:","[usr.misskill6]")
stat("[usr.misname7]:","[usr.misskill7]")
stat("[usr.misname8]:","[usr.misskill8]")
stat("[usr.misname9]:","[usr.misskill9]")

statpanel("Inventory")
stat(src.contents)



if usr.combats = 1
usr.strength += 5
usr.defense += 5
usr.medarm += 5
usr.heavyarm += 5
usr.longblade += 5
usr.axe += 5

if usr.magics = 1
usr.bluntweapon += 5
usr.alchemy += 5
usr.unarmored += 5
usr.enchanting += 5
usr.magic += 5
usr.intelligence += 5

if usr.stealths = 1
usr.agility += 5
usr.shortblade += 5
usr.lightarm += 5
usr.speed += 5
usr.defense += 5
In stead of
if usr.magics = 1

Try doing this
if(magics)

And if you want it false(also known as ==0)
if(!magics)

I learned these not to long ago and as for your problems I don't have time to look at them,mabe someone else could help.
In response to CodingSkillz2
yes lol too bad I figured out before you said XD I changed if usr.magics = 1 to if(usr.magics = 1)
In response to CodingSkillz2
Also I studied the problem a lil bit and I cut the part with the error on the stats out and then compiled and then same error came up in a diff place in the stats -.-.I tried different stats with less stats in a new environment and the statpanel("Skills") worked.
In response to XxDragonFlarexX
I think, it should be...


if(usr.magic == 1)


not

if(usr.magic = 1)



This could be your problem.
In response to Dalga Productions
nah its working and its magics :P
In response to XxDragonFlarexX
ok I do not need anymore help I found out on my own...for the stat panel problem there was a stat in the stat("Stats") above the ("Skills") part.The prob was it was like this(arrow at the problem)

stat("Damage:","[usr.damage]"<--

I forgot to add the ) XD lmfao...and the other part when it was if usr.magics = 1 it should have been if(usr.magics = 1),thanks anyways if you tried to help.
In response to Dalga Productions
if(magics)

Works just the same.
In response to CodingSkillz2
This Works also and what I usually used when I was more of a newbie.


if(usr.magics == 1)



Better form is...


if(magics)


Works the same, with less coding.
In response to Dalga Productions
That's the same thing I wrote....
In response to Dalga Productions
These are technically different... let's say you have a variable that is equal to null. Null, (in c++, so I'm making an assumption it's the same in DM) is a pointer to a memory location. if(!variable) would run if variable was null, while if(variable==0) would not. In my opinion, if(variable) should only be used on boolean values. If the values are going to be anything but 0 or 1, I don't do it.

Plus, I found out that (in 223 it used to do this) if(!players.Find(bleh,1,0)) wouldn't execute right. It would check if players was null... I'm kind of finicky of using ambiguous if-statements.
In response to Ter13
Ter13 wrote:
These are technically different... let's say you have a variable that is equal to null. Null, (in c++, so I'm making an assumption it's the same in DM) is a pointer to a memory location. if(!variable) would run if variable was null, while if(variable==0) would not. In my opinion, if(variable) should only be used on boolean values. If the values are going to be anything but 0 or 1, I don't do it.

In DM, "if(!variable)" evaluates true if the variable is null, 0, or "". Null is not 0 nor "", but if used in a mathmatical formula or string function, it is evaluated as 0 or "" as appropriate in the context. (i.e. null + 1 = 1, while "cheese " + null = "cheese ")


Plus, I found out that (in 223 it used to do this) if(!players.Find(bleh,1,0)) wouldn't execute right. It would check if players was null...

If players is null, then using one of its procs in this fashion should produce a runtime error. A list with 0 members is not null. I'm not sure what the problem was at the time, but I've never seen Find() work incorrectly.


I'm kind of finicky of using ambiguous if-statements.

There's nothing ambiguous about it, if you keep in mind the simple rule that null, 0, and "" are all evaluated false in DM. The only time it would be preferable to use "if(variable == 0)" rather than "if(!variable)" is when there is some distinction between those values.

For instance, if you return null from a mathmatical proc, it could indicate failure whereas 0 could be a valid result of the math involved. (Personally, in this case I would return a descriptive string identifying the error and check for failure by using istext() on the return value.)