ID:146147
 
Code:
    Merry
icon = 'NPC.dmi'
icon_state = "Merry"
name = "Merry"
density = 1
verb
Pick_Your_Destiny()
set src in oview(1)
if(usr.warrior = 1)
usr << "<b>YOU HAVE ALREADY CHOSEN!! BEGONE!!</b>"
else
switch(input("I can teach you how to use weapons or how to cast magic, but sadly your small mind cant comprehend both so you must choose one, and when you choose you cant change your mind unless you start over new!", "Do you wanna be a Warrior or Mage?", text) in list ("Warrior","Mage"))
if("Warrior")
usr.str = 3
usr.hp = 30
usr.mhp = 30
usr.def = 2
usr.warrior = 1
if("Mage")
usr.hp = 15
usr.mhp = 15
usr.mmp = 30
usr.mp = 30
usr.mage = 1
usr.magic = 3


Problem description:Basicly i get the following errors and I dont know how to fix them, nothing i do seems to work.. please help

Rythilia.dm:598:warning: empty 'else' clause
Rythilia.dm:596:error::missing expression
Rythilia.dm:599:error::invalid expression
Rythilia.dm:600::warning: empty switch statement


Its your indentation, its wrong.
In response to Killerdragon
I changed my indentation now and I get these errors.. I tried to change indentation already and it would work

    verb
Pick_Your_Destiny()
set src in oview(1)
if(usr.warrior = 1)
usr << "<b>YOU HAVE ALREADY CHOSEN!! BEGONE!!</b>"
if(usr.mage = 1)
usr << "<b>Do you not know the power at your fingertips.. and you want to change.. BEGONE!!</b>"
else
switch(input("I can teach you how to use weapons or how to cast magic, but sadly your small mind cant comprehend both so you must choose one, and when you choose you cant change your mind unless you start over new!", "Do you wanna be a Warrior or Mage?", text) in list ("Warrior","Mage"))
if("Warrior")
usr.str = 3
usr.hp = 30
usr.mhp = 30
usr.def = 2
usr.warrior = 1
if("Mage")


Rythilia.dm:596:error:if :invalid proc definition
Rythilia.dm:597:error::invalid proc definition
Rythilia.dm:599:error::invalid proc definition
Rythilia.dm:600:error:else :invalid proc definition
A couple of problems:

Like he, said its the indentation. Need to tab the statement switch over 1, and the ifs need to be tabbed over as well. needs to look like this:

                if(usr.warrior = 1)
usr << "<b>YOU HAVE ALREADY CHOSEN!! BEGONE!!</b>"
else
switch(input("I can teach ....", "Do you wanna be a Warrior or Mage?", text) in list ("Warrior","Mage"))
if("Warrior")
usr.str = 3
usr.hp = 30
usr.mhp = 30
usr.def = 2
usr.warrior = 1
if("Mage")
usr.hp = 15
usr.mhp = 15
usr.mmp = 30
usr.mp = 30
usr.mage = 1
usr.magic = 3
In response to zackla21
okay zackla I indented the way you said and i still get these errors

Rythilia.dm:596:error:if :invalid proc definition
Rythilia.dm:597:error::invalid proc definition
Rythilia.dm:599:error::invalid proc definition
Rythilia.dm:600:error:else :invalid proc definition
the if is for the if(warrior = 1) statement the else is the else part and the errors inbetween are for the usr << messages for the if warrior and if mage statements.. this sucks lol :P
In response to Ehlert
did u use spaces or actually tab it? for the sake of entering it in the form here, I used spaces, but you could still be using an invalid number of spaces when you should have used tabs, etc etc....You need to work on understanding how to use the commands and their indendation. the ifs under the switch need to be one tab past switch. This is some basic programming stuff, and while asking for help here is ok, don't just copy the code 100%, realize the changes we used. For instance, the only difference in your code is that I indented the ifs under switch, then indent it how you indent other parts of the code. So tab it in.

