ID:145117
 
Code:
mob/Special/verb/Heal(M as mob in oview(1))
if(M:HP==M:Max_HP)
usr << "This player doesn't need to be healed..."
return
else
if(usr.level = 1)
M:HP += 5
usr.mp -= 5
if(usr.mp <= 0)
usr << "You don't have enough MP..."
return
if(usr.level = 3)
M:HP += 10
usr.mp -= 10
if(usr:mp <= 0)
usr << "You don't have enough MP..."
return


Problem description:
Ok, It says that there is a problem with: if(usr.level = 1) and, if(usr.level = 3). It says there's a missing expression. Would appreciate any help...
~Chris

Legonian1 wrote:
Code:
> mob/Special/verb/Heal(M as mob in oview(1))
> if(M:HP==M:Max_HP)
> usr << "This player doesn't need to be healed..."
> return
> else
> if(usr.level = 1)
> M:HP += 5
> usr.mp -= 5
> if(usr.mp <= 0)
> usr << "You don't have enough MP..."
> return
> if(usr.level = 3)
> M:HP += 10
> usr.mp -= 10
> if(usr:mp <= 0)
> usr << "You don't have enough MP..."
> return
>

Problem description:
Ok, It says that there is a problem with: if(usr.level = 1) and, if(usr.level = 3). It says there's a missing expression. Would appreciate any help...
~Chris


First off, using : is an ugly way to do things. just make it M.whatevervar.

Secondly, you are using the assignment operator (=) and not the equality test operator (==). In other words, it should read if(usr.lvl == 1).

§atans§pawn
In response to Satans Spawn
Before you say it using the . operator doesn't work, look at your argument. M wasn't really given any specific type, but you know that it's going to be a mob. It's better to do something like: mob/M in oview(1), as opposed to M as mob in oview(1)
In response to Audeuro
M as mob, that gives M the type of mob unless I am mistaken. At the very least it would treat M as being a mob, so it should work (I actually do not have time to test that right now, otherwise I would, but you might be correct. I will test that when I get home from work.)

§atans§pawn
In response to Satans Spawn
Satans Spawn wrote:
M as mob, that gives M the type of mob unless I am mistaken. At the very least it would treat M as being a mob, so it should work

No, the <code>as mob</code> part just tells the game that you only can select mobs. You need to define M as mob/M, otherwise it won't know what variables it may own.

~~> Unknown Person
In response to Unknown Person
Dun see what it matters.. I always use var/mob/M in oview(1) even though I see most people dont use the var/ I like it cuz its blue >_>'
In response to VcentG
Ok, I changed the coe to:

CODE:
mob/Class/verb/Heal(mob/M in oview(1))
if(M:HP==M:Max_HP)
usr << "This player doesn't need to be healed..."
return
else
if(usr.level == 1)
M:HP += 5
usr.mp -= 5
if(usr.mp <= 0)
usr << "You don't have enough MP..."
return
if(usr.level == 3)
M:HP += 10
usr.mp -= 10
if(usr:mp <= 0)
usr << "You don't have enough MP..."
return

Then When the USER logs in, if his race is a healer it's supposed to add the verb to his verb list...

mob //Part of the mob
Login() //On login, this person gets the GM verbs

if(usr.race == "Healer")
src.verbs += /mob/Class/verb/Heal

However, the verb is not added anywhere...
Help please... there are no reported errors.
In response to Legonian1
src.verbs.Add(typesof(/mob/Healer/verb))

Change thhe vars in order to fit your code
In response to Gooseheaded
You can use the += operator and it might be better here.

And to the one before the above post: Don't use the : operator. Once you define the variable correctly, the . operator works as it should.
In response to Audeuro
That still doesn't fix it...
In response to Legonian1
Another thing I noticed. You really shouldn't use usr in Login. src - or no specified object for that matter - is preferred. It's good practice.
In response to Audeuro
Audeuro wrote:
Another thing I noticed. You really shouldn't use usr in Login. src - or no specified object for that matter - is preferred. It's good practice.
It's not really a point.
src = putting nothing at all

I do still put src so I am not confused with world variables.
In response to Audeuro
Oh, that's just a fraction of my Login Coding. Altogether it's about 5 pages long. It handles all the classes,when you log in for the first time, Mod and GM Login, etc...

