ID:174230
 
OK, I am new to this and might be going about it all wrong, but here is what I am trying to do.

I am creating a board game. The different pieces are defined as objs (should they be mobs?). A given tile (or turf) on the board may contain a number of these objects.

What I want to be able to do is have the user click on a section of the map. If there are no objects there it will simply return the name of the turf. If there are objects there they should be able to move the top most object while leaving the other ones in place...until clicked on again.

Make sense at all? :)

A section of my code as I have it now;

client/Click(O)
if (contents.src.len)
usr << "You clicked [O]."
else
usr << "Move [O]."
..()

The indentation may not be 100% right, but it is in the code. The code the way it sits returns the error

fantasy.dm:95:error:contents.src.len:undefined var

Maybe I am going about it all wrong anyway.

I realize the code as shown will not do half of what I want it to, but if I could get a nudge in the right direction (get at least this much to work) I might be able to figure out the rest myself :)

As I am a new user of DM...I am sure I will have a host of other questions as time goes on :)

Thanks in advance,

Mark
yeah, abit of a indentation problem there o.o;

client/Click(O as obj)
if (O in contents.src.len)
usr << "You clicked [O]."
else
usr << "Move [O]."
..()


Im not really sure to go from there because i didn't really understand what you wanted to do...
In response to K'ros Trikare
K'ros Trikare wrote:
yeah, abit of a indentation problem there o.o;

> 
> client/Click(O as obj)
> if (O in contents.src.len)
> usr << "You clicked [O]."
> else
> usr << "Move [O]."
> ..()
>
>

Im not really sure to go from there because i didn't really understand what you wanted to do...

Actually, aside from the indentation, contents.src.len is backwards. It SHOULD be: src.contents.len.
And, really...he should be using, if(src.contents.find(O))
In response to K'ros Trikare
OK, but it is still giving me the error

fantasy.dm:94:error:contents.src.len:undefined var

If the variable has to be defined (which I can understand) how would I define it?

Thanks for the help,

Mark
In response to Goku72
OK, after playing with the code on and off all day, the problems seems to be in the syntax (it tells me src is not defined.

So, here is my entire code so far...can someone please tell me what I am doing wrong?

#include <deadron/players>
world
name = "FANTASY"
view = 9
turf
floor
name = "grass"
icon = 'floor.dmi'
river
icon = 'river.dmi'
density = 1
tree
name = "forest"
icon = 'tree.dmi'
mountain
icon = 'mountain.dmi'
density = 1
citadel
icon = 'citadel.dmi'
darktemple
name = "Dark Forces Fortress"
icon = 'temple dark.dmi'
goodtemple
name = "Free People Fortress"
icon = 'temple good.dmi'
wall
name = "fortified wall"
icon = 'fortwall.dmi'
vpath
name = "path"
icon = 'pathv.dmi'
hpath
name = "path"
icon = 'pathh.dmi'
start
icon = 'start.dmi'
name = "grass"
opengate
name = "open gate"
icon = 'gate.dmi'
gate
name = "closed gate"
icon = 'gateclosed.dmi'
city
icon = 'city.dmi'
obj/OrcSoldier
icon = 'orcsoldier.dmi'
name = "Orc Soldiers"
obj/OrcArcher
icon = 'orcarcher.dmi'
name = "Orc Archers"
obj/OrcCalvary
icon = 'orccalv.dmi'
name = "Orc Calvary"
obj/warg
icon = 'warg.dmi'
name = "Wargs"
obj/GoblinSoldier
icon = 'gobsoldier.dmi'
name = "Goblin Soldiers"
obj/GoblinArcher
icon = 'gobarch.dmi'
name = "Goblin Archers"
obj/MaldurSlave
icon = 'malslave.dmi'
name = "Maldur Slaves"
obj/ElfSoldier
icon = 'elfsoldier.dmi'
name = "Elf Soldiers"
obj/ElfArcher
icon = 'elfarch.dmi'
name = "Elf Archers"
obj/MenSoldiers
icon = 'mensoldier.dmi'
name = "Men Soldiers"
obj/MenArchers
icon = 'menarch.dmi'
name = "Men Archers"
obj/MenCalvary
icon = 'mencalv.dmi'
name = "Men Calvary"
obj/DwarfSoldiers
icon = 'dwarfsold.dmi'
name = "Dwarf Soldiers"
mob
Login()
loc = locate(/turf/start)
var/moves
verb
say (msg as text)
world << "[usr] says, [msg]."
proc
base_PlayerMobs()
New()
spawn(5)
src << browse("<html><body>Test</body></ test>")
client/Click(O as obj)
if (src.contents.find(O))
usr << "[O]."
else
usr << "Move [O]."
..()



Thanks for the help so far and hopefully all the future help :)

Mark