Guest Audas Posted March 7, 2011 Share Posted March 7, 2011 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? Quote Link to comment Share on other sites More sharing options...
Ciuine Posted March 7, 2011 Share Posted March 7, 2011 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. Quote Link to comment Share on other sites More sharing options...
Guest Audas Posted March 7, 2011 Share Posted March 7, 2011 Thanks Ciuine for your explanation. It's working now. Quote Link to comment Share on other sites More sharing options...
Recommended Posts