ID:179199
 
Hi,

I have a verb (obj/tile/rotate_tile) which I'd like to setup a hot key for. How do I set one up, and what are my options (ie. only F1-F12, or anything on the keyboard)?

The verb is only available when a tile is in the player's contents (only 1 tile at a time, so no ambiguity issues), and only 1 player will have a tile at any given time. Thus, I need to be sure that the hot key can't be used to rotate another player's tile.

Thanks!
dramstud wrote:
I have a verb (obj/tile/rotate_tile) which I'd like to setup a hot key for. How do I set one up, and what are my options (ie. only F1-F12, or anything on the keyboard)?

You want to look up client scripts and macros in the reference. You can trap practically any key except ctrl, alt, and shift. This link will be helpful when you want to macro special keys: http://www.byond.com/docs/notes/macro.html
In response to Shadowdarke
Thanks for the info.

I'm having some trouble with macros now -- I keep getting "Instruction not allowed here" from the compiler. I thought I had the macro set up as done in the byone reference. Any suggestions?


macro
F1 return "rotate_tile"

Shadowdarke wrote:
dramstud wrote:
I have a verb (obj/tile/rotate_tile) which I'd like to setup a hot key for. How do I set one up, and what are my options (ie. only F1-F12, or anything on the keyboard)?

You want to look up client scripts and macros in the reference. You can trap practically any key except ctrl, alt, and shift. This link will be helpful when you want to macro special keys: http://www.byond.com/docs/notes/macro.html
In response to Dramstud
Make sure its in a script file, and not a code file.

-AbyssDragon
In response to AbyssDragon
thanks. I've got a script file now, so I get the macro past the compiler. However, I get the following run-time error when I try to use it:

Unrecognized or inaccessible verb: rotate_tile

Do I need some additional code in the script file to make the verb properly attach to the tile object?

In response to Dramstud
I believe you have to set the macro to the name (the one you set with set name = "Blah") of the verb, and spaces need to be turned into hyphens (or "dashes").

Here's an example verb:
verb
Blah()
set name = "Cheese monkey"
// etc.


And here's the macro for it:
macro
z return "Cheese-monkey"

I'm pretty sure that's how it's done.
In response to Cinnom
ok, it works now (after using 'set name').

Thanks!
In response to Shadowdarke
Shadowdarke wrote:
dramstud wrote:
I have a verb (obj/tile/rotate_tile) which I'd like to setup a hot key for. How do I set one up, and what are my options (ie. only F1-F12, or anything on the keyboard)?

You want to look up client scripts and macros in the reference. You can trap practically any key except ctrl, alt, and shift. This link will be helpful when you want to macro special keys: http://www.byond.com/docs/notes/macro.html

Is it possible to set up a macro for the right or middle mouse buttons? If so, how?
In response to Dramstud
dramstud wrote:
Is it possible to set up a macro for the right or middle mouse buttons? If so, how?

Not wiht the current BYOND software, though there are third party programs that let you slave keystrokes to mouse buttons.