ID:139100
 
Code:
Goto_Admin_House()
set category="Admin"
if(GMLockCheck())
usr<<"<font color=red>Your Admin Powers Are Locked."
return
usr << "<font color = white>You arrive at Admin house."
usr.loc = locate(345,325,7)


Problem description:
Admin Code.dm:322:error: : missing expression

Kaseem wrote:
Code:
//-snip-
if(GMLockCheck())
usr<<"<font color=red>Your Admin Powers Are Locked."
> return
> usr << "<font color = white>You arrive at Admin house."//Why is this line after a return? It will never get here.
> usr.loc = locate(345,325,7)//Why is this line indented more?
>

-snip-
In response to ShadowOfNight
can u just fix it please?
In response to Kaseem
return makes the proc end and return the specified value (null if there isn't one). Anything after the return line (if same indentation) will not take effect because the procedure has ended. Also, I am curious about your GMCheck() proc. Does it return a value? <s>If not, I am pretty sure either the check will always be true or always be false.</s> Reading the error, it seems my hunch was semi-right.

Your if(GMLockCheck()) is "missing an expression." You need to use if(GMLockCheck() == X) for it to work. You still should consider moving that indented expression.
In response to Kaseem
Kaseem wrote:
can u just fix it please?

If you could learn by me 'just fixing it', then I would fix it.
In response to Lugia319
How did you conclude your second paragraph? We appear to have no line-numbering to reference, and that code would be valid assuming GMLockCheck() is at least defined elsewhere.

It is certainly a possibility GMLockCheck() just doesn't exist in that context, or there is an issue with code preceeding this snippet.
In response to Stephen001
My gmlock is fine its the last line (usr.loc=) with the error and should i use else instead after the gm lock ?
In response to Kaseem
That line should be at the same indentation as the lines above it.
In response to Stephen001
O alright and should i use else instead of return ?
In response to Kaseem
You are missing an else statement after or in place of the return, yes.
In response to Stephen001
that does not fix the missing expression error in the usr.loc line
In response to Kaseem
I think i've found the bug
Goto_Admin_House()
set category="Admin"
if(GMLockCheck())
usr<<"<font color=red>Your Admin Powers Are Locked."
return //you could put the return,bellow usr.loc
usr << "<font color = white>You arrive at Admin house."
usr.loc = locate(345,325,7) //i wonder if this is the error,here has a extra tab.

I think that's why happened the missing expression bug,only tab it,if there's a condition like as if,for or anything else upper the code.

And Obs:.Ask for just fixing it,not will help so much,cuz the same mistake can happen,and you will see that the error happened before,but you not have know why.
So,ever ask why the error happened,to know what to do if it happens again.

I hope i helped.
In response to Kaseem
Goto_Admin_House()
set category="Admin"
if(GMLockCheck())
usr<<"<font color=red>Your Admin Powers Are Locked."
return
usr << "<font color = white>You arrive at Admin house."
usr.loc = locate(345,325,7)


What on earth??? This looks like your winging it :D

did you mean to say this?


Goto_Admin_House()
set category="Admin"
name= "Visit Admin"
//if(GMLockCheck) //instead of doing this, do it the other way(Opposite of gm lock)
if(!src.GM) //meaning if not a GM, or whatever your looking for.
usr<<"<font color=red>Your Admin Powers Are Locked."
else
usr << "<font color = white>You arrive at Admin house."
usr.loc = locate(345,325,7)


Remember! Indent correctly!

and refer to F1 if your unsure about something!