User Tools

Site Tools


4rpl:commands:showgamemessage

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
4rpl:commands:showgamemessage [2021/02/08 20:19] Regallion4rpl:commands:showgamemessage [2025/02/14 14:57] (current) – external edit 127.0.0.1
Line 1: Line 1:
 ~~NOTOC~~ ~~NOTOC~~
 <=[[4rpl:start| Index]] <=[[4rpl:start| Index]]
 +
 +<WRAP tabs>
 +  * [[4rpl:commands:setgamemessagetext|Set]]
 +  * [[4rpl:commands:showgamemessage|Show]]
 +  * [[4rpl:commands:closegamemessage|Close]]
 +  * [[4rpl:commands:isgamemessageshowing|Test]]
 +</WRAP>
  
 ====== ShowGameMessage ====== ====== ShowGameMessage ======
Line 6: Line 13:
  
 ===== Description ===== ===== Description =====
-Shows a game message by message key. A game message is a popup message that appears at the top of the screen.\\ +Shows a game message by message key. A game message is a popup message that appears at the top of the screen. 
-'messageID' is the ADA message ID to show. Create a message using the ADA message editor, and reference it via it's ID.\\ + 
-The 'button0Textand 'button1Text' are used to show one or two buttons. If you don't want button(s), set them to "". Otherwise buttons will be shown and the specified text will be on the buttons.\\ +  ? messageID  
-Set 'pauseGame' to true to auto pause the game.\\ +  : the ADA message ID to show. Create a message using the [[cw4:custom_maps#ada_message_editor|ADA message editor]], and reference it via it's ID. 
-The 'messageChannel' is the name of the message channel to broadcast on when a button is pressed. +  ? button0Text 
-If a button is shown, a message will be sent when the button is pressed. A variable named '_DATA' will contain either a 0 or 1 to indicate which button was pressed.\\ +  :  and  
-In order to allow the player to close the message, a script must be registered for the message channel specified using [[4rpl:commands:registerformsg|RegisterforMsg]] and contain a [[4rpl:commands:closegamemessage|CloseGameMessage]] instruction in the callback function, with the parameter set to "True" The scripts need not be the same script.\\ +  ? button1Text 
-If a message is already showing, then calling this function will do nothing. If you want to replace the message, you must first call CloseGameMessage if there is already a message showing.\\ +  :  show one or two buttons. If you don't want button(s), set them to "". Otherwise buttons will be shown and the specified text will be on the buttons. 
-You can use "\\n" to create a line break in the button text.+  ? pauseGame  
 +  : true  to auto pause the game. 
 +  ? messageChannel  
 +  : the name of the message channel to broadcast on when a button is pressed. 
 +   
 +If a button is shown, a message will be sent when the button is pressed. A variable named '_DATA' will contain either a 0 or 1 to indicate which button was pressed. 
 +   
 +In order to allow the player to close the message, a script must be registered for the message channel specified using [[4rpl:commands:registerformsg|RegisterforMsg]] and contain a [[4rpl:commands:closegamemessage|CloseGameMessage]] instruction in the callback function, with the parameter set to "True" The callback function need not be the same script as the script making the call. 
 + 
 +If a message is already showing, then calling this function will do nothing. If you want to replace the message, you must first call [[CloseGameMessage]] if there is already a message showing. 
 +   
 +**Note:** You can use "\n" to create a line break in the button text.
  
 ===== Examples ===== ===== Examples =====
Line 20: Line 38:
 ShowGameMessage("MyMessage" "Yes" "No" true "GameMessageCallback") ShowGameMessage("MyMessage" "Yes" "No" true "GameMessageCallback")
  
-:GameMessageCallback+:Once 
 +RegisterForMsg("GameMessageCallback" "GameMessageCallbackFunction"
 + 
 +:GameMessageCallbackFunction
    <-_DATA ->result    <-_DATA ->result
    if (<-result eq0)    if (<-result eq0)
Line 27: Line 48:
       print("Button 1 Pressed")       print("Button 1 Pressed")
    endif    endif
 +   CloseGameMessage(true)
 </code> </code>
 +
 +=== See also ===
 +
 +  *[[cw4:a.d.a_syntax_syntax_guide|A.D.A. Syntax Guide]]
 +  
 <=[[4rpl:start| Index]] <=[[4rpl:start| Index]]
  
4rpl/commands/showgamemessage.1612815543.txt.gz · Last modified: 2025/02/14 14:56 (external edit)