Plugin API: how to access battle lobby data + basic debugging
Posted: 22 Jan 2015, 15:46
Would it be possible to wish for some new accessors? Specifically I would like to get the battle state from the autohost: the list of unready players, unsynced players, in-game players and ready players. So one accessor called:
getBattleState()
I tried looking at some of the already exiting accessors but I didn't find the correct data:
http://planetspads.free.fr/spads/doc/sp ... #Accessors
The values of some keys in those hash tables are only written as HASH[0x123456], is that because the data is anonymous or because I access it in the wrong way?
For instance, there is a hash like this in getSpringInterface(); players = HASH(0x3a89d50). Should I somehow read this as a list instead of a hash to get the right data? Sorry if this question is very stupid.
Also, when I try to iterate through some data provided by some accessors the whole autohost crashes. This is an example of the code I use and that makes the autohost crash:
Edit: ok, the last issue regarding the crash seems to occur because getLobbyState() seems to be an integer.
getBattleState()
I tried looking at some of the already exiting accessors but I didn't find the correct data:
http://planetspads.free.fr/spads/doc/sp ... #Accessors
The values of some keys in those hash tables are only written as HASH[0x123456], is that because the data is anonymous or because I access it in the wrong way?
For instance, there is a hash like this in getSpringInterface(); players = HASH(0x3a89d50). Should I somehow read this as a list instead of a hash to get the right data? Sorry if this question is very stupid.
Also, when I try to iterate through some data provided by some accessors the whole autohost crashes. This is an example of the code I use and that makes the autohost crash:
Iterating in a similar way with my $p_config = getSpringInterface(); does not produce any crash.my $p_config = getLobbyState();
foreach my $key ( keys %{$p_config} )
{
my $value = $p_config->{$key};
slog("$key = $value",4);
}
Edit: ok, the last issue regarding the crash seems to occur because getLobbyState() seems to be an integer.