User Tools

Site Tools


scripting:scriptedosd

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
scripting:scriptedosd [2020/03/13 02:58] – [Scripted OSD Overview] mitscripting:scriptedosd [2023/02/28 07:02] (current) mit
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.
  
 <code> <code>
Line 18: Line 18:
  
    osdcreate(OSDLIST,"Main","Hello World"    osdcreate(OSDLIST,"Main","Hello World"
-   osdadditem(TEXT, "", "How would you like to respond")  +   osdaddauto(TEXT, "", "How would you like to respond")  
-   osdadditem(BUTTON, "Option1", "Positively")  +   osdaddauto(BUTTON, "Option1", "Positively")  
-   osdadditem(BUTTON, "Option2", "Negatively"+   osdaddauto(BUTTON, "Option2", "Negatively"
    osdactivate()     osdactivate() 
  
Line 38: Line 38:
 The second parameter of the OSDCreate function 'names' your OSD screen, and is important when dealing with the OSDSELECT response The second parameter of the OSDCreate function 'names' your OSD screen, and is important when dealing with the OSDSELECT response
 </note>  </note> 
-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''.+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 ''OSDNAME:OSDBUTTONNAME''.
  
-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.
 <code>    <code>   
    osdcreate(OSDLOWER,"Main","Big Button"    osdcreate(OSDLOWER,"Main","Big Button"
-   osdaddat(BUTTON, 200, 0, 200, 100, "But1", "Press me!"+   osdadd(BUTTON, 200, 0, 200, 100, "But1", "Press me!"
    osdactivate()     osdactivate() 
 </code> </code>
Line 56: Line 56:
    $buttonH = 30    $buttonH = 30
    osdcreate(OSDLOWER,"Main","Big Button"    osdcreate(OSDLOWER,"Main","Big Button"
-   osdaddat(BUTTON, $buttonX, $buttonY, $buttonW, $buttonH, "But1", "Press me!"+   osdadd(BUTTON, $buttonX, $buttonY, $buttonW, $buttonH, "But1", "Press me!"
    $buttonY += $buttonH + 10    $buttonY += $buttonH + 10
-   osdaddat(BUTTON, $buttonX, $buttonY, $buttonW, $buttonH, "But2", "No press me!"+   osdadd(BUTTON, $buttonX, $buttonY, $buttonW, $buttonH, "But2", "No press me!"
    $buttonY += $buttonH + 10    $buttonY += $buttonH + 10
    osdactivate()     osdactivate() 
Line 77: Line 77:
  
     $itemNum = sysGetItemNum( $itemName )     $itemNum = sysGetItemNum( $itemName )
-    osdaddat(BUTTON, 70, $lineY, 150, 22, "selectItem|$itemNum", "$itemName")  +    osdadd(BUTTON, 70, $lineY, 150, 22, "selectItem|$itemNum", "$itemName")  
-    osdaddat(BIGTEXT, 255, $lineY, 80, 0, "", "$stocks "+    osdadd(BIGTEXT, 255, $lineY, 80, 0, "", "$stocks "
     if ( $sellPrice > 0 )     if ( $sellPrice > 0 )
     {     {
  $priceText = sysGetPriceText( $sellPrice )  $priceText = sysGetPriceText( $sellPrice )
- osdaddat(BIGTEXT, 390, $lineY, 100, 0, "", "$priceText"+ osdadd(BIGTEXT, 390, $lineY, 100, 0, "", "$priceText"
     }     }
     else     else
     {     {
- osdaddat(FADEDTEXT, 400, $lineY, 0, 0, "", "Not selling") + osdadd(FADEDTEXT, 400, $lineY, 0, 0, "", "Not selling")
     }     }
     $lineY += 25     $lineY += 25
scripting/scriptedosd.1584086327.txt.gz · Last modified: 2020/03/13 02:58 by mit

Except where otherwise noted, content on this wiki is licensed under the following license: Public Domain
Public Domain Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki