| Next revision | Previous revision | ||
|
hpl2:tutorials:scripting:messages_jenniferorange [2012/01/29 02:39] jenniferorange created |
hpl2:tutorials:scripting:messages_jenniferorange [2012/01/29 02:43] (current) jenniferorange [Creating Messages] |
||
|---|---|---|---|
| Line 11: | Line 11: | ||
| - | First things first: open your extra_english.lang. Inside, if the category named Messages is not present, you'll need to add it. | + | First things first: open your extra_english.lang. Inside, if the category named Messages is not present, you'll need to add it. |
| Line 20: | Line 20: | ||
| </CATEGORY> | </CATEGORY> | ||
| <CATEGORY Name="Inventory"> | <CATEGORY Name="Inventory"> | ||
| - | + | ||
| + | |||
| </CATEGORY> | </CATEGORY> | ||
| - | <font 9pt:normal/Courier;;#CC0033;;inherit><CATEGORY Name="Messages"> <Entry Name="Popup1">YOURMESSAGEHERE</Entry> </CATEGORY></font> | + | <CATEGORY Name="Messages"> |
| + | <Entry Name="Popup1">YOURMESSAGEHERE</Entry> | ||
| + | </CATEGORY> | ||
| <CATEGORY Name="Descriptions"> | <CATEGORY Name="Descriptions"> | ||
| - | + | ||
| + | |||
| </CATEGORY> | </CATEGORY> | ||
| <CATEGORY Name="Levels"> | <CATEGORY Name="Levels"> | ||
| - | + | ||
| + | |||
| </CATEGORY> | </CATEGORY> | ||
| </LANGUAGE> | </LANGUAGE> | ||
| Line 36: | Line 38: | ||
| - | The category that needs to be added has been highlighted in pink. I named the message Popup1, but you can name it whatever you'd like. [KEEP THIS NAME IN MIND AS YOU CONTINUE!] This is also an example of a standard, blank language file. | + | I named the message Popup1, but you can name it whatever you'd like. [KEEP THIS NAME IN MIND AS YOU CONTINUE!] This is also an example of a standard, blank language file. |
| - | Once that's been added, open up your map and place your script areas. Re-name them things like **Message_1 ** since that's their sole purpose. Don't forget to hit ENTER! | + | Once that's been added, open up your map and place your script areas. Re-name them things like **Message_1 ** since that's their sole purpose. Don't forget to hit ENTER! |
| Line 45: | Line 47: | ||
| - | <code actionscript> | + | <code actionscript>void OnStart() |
| - | void OnStart() | + | |
| { | { | ||
| AddEntityCollideCallback("Player", "Message_1", "Message1", true, 1); | AddEntityCollideCallback("Player", "Message_1", "Message1", true, 1); | ||
| } | } | ||
| - | + | ||
| + | |||
| void Message1(string &in asChild, string &in asParent, int alState) | void Message1(string &in asChild, string &in asParent, int alState) | ||
| { | { | ||
| SetMessage("Messages", "Popup1", 0); //This stands for ("Name of category", "Name of entry", time to be displayed on the screen);. | SetMessage("Messages", "Popup1", 0); //This stands for ("Name of category", "Name of entry", time to be displayed on the screen);. | ||
| } | } | ||
| - | + | ||
| + | |||
| void OnEnter() | void OnEnter() | ||
| { | { | ||
| } | } | ||
| - | + | ||
| + | |||
| void OnLeave() | void OnLeave() | ||
| { | { | ||
| } | } | ||
| </code> | </code> | ||
| + | |||
| + | |||
| We use the function SetMessage. The first parameter, "Messages", will always stay the same so long as you both shall live. The second parameter, "Popup1", is the name of the Entry I told you to keep in mind that we used earlier. It's subject to change. The last parameter is a value. It stands for how long the message is to be displayed. By using 0, it estimates on how long the message is and makes a decent pause so you can read it. However you can put your own values in. And that's it! Enjoy using as many messages as you want. | We use the function SetMessage. The first parameter, "Messages", will always stay the same so long as you both shall live. The second parameter, "Popup1", is the name of the Entry I told you to keep in mind that we used earlier. It's subject to change. The last parameter is a value. It stands for how long the message is to be displayed. By using 0, it estimates on how long the message is and makes a decent pause so you can read it. However you can put your own values in. And that's it! Enjoy using as many messages as you want. | ||