The Daily Click ::. Forums ::. Klik Coding Help ::. loading evaluation editor values from ini....
 

Post Reply  Post Oekaki 
 

Posted By Message

ChuckyT



Registered
  04/12/2004
Points
  21
11th December, 2004 at 02:53:22 -

here's one to stump y'all (I hope not!)

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!

 
Bop it up, Rock it out!

ChrisB

Crazy?

Registered
  16/08/2002
Points
  5457
11th December, 2004 at 07:16:02 -

No, you'd have to use the Expression Evaluator object for MMF only.

 
n/a

Tigerworks

Klik Legend

Registered
  15/01/2002
Points
  3882
11th December, 2004 at 07:21:49 -

Or you could just save "Player 1" or "Player 2" in the INI, and adjust your formulas and attacks accordingly.

 
- Tigerworks

Liquixcat

Administrator
Lazy Coder

Registered
  08/12/2002
Points
  201

VIP MemberLikes TDCKitty
11th December, 2004 at 11:36:57 -

I don't understand, I think this is possible.

+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.

Liquixcat

Administrator
Lazy Coder

Registered
  08/12/2002
Points
  201

VIP MemberLikes TDCKitty
11th December, 2004 at 11:39:39 -

OR establish dominance with yuor ini.

 
thinking is like pong, it's easy, but you miss sometimes.

ChuckyT



Registered
  04/12/2004
Points
  21
11th December, 2004 at 21:42:05 -

establish dominance?

 
Bop it up, Rock it out!

Liquixcat

Administrator
Lazy Coder

Registered
  08/12/2002
Points
  201

VIP MemberLikes TDCKitty
12th December, 2004 at 01:53:57 -

yeah...be like...'BITCH, you my INI! you do what i say!'
dominance established

 
thinking is like pong, it's easy, but you miss sometimes.

ChuckyT



Registered
  04/12/2004
Points
  21
12th December, 2004 at 09:09:32 -

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?

Image Edited by the Author.

 
Bop it up, Rock it out!

Liquixcat

Administrator
Lazy Coder

Registered
  08/12/2002
Points
  201

VIP MemberLikes TDCKitty
12th December, 2004 at 16:11:22 -

to convert values to strings use the str$(value here) command
to convert strings to values use the val(string here) command

i dunno if you knew that or not, i'm still not understanding this problem :S...sorry about the lawsuit, some of those INI's are fiesty.

 
thinking is like pong, it's easy, but you miss sometimes.

ChuckyT



Registered
  04/12/2004
Points
  21
12th December, 2004 at 19:44:21 -

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!

https://mywebspace.wisc.edu/ajpetersen/web/Games/Mondo Equation Test.zip

Hope this helps a bit to understand what I'm talking about?

 
Bop it up, Rock it out!

Liquixcat

Administrator
Lazy Coder

Registered
  08/12/2002
Points
  201

VIP MemberLikes TDCKitty
13th December, 2004 at 03:15:47 -

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.

ChuckyT



Registered
  04/12/2004
Points
  21
13th December, 2004 at 03:26:18 -

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.

thanks

 
Bop it up, Rock it out!

Liquixcat

Administrator
Lazy Coder

Registered
  08/12/2002
Points
  201

VIP MemberLikes TDCKitty
13th December, 2004 at 10:55:24 -

yeah okay, but i'm still not sure i understand this right....

but here http://members.shaw.ca/liquixcat/mondo.html

the equation will have to be solved in TGF first...but the answer will stay in that INI forever....

btw, I removed ini+, just used a normal INI

 
thinking is like pong, it's easy, but you miss sometimes.

ChuckyT



Registered
  04/12/2004
Points
  21
13th December, 2004 at 17:49:47 -

thanks for the tutorial...

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.

Does that help?

 
Bop it up, Rock it out!

Liquixcat

Administrator
Lazy Coder

Registered
  08/12/2002
Points
  201

VIP MemberLikes TDCKitty
13th December, 2004 at 21:46:44 -

oh...lol...I get what you're saying now....yeah you can't do that as far as I know...hahaha

sorry

 
thinking is like pong, it's easy, but you miss sometimes.

ChuckyT



Registered
  04/12/2004
Points
  21
13th December, 2004 at 22:05:30 -

shitakke mushrooms! that's no good: my game is defeated!!!

Ohh dear. Any ideas?

 
Bop it up, Rock it out!

Liquixcat

Administrator
Lazy Coder

Registered
  08/12/2002
Points
  201

VIP MemberLikes TDCKitty
14th December, 2004 at 09:56:59 -

is this like a DND type game so you can save a wizards stats or something?

like....this warrior has strength+1
and then the level will load strength+1+modifier and solve it?

cause if so, this will have to be though up differently

so the only way i can think of is each item of the ini is part of the equation..

ie...
+on some event (like a level up)
:set ini file to appdrive$ + appdir$ + 'wizard.stat'
:set group to 'wizard _str'
:set item to 'str'
:set value to '<current strength>'
:set item to 'mod'
:set value to '<modvalue>'

THEN
+on some event...like a battle begins (on a different frame even)
:set ini file to appdrive$ + appdir$ + 'wizard.stat'
:set group to 'wizard_str'
:set item to 'str'
:set counter_str = value of ini
:set item to 'mod'
:set counter_mod = value of ini
:set counter_totalstrength = counter_str + counter_mod

i dunno...i think this way will work...you're going to have to figure this out, that's the best i got.

 
thinking is like pong, it's easy, but you miss sometimes.

ChuckyT



Registered
  04/12/2004
Points
  21
15th December, 2004 at 00:47:41 -

The problem is that the user creates the equation. This makes making specific events a no no for equations.

Damn. Oh well. On to a platformer.

Still looks like my game is dead. Thanks for all your help.

 
Bop it up, Rock it out!
   

Post Reply



 



Advertisement

Worth A Click