scripting:scriptedosd
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
scripting:scriptedosd [2020/03/08 15:32] – [Scripted OSD Overview] mit | scripting:scriptedosd [2023/02/28 07:02] (current) – mit | ||
---|---|---|---|
Line 2: | Line 2: | ||
The Scripted OSD 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. | The Scripted OSD 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. | ||
- | <note tip>One common use for ScriptedOSD is in conjunction with the ' | + | <note tip>One common use for ScriptedOSD is in conjunction with the ' |
</ | </ | ||
Line 12: | Line 12: | ||
===== ScriptedOSD Example ===== | ===== ScriptedOSD Example ===== | ||
- | Here is an example script that activates a dialog on the client. | + | Here is a basic example script that activates a dialog on the client. |
< | < | ||
Line 18: | Line 18: | ||
{ | { | ||
| | ||
- | osdadditem(TEXT, "", | + | osdaddauto(TEXT, "", |
- | osdadditem(BUTTON, " | + | osdaddauto(BUTTON, " |
- | osdadditem(BUTTON, " | + | osdaddauto(BUTTON, " |
| | ||
} | } | ||
Line 38: | Line 38: | ||
The second parameter of the OSDCreate function ' | The second parameter of the OSDCreate function ' | ||
</ | </ | ||
- | 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 '' | + | Each 'osdaddauto' 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 '' |
- | If you want to control the layout of your OSD more directly (you will if you want to make anything that looks remotely decent), you use **osdaddat** rather than osdadditem, providing X,Y, width and height for each item. | + | If you want to control the layout of your OSD more directly (you will if you want to make anything that looks remotely decent), you use **osdadd** rather than **osdaddauto**, providing X,Y, width and height for each item. |
e.g. | e.g. | ||
< | < | ||
| | ||
- | osdaddat(BUTTON, 200, 0, 200, 100, " | + | osdadd(BUTTON, 200, 0, 200, 100, " |
| | ||
</ | </ | ||
Line 56: | Line 56: | ||
| | ||
| | ||
- | osdaddat(BUTTON, $buttonX, $buttonY, $buttonW, $buttonH, " | + | osdadd(BUTTON, $buttonX, $buttonY, $buttonW, $buttonH, " |
| | ||
- | osdaddat(BUTTON, $buttonX, $buttonY, $buttonW, $buttonH, " | + | osdadd(BUTTON, $buttonX, $buttonY, $buttonW, $buttonH, " |
| | ||
| | ||
Line 77: | Line 77: | ||
$itemNum = sysGetItemNum( $itemName ) | $itemNum = sysGetItemNum( $itemName ) | ||
- | | + | |
- | | + | |
if ( $sellPrice > 0 ) | if ( $sellPrice > 0 ) | ||
{ | { | ||
$priceText = sysGetPriceText( $sellPrice ) | $priceText = sysGetPriceText( $sellPrice ) | ||
- | osdaddat(BIGTEXT, 390, $lineY, 100, 0, "", | + | osdadd(BIGTEXT, 390, $lineY, 100, 0, "", |
} | } | ||
else | else | ||
{ | { | ||
- | osdaddat(FADEDTEXT, 400, $lineY, 0, 0, "", | + | osdadd(FADEDTEXT, 400, $lineY, 0, 0, "", |
} | } | ||
$lineY += 25 | $lineY += 25 |
scripting/scriptedosd.1583699520.txt.gz · Last modified: 2020/03/08 15:32 by mit