Is there anyway to set a counter in TGF equal to an equation saved in an INI? The equation would be generated in a previous level in order to accomodate the difference between Player 1 and Player 2. The game uses custom characters whose attacks are dependent on who is P1 and P2.
So I figure when the user creates the character, I'll have the game create two equations that will be saved to an ini file. Then, in the battle screen, one of the equations will be loaded.
Regardless, the thing standing in my way is getting TGF to recognize a saved equation (saved in the same manner as in the expression editor) as the value of a counter. Any ideas? Thanks for your patience with this long-winded post!
+start of level
:set counter to val(string of "ini")
or just set each number of the entire equation in different item groups.
ie. the 'equation' is p1>p2 (or w/e, P1=player1, P2=player2)
then
+on some event
:set INI group to Player1equation
:set ini item to step1
:set ini string (alterable value a "P1")
:set ini item to step2
:set ini string (alterable value a "P2")
next level
+start of level
:set item to step1
:set counter1 = string of "ini"
:set item to step2
:set counter2 = string of "ini"
+counter1 > counter2
:then activate whatever
but if this is what you mean...then just use global values unless it's kind of an RPG system that keeps the characters info after you quit...in which case use the ini.
I'm prolly totally wrong of what you meant and wrote this for nothing...lol
thinking is like pong, it's easy, but you miss sometimes.
I tried that, and unfortunately, the ini filed a class-action lawsuit against me for sexual harassment in the work place. Who knew she would take, "Get on yo' knees, bitch!" in a negative way?
Ohh.. and I still can't get a counter to load a value from an expression saved in an ini. I think it might have something to do with converting to/from strings and values?
Well, I knew about those translate commands (str$ and val), but my problem is just getting the expression evaluator to accept the saved equation as code, rather than just some ordinary string.
Here's a test file I made to demonstrate what I'm talking about.... it doesn't work... because if it did I wouldn't be having this problem!
For some reason this isn't clicking...'cause this is really easy if i understand this.
+Start of frame (or some event that has been activated)
:set ini file = appdrive$ + appdir$ + "whatever.ini"
:set (editbox 'save') = str$(counter1 + counter2)
+button clicked save
:set ini group to equation1
:set ini item to equation1
:set value = val(editbox 'save')
+button clicked load
:set ini group to equation1
:set ini item to equation1
:set (editbox 'load') = value of ini
all you'd have to make sure of is the counters are set to the proper value to be added in the equation. infact with the 'str$' command you could manipulate any counters IN GAME to be added and multiplied or whatever into the 'save box' then when the game is saved and loaded in anyway the program would have calculated the equation then saved the answer which can be easily loaded.
for some reason i don't think this is what you mean because if you overlooked this then you reall should learn more about ini using. good luck
thinking is like pong, it's easy, but you miss sometimes.
thanks man, but that still doesn't work. It saves the ini file as a "0", rather than the actual values. Ugh. This is really annoying.
So I tried it in the little test game I made, still no good. Maybe I missed something. Could you spend a few minutes, change my file, and send it back to me? Pleeeease? Because I've tried a whole bunch of things to no avail. My e-mail is ajpetersen@wisc.edu.
but.. you're right. I must not be conveying myself clearly enough.
The equation that you programmed into the line "always" is what needs to be loaded from the ini. So rather than the calculation being done and the final value being saved, the equation needs to be loaded from the ini and used to calculate a value based off of counters in that level.