Help with maps of records

StDoodle

Minion
I've got this script to parse dungeon activity for HCN, and it has a major problem. I've hacked in some meager support for Elf Alley, but for some reason, the two maps of my "player" records both seem to end up having the same info. Or being reported as if they do.

If anyone can find what I'm doing wrong, please help! It's likely something in the function "parse_hobopolis()" or one of its dependencies.

Thanks.
 

Attachments

This line:
Code:
elfbashers[tmpname] = tmpplayer;
means that any changes to tmpplayer are changed in elfbashers.tmpname
You want to do something like
Code:
elfbashers.name=tmpplayer.name;
elfbashers.turns=tmpplayer.turns;

Also, why did you write your own "new_player()" function rather than using the build in new Player() construct?
 
If that's the case, shouldn't both players & elfbashers contain only the last players' info? Or shouldn't all keys contain the same data? I don't get it...

As to the "new" thing, I had no idea how it works. I should learn to use the wiki. ;)
 
I didn't look at the code, but maybe Alhifar meant:
PHP:
elfbashers[ tempname ].name=tmpplayer.name;
elfbashers[ tempname ].turns=tmpplayer.turns;

If you simply do
PHP:
elfbashers[tmpname] = tmpplayer;
then elfbashers[tmpname] will change each time tmpplayer changes.
 
Thats exactly what I meant slyz. I should really pay attention when I'm posting >.>

And as far as I understand, that's how it works.
 
Ah wait, I think I get it now... The fix I did works, and now I have at least some clue as to why. I think. Thanks everybody.
 
Back
Top