ID:165068
 
using these two snippets
obj
MouseDrag(src_location) step_to(src,src_location,0)
var
color

and
mob

var
color
Login()
switch(input("What color would you like to be today?","*******")in list("White","Black","Gold","Silver"))
if("White")
usr.color = "white"
if("Black")
usr.color = "black"
if ("Gold")
usr.color = "gold"
if ("Silver")
usr.color = "silver"
world << "[usr] is [color]"


i need to make it so you can't move another persons units. i tried using
if(usr.color!=color)
return

but it says i cant put a proc inside another proc. i put that under the MouseDrag. does anyone know where else i should put itt o make it work the way i want, or another piece of code to make this work.
Your indentation is probably off.

Also, not put usr in proc (except the mouse ones). Ugh.
In response to Kaioken
As long as he doesen't call Login() manually usr is fine in Login(), but its better to be safe then sorry.
In response to Xx Dark Wizard xX
niether of those helped me. i dont know where an indentation error would be i tried it evry which way i can think of and still nothing
In response to Dmingmage
The indentation is off because you didnt write this yourself.
In response to Xx Dark Wizard xX
what do you mean i didnt write it myself? yes i did...and an indentation problem will not casue a proc inside another proc error.
In response to Dmingmage
Sorry, when you said snippet I thought you took it from a demo, I'l look at it for you.
In response to Xx Dark Wizard xX
obj
MouseDrag(location)
step_to(usr,src,0)

usr is the mob and src is the obj.
In response to Xx Dark Wizard xX
Xx Dark Wizard xX wrote:
As long as he doesen't call Login() manually usr is fine in Login(), but its better to be safe then sorry.

Character saving also invalidates usr in Login(). It's all around better not to use it there, since src is always safe in that case.

Lummox JR
In response to Dmingmage
Dmingmage wrote:
what do you mean i didnt write it myself? yes i did...and an indentation problem will not casue a proc inside another proc error.

It most certainly can! Because the indentation is wrong, DM thinks you're trying to define a brand new proc instead of calling a statement like if(), hence the error.

To fix your indentation errors, hit Ctrl+T in Dream Maker to see all your tabs and spaces.

Lummox JR
In response to Xx Dark Wizard xX
sorry, by snippet i meant pieces of my code...and b. i can already move the objs around the board no problem. but i cannot make it so only your color pieces can be moved by you.
In response to Lummox JR
im sorry, thanx for the advice
In response to Dmingmage
mob
var
color
Login()
..()
src.color = input("Choose A color") in colorlist
world<<"[name] has logged in and is [src.color]"
var/list/colorlist = list("Red","Blue","Orange","Magenta","Purple","Pink")
In response to Dmingmage
Dmingmage wrote:
im sorry, thanx for the advice

Oh no problem at all. I just wanted to make you aware that you can't make assumptions about that kind of error.

Indentation errors fall under the category of syntax errors, which include things like forgetting a quote or a closing parenthesis, putting an operator in the wrong place, etc. Syntax errors have several important characteristics:

  • The error itself may not be obvious to the compiler. If not, the compiler will continue processing, thinking you meant something you really didn't. Think of it like a train that has hit a bad switch; the train will continue on the track you inadvertently sent it on, until it crashes. Thus you might see an error pop up lower down in the code.
  • Sometimes the compiler is aware of the error, but thinks it happened on the wrong line. In the case of missing quotes or parentheses, the actual error is usually on the line before.

    A syntax error means the compiler has gotten confused about what you mean, but it doesn't necessarily mean that it knows there's been a problem. If it does, it will display an error right away, but otherwise it will continue until it realizes you're not both on the same page. Occasionally, syntax errors can still allow you to compile, which produces unexpected behavior when you actually run the program.

    Lummox JR
In response to Xx Dark Wizard xX
i was kinda thinking it would be like this:

if(src.color == usr.color)
//have it continue
else
usr<<"That aint your peice." //or something like that


im only thinking that because you had defined color for a mob and a obj so i was thinking that was what you meant to do.