Re: Calling script functions from code
Posted: 2012-08-03, 03:54
Well, run into another bit of a conundrum...
I got a very basic set of characters all set up in the map script, and was able to pick it up fine running commands through the console. Next step was to be able to select a character before spawning, so the game would associate character stats with the player's HumanPlayer instance. So, I made up a (very) quick GUI, adjusted the HumanPlayer.cpp code to show it when in the appropriate modes (dead, free spectator), and got ready to start pulling the list of characters in from the server.
Problem is, I don't see a good way to do that... I had assumed that I'd be able to do it using the ci object, but it looks like that only works for code-defined objects you've set up elsewhere (ClientStateInGame?). I can invoke runMapCmd through it, but I can't actually get anything back out of it that I can tell (since it goes through ci.RunCommand), unless there's a way to dig for map script values in ci.GetValue().
Is there some easy trick to pull map script objects across from the server? Even better, is there a way to add to the commands/objects ci can respond to with RunCommand and Get/SetValue?
I got a very basic set of characters all set up in the map script, and was able to pick it up fine running commands through the console. Next step was to be able to select a character before spawning, so the game would associate character stats with the player's HumanPlayer instance. So, I made up a (very) quick GUI, adjusted the HumanPlayer.cpp code to show it when in the appropriate modes (dead, free spectator), and got ready to start pulling the list of characters in from the server.
Problem is, I don't see a good way to do that... I had assumed that I'd be able to do it using the ci object, but it looks like that only works for code-defined objects you've set up elsewhere (ClientStateInGame?). I can invoke runMapCmd through it, but I can't actually get anything back out of it that I can tell (since it goes through ci.RunCommand), unless there's a way to dig for map script values in ci.GetValue().
Is there some easy trick to pull map script objects across from the server? Even better, is there a way to add to the commands/objects ci can respond to with RunCommand and Get/SetValue?