is_observer LUA or WML equivalent?
Moderator: Forum Moderators
is_observer LUA or WML equivalent?
1.14 has removed the differentiation between sides a client controls and networked human sides. That used to be a nice way to determine which sides a client controlled. We now have wesnoth.get_viewing_side(), which works nicely to determine if the currently playing side belongs to any client. However, this fails with observers, since they share the vision of the currently playing side, yet don't control it. Is there any equivalent in WML or Lua to the c++ bool is_observer that I can use to allow observers to access a certain feature while still preventing the currently playing side from doing so?
Thanks.
Thanks.
Re: is_observer LUA or WML equivalent?
See [chat] implementation, I added such check there.
Re: is_observer LUA or WML equivalent?
Thanks, sadly I need this to be able to display my unsynced menu to observers as well when they click on one of the currently playing player's units.
Re: is_observer LUA or WML equivalent?
Wait, but does this show for the sides that aren't currently playing, too?
My problem is that I want to prevent the currently playing guy from accesing the menu, but still allow this for observers.
In 1.12 for the observer all sides were controller=networked, here sadly it's human for everyone.
My problem is that I want to prevent the currently playing guy from accesing the menu, but still allow this for observers.
In 1.12 for the observer all sides were controller=networked, here sadly it's human for everyone.
Re: is_observer LUA or WML equivalent?
You can find if current client is observer. You can use that in menu filter lua_function.
1.14 lobby is not responding, so I wont try to implement it myself yet.
1.14 lobby is not responding, so I wont try to implement it myself yet.
Re: is_observer LUA or WML equivalent?
You mean [set_menu_item][filter_location]lua_function?
Re: is_observer LUA or WML equivalent?
That should work too.
Re: is_observer LUA or WML equivalent?
That in addition to what?
Re: is_observer LUA or WML equivalent?
SUF also has lua_function, which is there in 1.12 too.
Re: is_observer LUA or WML equivalent?
Thanks, I'll try that.
Re: is_observer LUA or WML equivalent?
Well, I've found the thread describing the compatibility changes between 1.12 and 1.13/14 so for anyone who might be wondering about this - there is now an attribute called is_local that replaces the functionality of network/human.
Re: is_observer LUA or WML equivalent?
Yes, I said to look [chat] implementation, that makes use of is_local.
Re: is_observer LUA or WML equivalent?
[chat], the WML tag? How can it be making use of a lua proxy table attribute? Oh by the way, where are the WML tags defined in the source code, do you know?
Re: is_observer LUA or WML equivalent?
data/lua. Many wml tags are just lua functions.