Jump to content
Alloder.pro: about Allods with love
Search In
  • More options...
Find results that contain...
Find results in...

New program for writers

We turn from quantity to quality and tell you how we will supplement the Allods Team program with rewards in rubles.

More

The new Updater

Let us to introduce the new addon updater software and to share the details

Read more

Alloder 2.0

We have started the process of project evolve, and this relates not only, and not even primarily of the site's view

Read more

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


Guest Audas
 Share

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

 Share

×
×
  • Create New...

Important Information

By using our site you agree to the Terms of Use