Page 1 of 1

Reading a single variable during a game

Posted: Sat Jan 23, 2010 6:12 am
by miller2158
I am using VB to control a game (really a simulation with discrete time stops) so that I can process data/results from the current time step. I then will rewrite the .cin/.gin file and run the next time step. I have some complex decision processes that are much easier to code and run in VB. My issue is that I can't figure out how to read a single variable value from my current time step without dumping the .vdf file and picking out my single value.

I have no user interface with the game, I am only using VB to control it.

Posted: Sat Jan 23, 2010 8:59 am
by Administrator
vensim_get_val will get you what you want.

http://www.vensim.com/documentation/html/26215.htm

Tony.

Posted: Sat Jan 23, 2010 12:26 pm
by bob@vensim.com
You can also use the vensim_start_simulation, vensim_continue_simulation and vensim_finish_simulation instead of sending the command MENU>GAME- this will be faster and probably easier to code. No need to use .gin files in this case just use SIMULATE>SETVAL (the variables being set do need to be gaming variables, and the simulation needs to be a game.

Faster still would be to write your logic as an external function, though this is trickier than calling the Venapp if you are working in VB.