Difference between revisions of "SendClientMessage"

From Legends of Aria Admin and Modding Wiki
Jump to: navigation, search
(CATEGORY: Mobile Overhead Conflict Icons)
m (Protected "SendClientMessage" ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)))
 
(10 intermediate revisions by 2 users not shown)
Line 14: Line 14:
  
 
==  General Hint  ==
 
==  General Hint  ==
  Sending Client messages Right after start might fail  
+
  Sending Client messages Right after start might fail due to a race condition where the client is not yet fully ready.   
due to a race condition where the client is not yet  
+
  Delay your messages in initialization code to be safe !!! (Especially: RunSpeed and ChatChannel Updates)
fully ready.   
 
  Delay your messages in initialization code to be safe !!!
 
(Especially: RunSpeed and ChatChannel Updates)
 
  
 
==  Known Messages  ==
 
==  Known Messages  ==
Line 70: Line 67:
  
 
=== CATEGORY:  Casting ===
 
=== CATEGORY:  Casting ===
 +
  (Still waiting
  
 
   Message Name: "StartCasting"
 
   Message Name: "StartCasting"
 
   Example:      player:SendClientMessage("StartCasting", castTime)
 
   Example:      player:SendClientMessage("StartCasting", castTime)
   Description:  ???????????????????????????????????????????????????????????????????????????
+
   Description:  Gives you a targeting cursor for the given duration, with a clock like animation showing time running out.
 
   Message Data: <double>castTime
 
   Message Data: <double>castTime
 +
  Callback Event: None - this is just for visuals / eye candy
  
 
   Message Name: "CancelSpellCast"
 
   Message Name: "CancelSpellCast"
Line 197: Line 196:
 
   Message Data:  
 
   Message Data:  
  
 
 
 
   Message Name: "ClearGroup"
 
   Message Name: "ClearGroup"
 
   Example:      this:SendClientMessage("ClearGroup")
 
   Example:      this:SendClientMessage("ClearGroup")
Line 203: Line 201:
 
   Message Data:  
 
   Message Data:  
  
 
 
 
   Message Name: "RemoveGroupMember"
 
   Message Name: "RemoveGroupMember"
 
   Example:      this:SendClientMessage("RemoveGroupMember")
 
   Example:      this:SendClientMessage("RemoveGroupMember")
 
   Description:  Changes Healthbar Display on Group Members
 
   Description:  Changes Healthbar Display on Group Members
   Message Data:  
+
   Message Data:
 
 
  
 
=== CATEGORY:  OTHER ===
 
=== CATEGORY:  OTHER ===
  
 
 
 
   Message Name: "ConfigurePathfinding" - String in Client Code  
 
   Message Name: "ConfigurePathfinding" - String in Client Code  
 
   Example:      player:SendClientMessage("")
 
   Example:      player:SendClientMessage("")
 
   Description:   
 
   Description:   
 
   Message Data: <string>
 
   Message Data: <string>
 
 
       Setting                  = Meaning
 
       Setting                  = Meaning
 
       .....................................
 
       .....................................
Line 227: Line 221:
 
       "EnablePathToMobile"      = Allow  Pathfinding To Mobile Targets
 
       "EnablePathToMobile"      = Allow  Pathfinding To Mobile Targets
  
 
 
 
 
   Message Name: "OpenURL"
 
   Message Name: "OpenURL"
 
   Example:      player:SendClientMessage("OpenURL", "http://www.legendsofaria.com")
 
   Example:      player:SendClientMessage("OpenURL", "http://www.legendsofaria.com")
Line 234: Line 226:
 
   Message Data: <string>Url,  e.g.: "http://shardsonline.com"
 
   Message Data: <string>Url,  e.g.: "http://shardsonline.com"
  
 
 
 
   Message Name: "PlayerRunSpeeds"
 
   Message Name: "PlayerRunSpeeds"
 
   Example:      player:SendClientMessage("")
 
   Example:      player:SendClientMessage("")
 
   Description:  Updates the modifiers from the BaseMoveSpeed for walking and running
 
   Description:  Updates the modifiers from the BaseMoveSpeed for walking and running
   Message Data: <table>{<number>, <number>} = { walkSpeed, runSpeed}
+
   Message Data: < table >{<number>, <number>} = { walkSpeed, runSpeed}
           or:  <table>{<number>}          = { walkSpeed (is also runSpeed) }
+
           or:  < table >{<number>}          = { walkSpeed (is also runSpeed) }
  
 
 
 
   Message Name: "SetCustomServerAction"
 
   Message Name: "SetCustomServerAction"
 
   Example:      player:SendClientMessage("")
 
   Example:      player:SendClientMessage("")
 
   Description:  Set Custom Keybinds for ServerActions
 
   Description:  Set Custom Keybinds for ServerActions
   Message Data: { <string>id, <string>key, <string>eventId }
+
   Message Data: <string>"eventId,key,displayName"
   Allowed Ids:  "CustomAction1", ... "CustomAction5"  
+
  Callback event:  RegisterEventHandler(EventType.ClientUserCommand, "customAction1", function() print("Event Fired !")end )
 +
  Note (!!!): For some reason no one really understands, the eventId in the Callback event is written in lower camelCase,
 +
      like "customAction1", while the eventId in the message is written in Upper CamelCase, like "CustomAction1"
 +
   Allowed Ids(A):  "CustomAction1", ... "CustomAction5" (in the Message)
 +
  Allowed Ids(B):  "customAction1", ... "customAction5" (in the EventHandler)
 
   Allowed Key:  See Client Settings ( e.g.: "M", "F1", etc ..)
 
   Allowed Key:  See Client Settings ( e.g.: "M", "F1", etc ..)
  
 
 
 
   Message Name: "TimeUpdate"
 
   Message Name: "TimeUpdate"
 
   Example:      this:SendClientMessage("TimeUpdate", {GetCurrentTimeOfDay(), GetDaylightDurationSecs(), GetNighttimeDurationSecs()} )
 
   Example:      this:SendClientMessage("TimeUpdate", {GetCurrentTimeOfDay(), GetDaylightDurationSecs(), GetNighttimeDurationSecs()} )
Line 255: Line 248:
 
   Message Data: {<double>currentTimeSecs, <double>dayDurationSecs, <double>nightDurationSecs, <double>transitionSpeed (optional) }
 
   Message Data: {<double>currentTimeSecs, <double>dayDurationSecs, <double>nightDurationSecs, <double>transitionSpeed (optional) }
  
 
 
 
   Message Name: "UpdateMapMarkers"
 
   Message Name: "UpdateMapMarkers"
 
   Example:      player:SendClientMessage("UpdateMapMarkers", myLocations)
 
   Example:      player:SendClientMessage("UpdateMapMarkers", myLocations)
 
   Description:  Sets the player known locations for the current map / subregions.
 
   Description:  Sets the player known locations for the current map / subregions.
   Message Data: <table> {  
+
   Message Data: < table > {  
 
       { <string>Icon, <Loc>Location, <string>Tooltip, <bool>MapVisibility(true=visible marker), <number>Width, <number>Height},
 
       { <string>Icon, <Loc>Location, <string>Tooltip, <bool>MapVisibility(true=visible marker), <number>Width, <number>Height},
 
       { ... },  ... more marker records ...  }
 
       { ... },  ... more marker records ...  }
 
  
 
=== CATEGORY:  Deprecated / Disabled ===
 
=== CATEGORY:  Deprecated / Disabled ===
  
 
 
   Message Name: "SetRTSCameraPosition"
 
   Message Name: "SetRTSCameraPosition"
 
   Example:      player:SendClientMessage("SetRTSCameraPosition", Loc(0,0,0))
 
   Example:      player:SendClientMessage("SetRTSCameraPosition", Loc(0,0,0))
Line 272: Line 262:
 
   Message Data: <Loc>newPosition --> "God view camera has been disabled ..."
 
   Message Data: <Loc>newPosition --> "God view camera has been disabled ..."
  
 
 
 
   Message Name: "ShowDialog"
 
   Message Name: "ShowDialog"
 
   Example:      this:SendClientMessage("ShowDialog", {this, "WindowId", "Ma cool title", "My Description", "Button 1", "Button 2"})
 
   Example:      this:SendClientMessage("ShowDialog", {this, "WindowId", "Ma cool title", "My Description", "Button 1", "Button 2"})
 
   Description:  Deprecated and totally broken. Will most likely be removed.
 
   Description:  Deprecated and totally broken. Will most likely be removed.
 
   Message Data: {<GameObj>gameObj, <string>windowId, <string>windowTitle, <string>windowText, <string>buttontext1, <string>buttontext1,}
 
   Message Data: {<GameObj>gameObj, <string>windowId, <string>windowTitle, <string>windowText, <string>buttontext1, <string>buttontext1,}
 
  
 
   Message Name: "ClearPrimed"
 
   Message Name: "ClearPrimed"
Line 283: Line 271:
 
   Description:   
 
   Description:   
 
   Message Data: none
 
   Message Data: none
 
  
 
   Message Name: "SpellPrimed"
 
   Message Name: "SpellPrimed"

Latest revision as of 17:10, 16 October 2018

SendClientMessage

(Client 0.8.1) function: SendClientMessage(...)

 Description: Send a message directly to the attached user. 
     Refer to the client documentation for messages the client supports. 
     See Modder's Handbook for all Client Messages
 Params:
     (string) Message name
     (object) Message data
 Returns:
     (boolean) True if it works, false if not.


General Hint

Sending Client messages Right after start might fail due to a race condition where the client is not yet fully ready.  
Delay your messages in initialization code to be safe !!! (Especially: RunSpeed and ChatChannel Updates)

Known Messages

CATEGORY: Action Slots

 Message Name: "ActivateCooldown"
 Example:      player:SendClientMessage("ActivateCooldown", { "CombatAbility", "Secondary", cooldown.TotalSeconds } )
               Below: sets a cooldown of 15 seconds on all Custom Command Actions that do "dostring" 
               player:SendClientMessage("ActivateCooldown", {"CustomCommand", "dostring", 15})
 Description:  Activates a cooldown timer on an Action Slot.
               This is just a visual effect, which doesn't stop the action from executing.
               Checking that would be done on the server side  in Lua script.
 Message Data: { <string>actionType, <string>actionID, <number>cooldownDurationSecs}
 Message Name: "SetActionActivated"
 Example:      player:SendClientMessage("SetActionActivated", {"CombatAbility", "Primary", true}) -- makes the Primary Combat Ability flash
 Description:  Works only for the Action Frame Types: 
               "SquareFixed", "SquareFixedNoHotkey", "Diamond" and "DiamondSilver"
               Makes them flash with a white outline until deactivated
 Message Data: {<string>actionType, <string>actionID, <bool>isActivated}
 Message Name: "UpdateUserAction"
 Example:      player:SendClientMessage("UpdateUserAction", { Slot = <int>mySlot, ID=<string>actionId, ActionType=<string>myActionType } )
 Description:  Updates a slotted Action, thus only works on Hotbar Actions!
               An empty ID deletes the Action from the slot.
 Message Data: <Really Big Table If You Want>{ Field1 = Data1, Field2 = Data2, Field3 = Data3,  ...}
     ActionData Format: Not all is always mandatory - experiment and dig the code to learn. Must be documented later separately
     actionData = {
         Slot            = <int>,        -- Slot number (1-100, only up to 40 can get a hotkey.)
         ID              = <string>,     -- ID Depends on the Action Type.
         ActionType      = <string>,     -- Action Type: Command|CustomCommand|PetCommand|
                                                         CombatAbility|SkillAbility|Spell|
                                                         Crafted|CraftItem|EquipSlot|Resource|
         DisplayName     = <string>,     -- Text to be Displayed in the Tooltip as Name
         Tooltip         = <string>,     -- Additional ToolTip Info Text
         Icon            = <string>,     -- Image background
         IconText        = <string>,     -- Text to Display over the background image (Keep it small or it grows over the Button)
         IconObject      = <string>,     -- IconId for an Object icon to Display
         IconObjectColor = <string>,     -- Color Tag, like "FFFFFF" for White
         IconObjectHue   = <int>,        -- A Hue from the HueTable
         IconCount       = <uint>,       -- Number Overlay. Vanishes under certain circumstances, probably deprecated.
         Enabled         = <bool>,       -- Enabled versus Greyed out
         Locked          = <bool>,       -- Locked Symbol (Works on Diamond Frame Types - try it for the rest, I haven't tried yet)
         ServerCommand   = <string>,     -- Server Command to Execute on click. 
                                            This defines your event Handler. EventType.Message up to the first space.
         TargetObject    = <ulong>,      -- GameObject
         Requirements    = { req<string> = value<double>, ..., ...}
      }

CATEGORY: Casting

 (Still waiting 
 Message Name: "StartCasting"
 Example:      player:SendClientMessage("StartCasting", castTime)
 Description:  Gives you a targeting cursor for the given duration, with a clock like animation showing time running out.
 Message Data: <double>castTime
 Callback Event: None - this is just for visuals / eye candy
 Message Name: "CancelSpellCast"
 Example:      player:SendClientMessage("CancelSpellCast")
 Description:  Aborts a SpellCast Visually
 Message Data: none

CATEGORY: Player Chat

 Message Name: "EnterChat"
 Example:      player:SendClientMessage("EnterChat", "/say Hello World !")
 Description:  Enter the focus to the chatbox such, that the player can immediately type into it.
 Message Data: <string> InitialString InChatBox
 Message Name: "SetChatChannel"
 Example:      player:SendClientMessage("Global")
 Description:  Sets the chat channel selection for the player to the chosen channel.
 Message Data: <string>"Global" -- Note it requires the ":" inside the string (Will be fixed soonish)
 Message Name: "UpdateChatChannels"
 Example:      player:SendClientMessage("UpdateChatChannels", { {"Global", "global"}, {"Chat", "say"}, {"Broadcast", "broadcast"} } )
 Description:  Sends a list with chat channels names and associated commands to the player.
 Message Data: < table > { {<string>name, <string>command}, {...}, ... }

CATEGORY: Targeting and Combat

 Message Name: "ChangeTarget"
 Example:      player:SendClientMessage( "ChangeTarget", lastAttacker )
 Description:  Changes the combat target to the GameObject sent.
 Message Data: <GameObj>newTarget
 Message Name: "AllowMobileFrameDrags"
 Example:      this:SendClientMessage("AllowMobileFrameDrags", "false") 
 Description:  Enables or disables draggable health bars.
               Note it's a string, NOT a bool !
 Message Data: <string> "true" or "false"

CATEGORY: Object Manipulation / Transform

 Message Name: "EditObjectTransform"
 Example:      user:SendClientMessage("EditObjectTransform",{target, this, "seed_edit", true})
 Description:  Opens the transform widget to manipulate an object. 
 Message Data: < table >{ <double>targetId, <double>userId, <string>eventId, <bool>stayOpen }
 Callback event: Can be caught with an event Handler:
     RegisterEventHandler(EventType.ClientObjectCommand, "transform",
         function (userId, targetId, eventId, command, posX,posY,posZ,rotX,rotY,rotZ,scaleX,scaleY,scaleZ)
           if command=="confirm" then ... do stuff
 Message Name: "CancelObjectTransform"
 Example:      player:SendClientMessage("CancelObjectTransform")
 Description:  Cancels the open transform widget on the user.
 Message Data: none

CATEGORY: Skills

 Message Name: "SkillList"
 Example:      player:SendClientMessage("SkillList")
 Description:  Sets Skill Tracking Bars for special Window Widgets
 Message Data: < table >{ 
   { <string>SkillId, <string>DisplayName, <string>SkillType, <string>Description, <bool>DirectlyUsable },
   { ... },  ...more skill records...,
  }
 Message Name: "UpdateSkills"
 Example:      player:SendClientMessage("")
 Description:  Updates Skill Tracking Bars
 Message Data: {skillUpdate}

CATEGORY: Button Bar

 Message Name: "SetAchievementNotification"
 Example:      this:SendClientMessage("SetAchievementNotification", true) 
 Description:  Activates/Deactivates the achievement notification symbol on the ButtonBar.
 Message Data: <bool> IsActive
 
 Message Name: "ShowButtonBar"
 Example:      this:SendClientMessage("ShowButtonBar", false)
 Description:  Shows/Hides the Buttonbar from the Ui
 Message Data: <bool> DoShow

CATEGORY: Window Positions

 Message Name: "ClearCachedPanelPositions"
 Example:      this:SendClientMessage("ClearCachedPanelPositions")
 Description:  Resets all client cached window positions
 Message Data: none
 
 Message Name: "ClearCachedPanelPositionById"
 Example:      this:SendClientMessage("ClearCachedPanelPositionById", "MyCustomWindowId")
 Description:  Resets the client window position cache for the specified window
 Message Data: <String> WindowId

CATEGORY: Mobile Overhead Conflict Icons

 Message Name: "UpdateMobileConflictStatus"
 Example:      this:SendClientMessage("UpdateMobileConflictStatus", {GameObj(400163), "Aggressor", 15})
               {GameObj(400163), "Aggressor", 35} --> Shows a knife    Icon for 35 seconds
               {GameObj(400163), "Aggressed", 26} --> Shows a skull    Icon for 26 seconds
               {GameObj(400163), "Warning",   17} --> Shows a warnsign Icon for 17 seconds
 Description:  Displays an icon right of the mobiles name for the specified amount of time.
               Not any icon works. See the list above.
 Message Data: < table >{ <GameObj> targetObj, <string> "Aggressed"|"Aggressor"|"Warning", <number> timeleftSec }
 
 Message Name: "ClearMobileConflicts"
 Example:      this:SendClientMessage("ClearMobileConflicts")
 Description:  Clears all the conflict icons set with this:SendClientMessage("UpdateMobileConflictStatus", ...)
 Message Data: none

CATEGORY: Group Member Health bar Display

 Message Name: "AddGroupMembers"             clientMembers
 Example:      this:SendClientMessage("AddGroupMembers", {objId1, objId2, objId3, ...})
 Description:  Changes Healthbar Display on Group Members
 Message Data: 
 Message Name: "ClearGroup"
 Example:      this:SendClientMessage("ClearGroup")
 Description:  Changes Healthbar Display on Group Members
 Message Data: 
 Message Name: "RemoveGroupMember"
 Example:      this:SendClientMessage("RemoveGroupMember")
 Description:  Changes Healthbar Display on Group Members
 Message Data:

CATEGORY: OTHER

 Message Name: "ConfigurePathfinding" - String in Client Code 
 Example:      player:SendClientMessage("")
 Description:  
 Message Data: <string>
      Setting                   = Meaning
     .....................................
     "DisablePathfinding"       = Disallow Pathfinding
     "EnablePathfinding"        = Allow Pathfinding
     "ForcePathfindingEnabled"  = Forcefully Enable Pathfinding
     "ForcePathfindingDisabled" = No longer Force Enable Pathfinding
     "DisablePathToMobile"      = Disallow Pathfinding To Mobile Targets
     "EnablePathToMobile"       = Allow  Pathfinding To Mobile Targets
 Message Name: "OpenURL"
 Example:      player:SendClientMessage("OpenURL", "http://www.legendsofaria.com")
 Description:  Opens the Url in the set default  browser.
 Message Data: <string>Url,  e.g.: "http://shardsonline.com"
 Message Name: "PlayerRunSpeeds"
 Example:      player:SendClientMessage("")
 Description:  Updates the modifiers from the BaseMoveSpeed for walking and running
 Message Data: < table >{<number>, <number>} = { walkSpeed, runSpeed}
         or:   < table >{<number>}           = { walkSpeed (is also runSpeed) }
 Message Name: "SetCustomServerAction"
 Example:      player:SendClientMessage("")
 Description:  Set Custom Keybinds for ServerActions
 Message Data: <string>"eventId,key,displayName"
 Callback event:  RegisterEventHandler(EventType.ClientUserCommand, "customAction1", function() print("Event Fired !")end )
 Note (!!!): For some reason no one really understands, the eventId in the Callback event is written in lower camelCase, 
     like "customAction1", while the eventId in the message is written in Upper CamelCase, like "CustomAction1"
 Allowed Ids(A):  "CustomAction1", ... "CustomAction5" (in the Message)
 Allowed Ids(B):  "customAction1", ... "customAction5" (in the EventHandler)
 Allowed Key:  See Client Settings ( e.g.: "M", "F1", etc ..)
 Message Name: "TimeUpdate"
 Example:      this:SendClientMessage("TimeUpdate", {GetCurrentTimeOfDay(), GetDaylightDurationSecs(), GetNighttimeDurationSecs()} )
 Description:  Sends a Time Update. Check Lua Code to understand.
 Message Data: {<double>currentTimeSecs, <double>dayDurationSecs, <double>nightDurationSecs, <double>transitionSpeed (optional) }
 Message Name: "UpdateMapMarkers"
 Example:      player:SendClientMessage("UpdateMapMarkers", myLocations)
 Description:  Sets the player known locations for the current map / subregions.
 Message Data: < table > { 
     { <string>Icon, <Loc>Location, <string>Tooltip, <bool>MapVisibility(true=visible marker), <number>Width, <number>Height},
     { ... },   ... more marker records ...   }

CATEGORY: Deprecated / Disabled

 Message Name: "SetRTSCameraPosition"
 Example:      player:SendClientMessage("SetRTSCameraPosition", Loc(0,0,0))
 Description:  Currently disabled. Sets Camera position
 Message Data: <Loc>newPosition --> "God view camera has been disabled ..."
 Message Name: "ShowDialog"
 Example:      this:SendClientMessage("ShowDialog", {this, "WindowId", "Ma cool title", "My Description", "Button 1", "Button 2"})
 Description:  Deprecated and totally broken. Will most likely be removed.
 Message Data: {<GameObj>gameObj, <string>windowId, <string>windowTitle, <string>windowText, <string>buttontext1, <string>buttontext1,}
 Message Name: "ClearPrimed"
 Example:      this:SendClientMessage("ClearPrimed")
 Description:  
 Message Data: none
 Message Name: "SpellPrimed"
 Example:      this:SendClientMessage("SpellPrimed", spellData )
 Description:  
 Message Data: {<string>spellName,  <string>targetType, <double>spellRange}
               targetype("requestTarget", "targetLocation", "targetObject")