ID:151580
 
Will this work with what I'm trying to do and is it the easiest/best way? What I want to do is have objs like skills in my iventory. When I click on them it asks me what key I want to macro them to. Then when I macro it that verb is used when I hit the corresponding key.

mob/var/lastclicked = null
mob
skillcards
Click()


switch(input("Select a key to set this macro to", "Macro", text) in list ("1","2","Nevermind"))
if("1")
// macroinput = 1
winset(src,"macro1","parent=macro;name=1;command=[lastclicked]")
if("2")
// macroinput = 2
winset(src,"macro1","parent=macro;name=2;command=[lastclicked]")
obj
Bed
icon = 'Bed.dmi'
icon_state = "A"
Click()
lastclicked = /mob/verb/Test1
verb
Test1()
usr << "Test"


Edit: Kaiocho I really don't understand that. It yells at me that I have an undefined var and Im not so sure how to set up a variable to run a verrb 0_0. Ill give it a go I guess.
The command parameter of a macro would like the verb in typed command form, not a verb path. Just try setting lastclicked to "Test1".
In response to Kaiochao
hmm this seems to not be working either way, im getting an unused label error on bed. I guess I don't really get how this works? I want to have say, an item in my iventory. When I click that item I am asked what key I want to macro the item's set verb to.

/var/lastclicked = null

obj
skillcards
Click()


switch(input("Select a key to set this macro to", "Macro", text) in list ("1","2","Nevermind"))
if("1")
// macroinput = 1
winset(usr,"macro1","parent=macro;name=1;command=[lastclicked]")
if("2")
// macroinput = 2
winset(usr,"macro1","parent=macro;name=2;command=[lastclicked]")

Bed
icon = 'bed.dmi'
icon_state = "emptybed"
lastclicked = "Test1"
verb
Test1()
usr << "Test"
In response to Darkjohn66
Check your indentation, you have the obj/Bed within the Click() proc and it's thinking you are trying to use this for a goto label.
In response to Ulterior Motives
What I am trying to do is have any skillcard object be asked if you want to select a macro. At the same time for the object I select I want to have another click event in it that changes the variable for the specific object that I click

hmm im going to try this
/var/lastclicked = null

obj
skillcards
Click(/obj/skillcards/)


switch(input("Select a key to set this macro to", "Macro", text) in list ("1","2","Nevermind"))
if("1")
// macroinput = 1
winset(usr,"macro1","parent=macro;name=1;command=[lastclicked]")
if("2")
// macroinput = 2
winset(usr,"macro1","parent=macro;name=2;command=[lastclicked]")


Bed
icon = 'bed.dmi'
icon_state = "emptybed"
Click(/obj/skillcards/Bed/)
lastclicked = "Test1"
verb
Test1()
usr << "Test"


crap nothing happens...

hmm maybe this? I decided maybe I should read about procs before I start using them instead of going off of guide memory...

/var/lastclicked = null

obj
skillcards
Click(skillcards)


switch(input("Select a key to set this macro to", "Macro", text) in list ("1","2","Nevermind"))
if("1")
// macroinput = 1
winset(usr,"macro1","parent=macro;name=1;command=[lastclicked]")
if("2")
// macroinput = 2
winset(usr,"macro1","parent=macro;name=2;command=[lastclicked]")


Bed
icon = 'bed.dmi'
icon_state = "emptybed"
Click(Bed)
lastclicked = "Test1"
verb
Test1()
usr << "Test"
In response to Darkjohn66
mob/player/var/last_clicked
obj/skillcard/Click()
//So we can actually use our variables, procedures, etc.
var/mob/player/p=usr
p.last_clicked=src
//other stuff
In response to Ulterior Motives
p.lastclicked is an undefined type

Edit: Ok thanks U.M., that should help a lot!
In response to Darkjohn66
Oops try var/mob/player/p=usr
In response to Ulterior Motives
Im probably epic failing at this but if I cant figure it out by 5 hours from now i'll ask for help