Ok, I got it to where that if an item is equppied it will add the verb, but I still can't get it to work for the race...
In response to Legonian1
Are you still checking "usr.race" or what? If so, I'd recommend (for like, the second time) that you prefer src over usr in this situation.
In response to Audeuro
I foudn the problem, When my character is created, it doesn't set the race for some reason... Check this for me please...
Login()//login
if(usr.banned ==1)
usr<<"<B>You have been banned"
del usr

else
var/charactername = input("Choose a name for your Character!","Character Name?",src.key)//message player is asked and gets to input characters name
var/characterage = input("How old is your Character?","Age?")
switch(input("Choose your class...Note, you can only choose this once...","Class?")in list("Healer","Mage","Ninja","Knight","Soldier","Thief"))
if("Healer")
character = new /mob/characters/Healer()
usr.race = "Healer"

Tell me why the user.race isn't set to "Healer"... It remains blank... I used the GMEdit command in my game to change the text to healer and the verb appeared next time I logged in...(Yes, there are some variablles not shown, to post them all would make this thing 10 pages long...)
In response to Legonian1
You might want to remove the usr abuse, as this is the third time anyone's pointed it out. I'd suggest looking up input in the reference to figure that out, then the other places you use usr in there. I'm going to link you to Lummox's Tutorial - usr Unfriendly in hopes that you'll now understand why you've been told over and over again to ditch the usr. I refuse to give any more advice until the usr abuse is gone and the code is tested with it gone.
In response to Audeuro
I understand your concern, but changing all the usr to src in the game would take a week in itself. As of this moment it is not a problem to me, however, when it becomes one, I'll change it. Not to be rude, as you have helped me tons...I think my problem is-
The code is currently:
(usr.race = "Healer")

when it should be
(usr.race == "Healer")


Again, you must remember, I haven't been coding for long...

EDIT: Nevermind, the above didn't work... Just please tell me how to fix it without changing every usr in my game to src... Please... I respesct your opinion as an older coder, but I'm set in my newbie ways...
In response to Legonian1
Tell me what to flippin' change to src... I have no idea what does and what doesn't...It ticks me off that people won't help a newbie because he isn't coding it just how they want it..

mob/create_character//a mob is a character
var/mob/character//the var, or difference is the character
Login()//login
if(usr.banned ==1)
usr<<"<B>You have been banned"
del usr

else
var/charactername = input("Choose a name for your Character!","Character Name?",src.key)//message player is asked and gets to input characters name
var/characterage = input("How old is your Character?","Age?")
switch(input("Choose your class...Note, you can only choose this once...","Class?")in list("Healer","Mage","Ninja","Knight","Soldier","Thief"))
if("Healer")
character = new /mob/characters/Healer()
usr.race = "Healer"


What else in my code needs changed?
In response to Legonian1
Now nobody will even tell me what to change from usr to src... I'm sorry that I'm stubborn... Please help me. The usr.race (or src.race) variable will not set when a character is created. If I could figure out how to set that variable I'd have it..

Current:
mob/create_character//a mob is a character
var/mob/character//the var, or difference is the character
Login()//login
if(usr.banned ==1)
usr<<"<B>You have been banned"
del usr

else
var/charactername = input("Choose a name for your Character!","Character Name?",src.key)//message player is asked and gets to input characters name
var/characterage = input("How old is your Character?","Age?")
switch(input("Choose your class...Note, you can only choose this once...","Class?")in list("Healer","Mage","Ninja","Knight","Soldier","Thief"))
if("Healer")
character = new /mob/characters/Healer()
usr.race = "Healer"

However, the usr.race variable stays empty instead of changing to usr.race = "Healer". Please help...
In response to Legonian1
mob/create_character//a mob is a character
var/mob/character//the var, or difference is the character
Login()//login
if(src.banned)
src<<"<B>You have been banned"
del src

else
var/charactername = input("Choose a name for your Character!","Character Name?",src.key)//message player is asked and gets to input characters name
var/characterage = input("How old is your Character?","Age?")
switch(input("Choose your class...Note, you can only choose this once...","Class?")in list("Healer","Mage","Ninja","Knight","Soldier","Thief"))
if("Healer")
character = new /mob/characters/Healer()
src.race = "Healer"
Page: 1 2