User Tools

Site Tools


4rpl:commands:sendmsg

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:sendmsg [2021/01/08 11:01] – external edit 127.0.0.14rpl:commands:sendmsg [2024/07/20 13:18] (current) – More explicate explanation of sending data. Vertu
Line 1: Line 1:
 ~~NOTOC~~ ~~NOTOC~~
-<=[[4rpl:start| Index]]+<=[[4rpl:start| Index]] \\ 
 +<= [[4rpl:start#Messaging]] 
  
 ====== SendMsg ====== ====== SendMsg ======
-SendMsg(<-channel <-data)+SendMsg(<-channel <-sentData)
  
 ===== Description ===== ===== Description =====
-Sends a message. A message can contain any 'data' type. Any script registered to receive messages on the specified 'channel' will receive the message. +Sends a message. A message can contain any 'data' type. Any script registered to receive messages on the specified 'channel' will receive the message and contain the sentData within the <-_DATA variable.\\ 
-See [[REGISTERFORMSG]] for information on the callbacks.+See [[RegisterForMSG]] for more information on the callbacks.\\ 
 +SendMSG is primarily intended for sending message between different scripts.  Prior to the 2.0 release of CW4, any call to SendMSG that ends up calling backing into the same script that SendMSG was called from, will produce errors in some cases.  This can happen,for instance, if you destroy some other unit from script A. Script B (on the destroyed unit) has a :Destroyed handler that calls SendMSG on a channel that script A listens on.  
  
 ===== Examples ===== ===== Examples =====
Line 14: Line 16:
  
 </code> </code>
 +
 +<code 4rpl>
 +#Connected to the example of RegisterForMsg
 +#If using this, must be put in a destroy-able unit
 +:Destroyed
 +SendMsg("test" "i died")
 +</code>
 +=== See also ===
 + 
 +  * [[RegisterForMSG]]
 <=[[4rpl:start| Index]] <=[[4rpl:start| Index]]
  
4rpl/commands/sendmsg.1610121708.txt.gz · Last modified: 2021/01/08 11:01 by 127.0.0.1