Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, 1 invisible), 583 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
storing multiple values 1 skill #455431
10/19/15 19:30
10/19/15 19:30
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline OP
Serious User
Reconnoiter  Offline OP
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
Hi again,

What would be the best way to store as many values with up to 2 digits (e.g. 3 or 22 or 99) in a skill?

I thought something on the line of 4 values per skill by using integer/fraction and multiplying/dividing. I managed to get 4 numbers out of one skill, but the problem is losing precision when saving into the skills (e.g. values get lower etc. with each save/restore).

Here is the general idea (/divided in 4 parts):
112233,44

But its currently faulty cause of precision loss.

Re: storing multiple values 1 skill [Re: Reconnoiter] #455433
10/19/15 19:59
10/19/15 19:59
Joined: Mar 2012
Posts: 927
cyberspace
W
Wjbender Offline
User
Wjbender  Offline
User
W

Joined: Mar 2012
Posts: 927
cyberspace
you could fit them into a string like "23,24,66,22,55,67"
then typecast into the skill something like skill1=(char*)this_string or skill1=(string*)this string ..

or put them in an array and cast it into the skill.

or put them in a struct - pointer and cast them in to the skill.

Last edited by Wjbender; 10/19/15 20:00.

Compulsive compiler
Re: storing multiple values 1 skill [Re: Reconnoiter] #455434
10/19/15 20:01
10/19/15 20:01
Joined: Jan 2004
Posts: 2,062
Hamburg, Germany
slacer Offline
Expert
slacer  Offline
Expert

Joined: Jan 2004
Posts: 2,062
Hamburg, Germany
Hi,

what is the problem you want to solve?
You want to store many values per entity - but why?

Re: storing multiple values 1 skill [Re: Wjbender] #455435
10/19/15 20:10
10/19/15 20:10
Joined: Feb 2012
Posts: 371
Dico Offline
Senior Member
Dico  Offline
Senior Member

Joined: Feb 2012
Posts: 371
Originally Posted By: Wjbender
you could fit them into a string like "23,24,66,22,55,67"
then typecast into the skill something like skill1=(char*)this_string or skill1=(string*)this string ..

or put them in an array and cast it into the skill.

or put them in a struct - pointer and cast them in to the skill.


well , i think its good answer laugh

Re: storing multiple values 1 skill [Re: Wjbender] #455450
10/20/15 10:43
10/20/15 10:43
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline OP
Serious User
Reconnoiter  Offline OP
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
Thanks for your replies:

Originally Posted By: Wjbender
you could fit them into a string like "23,24,66,22,55,67"
then typecast into the skill something like skill1=(char*)this_string or skill1=(string*)this string ..

or put them in an array and cast it into the skill.

or put them in a struct - pointer and cast them in to the skill.
, I forgot to mention it needs to be able to saved in a wmb file too.

Anyway I think I have a reliable system up running now. I dropped the fraction so it now looks like this: 112233.
And to keep precision: before saving values into the skill, I do ...skill = 0.05. This seems to negate precision loss.
Also I reduced the range from 1-99 to 1-89 cause otherwise when a number reached 99 the previous number jumped up by 1 point (and for me 1-89 is still far enough options).


Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1