User Tools

Site Tools


4rpl:commands:sendmversemsg

This is an old revision of the document!


Index
MVerse

:!: Available in version 1.9 and later.

SendMVerseMsg

SendMVerseMsg(<-channel <-data)

Description

Similar to SendMsg, except the message is sent to other clients in an mverse session. Note that the message will NOT be sent to client doing the sending. It is only sent to other clients. The data can be any 4rpl data type, including a list or a table. Care should be taken to not call SendMVerseMsg more than necessary or with more data than necessary since the call sends a message across the network to all clients.

Examples

CreateTable ->table
"Larry" ->table{"name"}
42 ->table{"value"}
SendMVerseMsg("NetMessage" <-table)
# Many 4rpl custom unit actions are not automatically synced in mverse. 
# For stationary units a possible solution is to have the unit send an 
# mverse message so that the other player sessions can create a clone 
# of the unit.
 
# In the custom unit script:
:awake
self getunittype ->unitType
self getunitposition ->unitPos
self getunitsettings ->unitSettings
"MVMSG_CreateUnit" <-unitType <-unitPos <-unitSettings 3 listN sendmversemsg
 
# In a global script:
:once
RegisterForMsg("MVMSG_CreateUnit" "MVMSG_CreateUnit_Function")
 
:MVMSG_CreateUnit_Function
<-_DATA[0] <-_DATA[1] <-_DATA[2] createunit 0 SetMVerseCreatesUnitGhost

See RegisterForMsg

Index

4rpl/commands/sendmversemsg.1728221630.txt.gz · Last modified: 2024/10/06 09:33 by kalli