Jump to content

Digest March

We talk about what was done and updated in the past month. We help keep abreast of events.

March

Servers monitoring and the Addons Editor

We present you two legends. All dreams come true.

Servers monitoring The Addons Editor

Game tooltips

Tooltips provide a way for 3rd party fansites and extensions to display detailed information on mouseover.

Read more

The Addons Updater

Let us to introduce the addons updating software and to share the details

Read more Download

Beginner problem: SetValue not meett the given condition. Help!


Guest Audas

Recommended Posts

Guest Audas

Hi, I'm a beginner with addons dev and I'm currently trying to write a simple addon which shows a message when the player moves (yeah!). I'm basing on the SampleZoneAnnounce but for some reason I'm getting the errors below when I call wtMessage:SetVal( "value", "Player moved!" ).

Info: addon MyTracker: MyTracker init

Info: addon MyTracker: EventAvatarPosChanged

Error: addon MyTracker:

Error: addon MyTracker:

Error: addon MyTracker: func: SetVal, method, line: -1, defined: C, line: -1, [c]

Error: addon MyTracker: func: OnEventAvatarPosChanged, global, line: 14, defined: Lua, line: 10, [string "mods/addons/mytracker/scriptmytracker.lua"]

Error: addon MyTracker: Widgets::LuaSetVal: param 3 (type: string) not meet the given condition: , details: int __cdecl Widgets::LuaSetVal(struct lua_State *)

Here is my code:

Code:

Global( "wtArrow", nil )

Global( "wtMessage", nil )

function OnEventAvatarPosChanged(params)

LogInfo( "EventAvatarPosChanged" )

wtMessage:SetVal( "value", "Player Moved!" )      -- problem here

wtMessage:Show( true )

end

function Init()

LogInfo( "MyTracker init" )

wtMessage = mainForm:GetChildChecked( "Announce", false )

wtMessage:Show( false )

common.RegisterEventHandler( OnEventAvatarPosChanged, "EVENT_AVATAR_POS_CHANGED" )  

end

Init()

How to fix this error?

Link to comment
Share on other sites

Text Views or Valued Texts require userdata, which means you need to convert to WString via userMods.ToWString("Player Moved!").

This line is telling you that; Error: addon MyTracker: Widgets::LuaSetVal: param 3 (type: string) not meet the given condition: , details: int __cdecl Widgets::LuaSetVal(struct lua_State *)

What it says is that the third paramater, in this case, Param1:SetVal("param2", "param3") is a string, but should be something else. It doesn't specify what else it should be because there are a lot of userdata formats that can fit in it.

Link to comment
Share on other sites

Guest Audas

Thanks Ciuine for your explanation. It's working now.

Link to comment
Share on other sites

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using our site you agree to the Terms of Use