My System
Players learn skills. When a new skill is learnt, a new obj is created in their contents and attached to that object is the verb for the skill.
These objs are visible when going into a certain window. In this window players may drag and drop the obj around it as they wish (using a series of grids, one per skill).
Players may also drop these skill cards into a hotbar on the side of the main window. There are 13 slots.
I've already set it up so that clicking on the obj when in one of these 13 slots executes the relevant verb.
My problem
I also wish to have a verb (or 13 verbs) that will dynamically execut the skills for each of the 13 slots(grids).
So, for example, if I have nothing in slot1, and I use the verb for slot1, nothing happens.
BUT, if I drag and drop the PUNCH skill into slot1, and then use the verb for slot1 - I punch.
Seems a simple enough concept to me, but I can't figure out an appropriate way to code it.
If I could somehow save /mob/verb/Punch() to a var such as HotbarCommands[slotnumberhere]
I thought about doing this with the call() proc, but I will also need to be able to save a verb such as /mob/verb/Spell(mob/m in oview())
Alternatively, if it is possible to find an obj in usr.contents with a specific variable and execute a verb that is defined within it?
mob/verb/HB_Slot2()
for(var/obj/o in usr.contents)
if(o.InHotbarSlot=="2")
o.Execute() //execute being a generic verb for all such objs that in turn executes each one's specific attack?
I don't know if the methods I suggested are even possible. And even if they are, I'm clueless as to which one would be best, if any.
Any help will be much appreciated.
EDIT:
After a few attempts and intense confusion I've kinda concluded I need 13 different verbs, one for each slot. And to dynamically allocate a verb to be executed to each one.
You could probably just store the proc/verb path (/mob/verb/Punch) in a variable function and use call(src, o.function)().