mob/player/var/last_clicked


obj
skillcards

Click()
var/mob/player/p=usr
p.last_clicked=src
usr << "you clicked skillcard"
switch(input("Select a key to set this macro to", "Macro", text) in list ("1","2","Nevermind"))
if("1")
// macroinput = 1
winset(usr,"macro1","parent=macro;name=1;command=[p]")
if("2")
// macroinput = 2
winset(usr,"macro1","parent=macro;name=2;command=[p]")


Bed
icon = 'bed.dmi'
icon_state = "emptybed"
Click()
src = "Test1"
usr << "you clicked Bed"
verb
Test1()
usr << "Test"
In response to Darkjohn66
Okay, I see what you want.

mob/player/var/last_clicked
obj/card/var/command
obj/card/Click()
var/mob/player/p=usr
p.last_clicked=src.command
//other stuff
obj/card/black_card/command="blackness"
obj/card/black_card/verb/blackness()
var/mob/player/p=usr
set src in p
del(p)
In response to Ulterior Motives
set src in p

Mainz.dm:379:error: p: unsupported src setting

Tried cliking both of those in game with bug line commented out. Nothing happens, and:
Undefined variable /mob/var/last_clicked.
proc name: Click (/obj/card/Click)
source file: Mainz.dm,374
usr: Darkjohn66 (/mob)
src: the black card (/obj/card/black_card)
call stack:
the black card (/obj/card/black_card): Click(the turf (6,13,2) (/turf), "default.map1", "icon-x=15;icon-y=15;left=1;scr...")
Undefined variable /mob/var/last_clicked.
proc name: Click (/obj/card/Click)
source file: Mainz.dm,374
usr: Darkjohn66 (/mob)
src: the card (/obj/card)
call stack:
the card (/obj/card): Click(B1 (6,15,2) (/turf/Hospital/B1), "default.map1", "icon-x=13;icon-y=15;left=1;scr...")

I think it would be easier if I worked off of the code that I understand, I really would just like to figure out how to have an entire click event in a set of objects, and then a variable would be changed for the particular object you clicked on.
In response to Darkjohn66
May I please have some more help with this.
In response to Darkjohn66
You are a /mob, not a /mob/player. Obviously, /mobs do not have variables defined under /mob/player.
In response to Garthor
Could you please give me an idea of how to fix it, fix it, or link me to some kind of tutorial/demo that I should base my system off of.
In response to Darkjohn66
You will either need to change your mob's type to /mob/player (or rather, change your mob to one of type /mob/player, as type is read-only), or you will need to move the variable from /mob/player to /mob.
In response to Garthor
mob/var/last_clicked
obj/card/var/command
obj/card/Click()
var/mob/p=usr
p.last_clicked=src.command
//other stuff
obj/card/black_card/command="blackness"
obj/card/
icon = 'blackness.dmi'
obj/card/black_card/verb/blackness()
var/mob/p=usr
set p in src
del(p)


Mainz.dm:399:error: p: undefined var
Mainz.dm:399:error: in: expected src on left-hand side

rpg.dmb - 2 errors, 0 warnings (double-click on an error to jump to it)




Am I an idiot or is it tough to take the next step past reading tutorials and guides... because I messed up again.
In response to Darkjohn66
set src in p
In response to Ulterior Motives
I got an error with that, too. Im having big issues with this:

mob/var/last_clicked
obj/card/var/command
obj/card/Click()
var/mob/p=usr
p.last_clicked=src.command
//other stuff
obj/card/black_card/command="blackness"
obj/card/
icon = 'blackness.dmi'
obj/card/black_card/verb/blackness()
var/mob/p=usr
set src in p
del(p)


Mainz.dm:383:error: p: unsupported src setting
In response to Darkjohn66
Hmm, I figured you could do that I guess not. Use usr instead of p.
obj/card/black_card/verb/blackness()
set src in usr
del(usr)
In response to Ulterior Motives
ok ill test this out
Page: 1 2