ID:2205384
 
(See the best response by Nadrew.)
like i want to be able to click on a item in my grid then click a button where it would set that item to the hotslot but i dont know how to make it so it can fetch a proc or verb just based on the items name without having to hand code every single verb/proc is there a way i can just call a verb or proc based off the objects set name in the grid?

Example: I click on jump kick skill in the grid then click the 1 button to assign it to that macro which when i press 1 would call that verb/proc based on the jump kick skills name

You'd simply need to set a variable to reference said object.
mob
var/list/hotbar = list("1","2","3")

verb/HotbarSpell()
var/obj/spell/selected = input("Which spell?")as null|anything in usr.spells
if(isnull(selected)) return
var/assignment = input("Which key?")as null|anything in hotbar
if(isnull(assignment)) return
hotbar[assignment] = selected


verb/HotbarExecute(pressed as num)
if(isnull(pressed)) return
pressed = num2text(pressed)
if(hotbar[pressed])
var/obj/spell/triggered = hotbar[pressed]
if(triggered)
triggered.Execute()


Now your hotkey macros would simply call "HotbarExecute 1", "HotbarExecute 2" and so forth.

Note; this was written off the top of my head and in no way will compile, it was purely to point you in the right direction. Good luck.
only problem is i have no idea how the execute feature works maybe you can explain how this code works? is the triggered spell suppose to be the selected one from before? im kinda lost
Like I said, it's an example, the triggered variable will be set to the spell object that's been assigned to the hot key in question. Execute() isn't something that's built in, again, example, that would be whatever proc/verb you're trying to call.
ya but i need to know how do i call a verb from what item i pick from the list like i need it so when i pick say kick i then execute the hotkey and it calls the kick verb or is able to call a verb based on the listed items name or something how do i do that
Best response
You shouldn't be using mob verbs for skills, you should be using verbs attached to objects like my example displayed, otherwise you're going to end up with a long of spaghetti code that spirals out of control very rapidly. I recommend re-reading the DM Guide if you don't understand these basic concepts.