ID:140990
 
Code:
mob/var
attacks=1
magics=0
items=0
obj
hand
icon = 'hand.dmi'
icon_state = "blank"
layer = 100
New(client/c)
icon_state ="MenuR"
screen_loc="3,2"
c.screen+=src


mob/proc
updateCommand()
if(src.attacks==1)
for(var/obj/hand/o in src.client.screen)
o.screen_loc="3,2"
if(src.magics==1)
for(var/obj/hand/o in src.client.screen)
o.screen_loc="3,1"
if(src.items==1)
for(var/obj/hand/o in src.client.screen)
o.screen_loc="3,0"
spawn(10)
src.updateCommand()
mob/verb
scrolldown()
if(usr.attacks==1)
usr.attacks= 0
usr.magics= 1
usr.updateCommand()
if(usr.magics==1)
usr.magics= 0
usr.items= 1
usr.updateCommand()
if(usr.items==1)
usr.items= 0
usr.attacks= 1
usr.updateCommand()


Problem description:Instead of moving up and down the command menu, it's just disappearing. Someone told me i'd have to make the obj hand destroy itself and respawn in a new place? i dunno. If you know how to do that could you supply me the the code?
also if there is another way to fix it could you also inform me? thank you.
=DD



Could you elaborate more of what your trying to do and all.

By what im thinking your trying to do an on-screen menu, when you mouse-over, options fly out, and when you move mouse to an option, the menu closes? if so, you need to refine the code that closes it, if it works by name of the control, change the name of the menu options to be 'hand' otherwise, if it works by type, make it use name instead..

By your code, I just don't understand it at all, it would be easier if you pointed to the part we need to look at, like if it's what I said, then point to the code that tells it to open, and that one that tells it to close.

If the scrolldown verb is ur problem then thats easy...

add the word return on each line so that it wont call the updatecommand() proc 3 times in a row, cause right now, it will update it for 3 times...

also,if it still errors, see if adding return lines on the proc as well would help any...im definitely not sure however, but I know for sure right now that it wont work without returns on at least the mobs verb...

put one on the line below updatecommand, on all the three lines it appears... indent it the same as the updatecommand line.
In response to Dan0971
the goal to set macros using S and W
theres already an On screen menu, pressing S moves the hand or the selection down and W moves it up (this is the scroll down)

I tryed to change the code a bit.

mob/var
attacks=1
magics=0
items=0
obj
hand
icon = 'hand.dmi'
icon_state = "blank"
layer = 100
New(client/c)
if(usr.attacks==1)
icon_state ="MenuR"
screen_loc="3,2"
c.screen+=src
if(usr.magics==1)
icon_state ="MenuR"
screen_loc="3,1"
c.screen+=src
if(usr.items==1)
icon_state ="MenuR"
screen_loc="3,0"
c.screen+=src

mob/proc
updateCommand()
for(var/obj/hand/o in src.client.screen)
del(o)
new/obj/hand(src.client)
spawn(5)
src.updateCommand()

mob/verb
scrolldown()
if(usr.attacks==1)
usr.attacks= 0
usr.magics= 1
if(usr.magics==1)
usr.magics= 0
usr.items= 1
if(usr.items==1)
usr.items= 0
usr.attacks= 1
usr.updateCommand()


Edit: Still it's not any better...
Why has this message come up twice...?

[link]