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.
Jul 2 2017, 4:37 pm
|
|
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.
|
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 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 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. |