ID:2265065
 
(See the best response by Ter13.)
So I'm trying to learn how to use the interface buttons, and so far I haven't come across any guides or help threads that fully illustrate how to use them.

How do I tie the execution of a chunk of code to a button click on the interface? If I was using C# it would involve OnClick ( stuff ), but I have no clue how byond does it. If somebody could provide an example of code that is executed when a button is clicked, or can link me to a guide that explains that, it would be fantastic.

Thanks in advance.
Clicking buttons executes a "command" on the client. This can be a "client-side command" (see the Skin Reference), such as .winset, or it can be a "verb" (see the Guide, I guess?) defined in your code that is accessible to the client. You can set this command in the skin editor and change it at runtime with winset.
Best response
Interface buttons have a command property that you can use to tie in commands.



The command you type into that box will be called on the client of the person pressing the box whenever it is clicked.

All commands are implemented as verbs in BYOND.

client //or mob
verb
doSomething()
set instant = 1 //read about command queue below
set hidden = 1 //read about verb panels below
world << "Button was pressed!"


Command queue

In BYOND, the user can only use one non-instant verb per frame. All subsequent non-instant verbs will be queued up behind the current one.

Setting a verb instant will make it not take into account any queued verbs. They will send instantly.


Verb panels

Verbs will by default show up as clickable commands in the info panel. Hidden verbs will not show up in the info panel.


Arguments

You can also pass arguments to verbs:

Command: doSomething "text" 1 14 "more text"

corresponds to:

client
verb
doSomething(arg1 as text, arg2 as num, arg3 as num, arg4 as text)


That way you don't need a unique verb for every single interface button. You can use arguments to differentiate commands.


Client-side

You can also trigger client-side commands without involving the server. For instance, .winset, or .output, or .quit will all allow you to tell the client to do things instantly without even having to be connected to a server, or without the server being aware of the control being clicked.
Ah, thank you very much to both of you.