ID:150447
 
Hi, Im kalzimere and am just starting to learn how to code. I made 2 codes that seem like they should work but don't. Im pretty sure it must be becausesoemthing im doing lol. I placed the two codes under a proc like below:

proc
DeathCheck()
if(health <= 0)
usr.loc = locate("death")
world << "[src] dies!"
Expcheck()
if(usr.exp >= usr.expneed)
usr.health += 2
usr.str += 1/3
usr.speed += 1/3
usr.def += 1/4
usr.expneed += 200
usr.level += 1
usr<<"You have gained a Level"

now i think it might be because i placed it under a proc. I wasn't sure if it was supose to be here but i thought maybe because of a tutorial i saw. I get a error like this:

loading MatrixRpg.dme
maincode.dm:68:if :warning: if statement has no effect
loading Matrix.dmp
saving MatrixRpg.dmb

MatrixRpg.dmb - 0 errors, 1 warning

I know its probably some dumb thing im doing but any help would deeply be apreciated.(Assume theres no identatiosn problems above if it shows up that way.)
-kalzimere

Kalzimere wrote:
Hi, Im kalzimere and am just starting to learn how to code. I made 2 codes that seem like they should work but don't. Im pretty sure it must be becausesoemthing im doing lol. I placed the two codes under a proc like below:

proc
DeathCheck()
if(health <= 0)
usr.loc = locate("death")
world << "[src] dies!"
Expcheck()
if(usr.exp >= usr.expneed)
usr.health += 2
usr.str += 1/3
usr.speed += 1/3
usr.def += 1/4
usr.expneed += 200
usr.level += 1
usr<<"You have gained a Level"

now i think it might be because i placed it under a proc. I wasn't sure if it was supose to be here but i thought maybe because of a tutorial i saw. I get a error like this:

loading MatrixRpg.dme
maincode.dm:68:if :warning: if statement has no effect
loading Matrix.dmp
saving MatrixRpg.dmb

MatrixRpg.dmb - 0 errors, 1 warning

I know its probably some dumb thing im doing but any help would deeply be apreciated.(Assume theres no identatiosn problems above if it shows up that way.)
-kalzimere


the imediate problem i see here is that your indentation is incorrect.

when you have an if statement, everything that is supposed to happen if that if statement is true should appear one tab under it, like so

apple
var
eaten = 0
verb
eat()
if(src.eaten == 0)
usr << "You eat the apple!"
src.eaten = 1
else
usr << "You already ate this apple!"
usr << "Hey, wait a minute!"
del(src)

as you can see, in my if statement, all the code is aligned under it, then we move onto our else statement, which all code is aligned one tab under it as well.

another general rule is that you NEVER copy and paste code from forums, because we use spaces, the tab key is unaviable on the web.

So please type the code, and make sure you use tab key instead of space bar for a indentions

--FIREking