ID:160760
 
Hello folks,

I'm having a problem with how I am assigning a macro to a hud.
I made a drag'n'drop inventory-to-hud thanks to Scizzees.
But, our crew also wants the objects that are on the hub can be called by using a macro.

How would I be doing that?
I myself, have no idea whatsoever.

Also, how could I make it so that you don't need to drag your objects everytime you logon, but that it saves also when you save your char, and when you load that they're on the right position (I've been trying this, but hadn't have any success)?

Thanks for your time,

Rick (Sokkiejjj)
You could very easily accomplish both with a variable that tells you what's in a specific HUD slot. Set the var on MouseDrag, save it in the savefile, and make a corresponding procedure to be called with a macro.
Sokkiejjj wrote:
I made a drag'n'drop inventory-to-hud thanks to Scizzees.
But, our crew also wants the objects that are on the hub can be called by using a macro.

You can't "call" an object, so I assume you mean you want a macro to be able to perform the same action as clicking a certain hud object.

This is dependent on exactly how you have implemented your hud. However, I think they're usually similar, so something like this should work:
/mob/verb/use_object1() //Object1 corresponds to an object in a specific slot in the mob's inventory
set name=".use1"
set hidden=1
if(src.object1)src.object1.use()

/obj/screen //A HUD object
object1_button //A button on the HUD that uses an object in the mob's inventory for them
Click()
usr.use_object1()
return ..()

Then, set the macro in your skin file to call the '.use1' verb.


Also, how could I make it so that you don't need to drag your objects everytime you logon, but that it saves also when you save your char, and when you load that they're on the right position (I've been trying this, but hadn't have any success)?

Just save a list of the screen_loc vars of each hud object to the player's savefile and load it back up when they log into the server.
You (and players) can actually set macros to automatically click objects by using the ".click" and ".dblclick" internal commands. The atom name goes after a space, like so: .click Kaioken .click grass. It should be noted that those commands can also often be abused by players in games that use click elements.