This is an old revision of the document!
Scripted OSD Overview
The ScriptedOSD system allows you to write scripts on your server that can bring up a window on the client, displaying images, text, buttons etc, which the player is able to interact with.
For details of all the OSD commands and parameters available see the Reference section
ScriptedOSD Example
Here is an example script that activates a dialog on the client.
<codedoc> Event( “Custom”, “HelloWorld” ) {
osdcreate(OSDLIST,"Main","Hello World") osdadditem(TEXT, "", "How would you like to respond") osdadditem(BUTTON, "Option1", "Positively") osdadditem(BUTTON, "Option2", "Negatively") osdactivate()
}
Event( “OSDSelect”, “Main:Option1” ) {
- notify %PLAYER% You responded positively
}
Event( “OSDSelect”, “Main:Option2” ) {
- notify %PLAYER% You responded negatively
}
</codedoc>
The first block - which is run when a custom event called 'HelloWorld' is run (for instance by entering *event {YourName} HelloWorld
) - lays out the initial menu of the OSD, a bit of text with two buttons.
Each 'osdadditem' line adds a line to the display. TEXT is used to put some text on the screen, then BUTTON to add a couple of buttons. The second two blocks handle the response when the player selects one of the buttons. The second parameter of the event is formatted OSDNAME:OSDBUTTONNAME
.
If you want to control the layout of your OSD more directly, you use osdaddat rather than osdadditem, providing X,Y, width and height for each item. e.g. <codedoc>
osdcreate(OSDLOWER,"Main","Big Button") osdaddat(BUTTON, 200, 0, 200, 100, "Press", "Press me!") osdactivate()
</codedoc>