thanks a ton for your answer! i was now able to get this working. i was using the correct value previously but i didnt know you have to reverse the number in order to match your pokemon.
btw, do you know when a mirage island value is created for the very first time? apparently when you start a new game it set to 0 and if your battery is dry it obviously never changes. i would be interested in what event triggers the number in the first place.
also do you know anything about rng manipulation of the lottery? is it similar to mirage island?