Difference between revisions of "SendClientMessage"

From Legends of Aria Admin and Modding Wiki
Jump to: navigation, search
(CATEGORY: Action Slots)
(CATEGORY: Casting)
Line 71: Line 71:
 
=== CATEGORY:  Casting ===
 
=== CATEGORY:  Casting ===
  
 
 
 
   Message Name: "StartCasting"
 
   Message Name: "StartCasting"
 
   Example:      player:SendClientMessage("StartCasting", castTime)
 
   Example:      player:SendClientMessage("StartCasting", castTime)
 
   Description:  ???????????????????????????????????????????????????????????????????????????
 
   Description:  ???????????????????????????????????????????????????????????????????????????
 
   Message Data: <double>castTime
 
   Message Data: <double>castTime
 
  
 
   Message Name: "CancelSpellCast"
 
   Message Name: "CancelSpellCast"
Line 82: Line 80:
 
   Description:  Aborts a SpellCast Visually
 
   Description:  Aborts a SpellCast Visually
 
   Message Data: none
 
   Message Data: none
 
 
 
  
 
=== CATEGORY:  Player Chat ===
 
=== CATEGORY:  Player Chat ===

Revision as of 23:56, 2 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

 Message Name: "StartCasting"
 Example:      player:SendClientMessage("StartCasting", castTime)
 Description:  ???????????????????????????????????????????????????????????????????????????
 Message Data: <double>castTime
 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:

{ {<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:
{ <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:
{ { <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:
{ <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:
{<number>, <number>} = { walkSpeed, runSpeed} or:
{<number>} = { walkSpeed (is also runSpeed) } Message Name: "SetCustomServerAction" Example: player:SendClientMessage("") Description: Set Custom Keybinds for ServerActions Message Data: { <string>id, <string>key, <string>eventId } Allowed Ids: "CustomAction1", ... "CustomAction5" 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:
{ { <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")