Posted by koadah on 2012-01-04 15:40:40
Good stuff.
Maybe it should go in the wikki
http://fumbbl.com/help:Fumbbl+API
Posted by gandresch on 2012-01-04 16:30:14
Sounds sensible :-)
Posted by Hitonagashi on 2012-01-04 18:07:17
Hmm.
Doesn't affect me, because I'm not tracking individual players. Very good find though, will remember that!
Posted by Archpeasant on 2012-01-04 18:57:17
I'm not sure what you just said but GOOD JOB!
Rated six.
Posted by Kelkka on 2012-01-04 23:02:05
First solution i can come up with is:
when you parse the number, check if it has non-integers in it.
If it does, apply one specific number is the id (like 9999999, or -1). And if you want to keep track of those players too, strip the non-integers from the number and add that to secondary key.
This maybe isn't the most efficient but solves the problem of accidently giving id of existing or future player for merc/zombie. And you can identify each merc/zombie with the 2 keys.
Posted by DonTomaso on 2012-01-05 00:37:14
This must be important because I didn't understand it and can't see the use for it.
Rated six for intelligence.
Posted by SavageJ on 2012-01-05 06:52:22
You said the reason to leave the player ids as integers in an extract is because to convert them to strings would "increase the time of any calculation by a huge factor", but these are player IDs, not actual numbers, right? So you won't be adding them together, or multiplying them, or anything like that, right? (Or will you? I don't know how you're manipulating the player data.)
Most of them happen to be integers, but identifiers are (IMHO) strings, just strings (in this case, usually) of digits.
Posted by Christer on 2012-01-05 10:19:50
A bit of clarification:
The normal case is that each player has an integer ID in FUMBBL. They also have a reference to a position (such as a Troll Slayer, which is also an integer in the normal case).
FFB, on the other hand, has string IDs for both players and positions. This is fine, as the integers used on FUMBBL can easily be represented by strings as well without problems.
FUMBBL simply can't store a player or position using anything but an integer. However, what you will run into during for example a birthday event is a set of virtual players on the team. These are not stored in the database, but are randomly generated in the XML API when FFB (and your scripts) access them.
Now, to implement the zombies, I had to do two changes to the API:
1. Add zombie position definitions to the roster API. These showed up with position IDs of "z1", "z2", "z3" and were always added to the roster.
2. Add up to three zombies on the teams. Since player IDs are expected to be unique, I had to make a composite ID for the player: "z_" + teamId + ":" + [1|2|3]
Essentially, if your API application doesn't care about temporary players like the birthday zombies, you can simply ignore any players / positions with non-integer IDs. FUMBBL doesn't (and can't) store those IDs anyway.
Posted by gandresch on 2012-01-05 11:48:39
Ignoring them is was I did :-)
I thought these were the Mercenaries ... but zombies make sense.
Thank you for the clarification.