-Lute
In response to Lutelian
lol im not and im tabbing.. to make sure theres no spaces i even went to each part and hit delete till the code was at the edge then tabbed to its spot.. but still the damn errors lol I never copy off here.. I just type it my self or space what needs to be spaced..

            Pick_Your_Destiny()
set src in oview(1)
if(usr.warrior = 1)
usr << "<b>YOU HAVE ALREADY CHOSEN!! BEGONE!!</b>"
if(usr.mage = 1)
usr << "<b>Do you not know the power at your fingertips.. and you want to change.. BEGONE!!</b>"
else
switch(input("I can teach you how to use weapons or how to cast magic, but sadly your small mind cant comprehend both so you must choose one, and when you choose you cant change your mind unless you start over new!", "Do you wanna be a Warrior or Mage?", text) in list ("Warrior","Mage"))
if("Warrior")
usr.str = 3
usr.hp = 30
usr.mhp = 30
usr.def = 2
usr.warrior = 1
if("Mage")
usr.hp = 15
usr.mhp = 15
usr.mmp = 30
usr.mp = 30
usr.mage = 1
usr.magic = 3
this is what I got here, and is what i got for errors in the post i posted before this
In response to Ehlert
ok, repost the code exactly as you have it and ill look at it again

-Lute
In response to Ehlert
I edited my before post with it.. and the stupid thing made the Choose your blah blah line indented wrong but I have itin the same positioning as the If under it
In response to Ehlert
mob
verb
Pick_Your_Destiny()
set src in oview(1)
if(usr.warrior)
usr << "<b>YOU HAVE ALREADY CHOSEN!! BEGONE!!</b>"
return
if(usr.mage)
usr << "<b>Do you not know the power at your fingertips.. and you want to change.. BEGONE!!</b>"
return
else
switch(input("I can teach you how to use weapons or how to cast magic, but sadly your small mind cant comprehend both so you must choose one, and when you choose you cant change your mind unless you start over new!", "Do you wanna be a Warrior or Mage?", text) in list ("Warrior","Mage"))
if("Warrior")
usr.str = 3
usr.hp = 30
usr.mhp = 30
usr.def = 2
usr.warrior = 1
if("Mage")
usr.hp = 15
usr.mhp = 15
usr.mmp = 30
usr.mp = 30
usr.mage = 1
usr.magic = 3


I really recommend you get a better grasp of the language before trying to make a game. If you look at the resources box on the left, it's a great place to start.
In response to Ben G
Ive been at this coding since about friday or so.. Im trying to do the best and as much as i can before school starts in less than 2 weeks, cause after that I wont have time with football and all that, also that was just a snippet of my code ben the whole thing is in the object/NPC section of my game this is the NPC its with... plus I have mage and warrior =1 afterwards of what you choose that way if you try to rechange it wont let you.


    Merry
icon = 'NPC.dmi'
icon_state = "Merry"
name = "Merry"
density = 1
verb
Pick_Your_Destiny()
set src in oview(1)
if(usr.warrior = 1)
usr << "<b>YOU HAVE ALREADY CHOSEN!! BEGONE!!</b>"
if(usr.mage = 1)
usr << "<b>Do you not know the power at your fingertips.. and you want to change.. BEGONE!!</b>"
else
switch(input("I can teach you how to use weapons or how to cast magic, but sadly your small mind cant comprehend both so you must choose one, and when you choose you cant change your mind unless you start over new!", "Do you wanna be a Warrior or Mage?", text) in list ("Warrior","Mage"))
if("Warrior")
usr.str = 3
usr.hp = 30
usr.mhp = 30
usr.def = 2
usr.warrior = 1
if("Mage")
usr.hp = 15
usr.mhp = 15
usr.mmp = 30
usr.mp = 30
usr.mage = 1
usr.magic = 3
In response to Ehlert
try this: I fixed your indents....again, if the form converts it all to spaces you will need to retab. Also note you need to make = into a == for the if statement

        Pick_Your_Destiny()
