Also, a new feature to the scripting is interactive On Screen Dialogs (OSD)
follows is an example of a working OSD:
Code: Select all
#include "SmokeACigar.mit"
Event( "UseItem", "Cigars" )
{
CustomEvent( "SmokeACigar" )
}
#include tells the script to parse the specified scripts with the server script. This is a new feature in the scripts. With this you can have a specific sub-script you can just plug into the main script file (previously, all the script code needed to be in the main serverscript file). the extention of these sub-script files can be anything you like.
CustomEvent is a function that kicks an event, called "custom", with the identifier tag of "SmokeACigar" (in this case. Change this according to your needs)
and the sub-script SmokeACigar.mit:
Code: Select all
Event( "Custom", "SmokeACigar" )
{
*soundeffect 18
osdcreate(OSDLIST,"Main","You just smoked a cigar")
osdadditem(OSDTEXT, "", "Do you feel good?")
osdadditem(OSDBUTTON, "Option1", "It made me feel good")
osdadditem(OSDBUTTON, "Option2", "No. Bleh! I hate cigars!")
osdactivate()
}
Event( "OSDSelect", "Main:Option1" )
{
osdcreate(OSDLIST,"Congrats","You feel good?")
osdadditem(OSDBUTTON, "Option1", "Yay for the cigar smoker.")
osdactivate()
}
Event( "OSDSELECT", "Main:Option2" )
{
osdcreate (OSDLIST,"YOU SUCK!" )
osdadditem(OSDBUTTON, "Option1", "You suck anyway. Click here and get out mah face." )
osdactivate()
}
"main" is a label for the parser to identify menu, and the bit after that is a title for the menu.
each 'osdadditem' line adds a line to the menu for the player to click on to activate. You can name them whatever they want. Option1 and Option2 are just made for example.
OSDTEXT is to put some text above the buttons (or below, depending on where you lay it in the script)
When the player clicks option1 or option2, it kicks an event trigger. when the event trigger for Main:Option1 is set, the event is called, and you can make it do whatever you want that you could normally do in script.
I hope this explains whats gong on enough. If anyone has any questions post them here and maybe Mit can help with anything i may have missed.