ID:266488
 
mob/Stat()
..()
statpanel("Players")
for(var/mob/M in world)
Click()
if(M.join == 1)
stat("[M.name]")
usr << "[M.gold] Gold - [M.hp]"
stat("Location: [M.town]")
else


How can if fix it because it says proc definition not allowed inside another proc?
It looks like it thinks you are defining Click() within Stat(). Perhaps you should move your if statement so that it lines up with Click() instead of indenting so far. (Of course, you'll have to bring your stat and usr lines left a bit too.)
In response to ACWraith
ACWraith wrote:
It looks like it thinks you are defining Click() within Stat(). Perhaps you should move your if statement so that it lines up with Click() instead of indenting so far. (Of course, you'll have to bring your stat and usr lines left a bit too.)


Like this?

mob/Stat()
..()
statpanel("Players")
for(var/mob/M in world)
if(M.join == 1)
Click()
stat("[M.name]")
usr << "[M.gold] Gold - [M.hp] Health"
stat("Location: [M.town]")
else
In response to Thief Jack
Moving where Click() is changes the logic. I was speaking more of a simple indentation fix so that the compiler would not think certain lines were part of the Click() definition.

Ex:

mob/Stat()
..()
statpanel("Players")
for(var/mob/M in world)
Click()
if(M.join == 1)
stat("[M.name]")
usr << "[M.gold] Gold - [M.hp] Health"
stat("Location: [M.town]")
else


Of course, if you really are trying to define the Click() proc, thats a different problem. :)
Thief jack wrote:
How can if fix it because it says proc definition not allowed inside another proc?

I must confess I have no idea what you're trying to do here. You are literally defining a proc inside another proc. The way you're using Click() there, and what purpose you have for it, is incomprehensible.

If what you're going for is clickable items inside the stat panel (which is the only thing I can figure), you've got Click() in entirely the wrong place. (And by indenting under it, the DM compiler thinks you're trying to define Click(), when it's still not done with Stat(). Thus the error.) If clicking an obj in the stat panel is what you want, that would be more like this:
mob
var/obj/clicky/theobj

Stat()
if(!theobj) theobj=new
statpanel("Test")
stat("This is clickable",theobj)

obj/clicky
name="Click me!"

Click()
usr << "You clicked me!"

Lummox JR
i've got a prob like that too!!
mob

Login()
usr.icon_state = input("What do you want to be?") in list ("Austin Powers","FBI")
usr.Move(locate(15,15,1))
if ("Austin Powers") set usr.icon ('Austin.dmi') set usr.icon_state ('normal')
if ("FBI") set usr.icon ('Alex.dmi') set usr.icon_state ('MIB')

same: proc definition not allowed inside another proc
In response to ShakerDeath
Please don't drag up old topics. You should have posted a new topic for this.

Gads, that code is a mess! Not only is your indentation completely screwed up, but half of that isn't even valid DM code - even if it was indented properly. (My comments are in bold.)

mob
Login()
usr.icon_state = input("What do you want to be?") in list ("Austin Powers","FBI") //First problem - you shouldn't be using usr in this case, you should be using src. The difference between them is a little more advanced than you're up to, so just accept it for now.
usr.Move(locate(15,15,1)) //This shouldn't be indented so far. Unindent it one tab.
if ("Austin Powers") set usr.icon ('Austin.dmi') set usr.icon_state ('normal') //What the hell? Since when was "set" a valid DM command? Anyway, this if() isn't set up correctly. "Austin Powers" is a text string, and will therefore always be true.
if ("FBI") set usr.icon ('Alex.dmi') set usr.icon_state ('MIB') //Ditto

I'm not even going to try and correct that code. Instead, I'm going to start from scratch.

mob
Login()
var/class=input(src,"What do you want to be?") in list("Austin Powers","FBI") //Ask the player (src) what they want to be, and save their answer in the <code>class</code> var.
switch(class) //This will make a decision based on what <code>class</code> is; and therefore, what the user chose to be.
if ("Austin Powers") //Because this is indented immediately underneath a switch(), it's really asking "is <code>class</code> equal to Austin Powers?" If it wasn't indented immediately underneath a switch(), it would be treated as a normal if() and wouldn't work properly.
src.icon='Austin.dmi'
src.icon_state="normal"
if ("FBI") //Same, but if class is equal to "FBI"
src.icon='Alex.dmi'
src/icon_state="MIB"

Hopefully that helps.