set src in oview(1)
if(usr.warrior == 1)
usr << "<b>YOU HAVE ALREADY CHOSEN!! BEGONE!!</b>"
if(usr.mage == 1)
usr << "<b>Do you not know the power at your fingertips.. and you want to change.. BEGONE!!</b>"
else
switch(input("I can teach you how to use weapons or how to cast magic, but sadly your small mind cant comprehend both so you must choose one, and when you choose you cant change your mind unless you start over new!", "Do you wanna be a Warrior or Mage?", text) in list ("Warrior","Mage"))
if("Warrior")
usr.str = 3
usr.hp = 30
usr.mhp = 30
usr.def = 2
usr.warrior = 1
if("Mage")
usr.hp = 15
usr.mhp = 15
usr.mmp = 30
usr.mp = 30
usr.mage = 1
usr.magic = 3
In response to Lutelian
Oh yeah, and your ifs are messed up, need to use if, else if, otherwise it could still let you repick even if you already picked warrior

Lutelian wrote:
try this: I fixed your indents....again, if the form converts it all to spaces you will need to retab. Also note you need to make = into a == for the if statement

>       Pick_Your_Destiny()
> set src in oview(1)
> if(usr.warrior == 1)
> usr << "<b>YOU HAVE ALREADY CHOSEN!! BEGONE!!</b>"
> else if(usr.mage == 1)
> usr << "<b>Do you not know the power at your fingertips.. and you want to change.. BEGONE!!</b>"
> else
> switch(input("I can teach you how to use weapons or how to cast magic, but sadly your small mind cant comprehend both so you must choose one, and when you choose you cant change your mind unless you start over new!", "Do you wanna be a Warrior or Mage?", text) in list ("Warrior","Mage"))
> if("Warrior")
> usr.str = 3
> usr.hp = 30
> usr.mhp = 30
> usr.def = 2
> usr.warrior = 1
> if("Mage")
> usr.hp = 15
> usr.mhp = 15
> usr.mmp = 30
> usr.mp = 30
> usr.mage = 1
> usr.magic = 3
>
In response to Lutelian
Lutelian wrote:
Oh yeah, and your ifs are messed up, need to use if, else if, otherwise it could still let you repick even if you already picked warrior

No, it wouldn't. You see how the code is not indented under the mage statement? That means that it's not executed if that statement is true. What he needs is a return after the warrior statement. It's great that you're trying to help, but I really think you should attempt to get a better grasp of the langauge first. And please, when posting on this forum, use correct spelling and grammar - it goes a long way.
In response to Ben G
Lol okay I will.. but its 10:20 p.m. here and I just got done with Football practice awhile ago so im dead tired..
In response to Ben G
I think its cute that you are correcting me. I am quite experienced, and I think you need to stop trying to help ppl and then insult others who KNOW what they are doing. When warrior is picked without the if, else if, it will say "BEGONE" and then check for mage, it wont see mage, and then it will let you pick again. the if, else if, checks for warrior, if it is, it wont execute the other pieces of the code (mage check, etc etc). a return works.....but its not as good as an if, else if. using

if (whatever)
code
return
if (whateverelse)
code
return
if (whateverelse2)
code
return

is very poor coding, using

if (whatever)
code
else if (whateverelse)
code
else if (whateverelse2)
code
else
code

is a much more professional and more efficient way of doing it.

jump off your invisible pedestal and wake up to reality Ben


-Lute
In response to Lutelian
Lol okay, okay let's not get a fight starting here.. well I am really tired so I guess I will go to bed.. maybe thats a reason why I didnt do that right for indenting cause I was too tired.. lol but doubt it.. like I said I only been at this since Friday. And Im trying to code on my own if you couldn't guess already. lol It's better than having all these people use dbz rips and all that, or like Esktrem's "Runescape" which is basicly comprived of Demo's lol.
In response to Ehlert
I am not sure if this problem was resolved for you, but I decided I would just let you know anyway...
The error 'Missing expression' refers to the operator in an if() proc. You had if(warrior = 1), this was returning an error because it should have been if(warrior==1). Also note that you can double click the errors at the bottom of the screen to see which line it is talking about quickly.

Also a quick note, you dont even need to type if(warrior==1), you can just do if(warrior).