Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
3 registered members (TedMar, AndrewAMD, fairtrader), 578 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 3 1 2 3
Loading Object Data From A Text / INI / DAT files #135122
06/09/07 22:31
06/09/07 22:31
Joined: Jun 2007
Posts: 236
acknex.exe
ACKNEX007 Offline OP
Member
ACKNEX007  Offline OP
Member

Joined: Jun 2007
Posts: 236
acknex.exe
Hello ,
i need a simple code / idea to load some data saved in text files..
so..i can assign it to the model in runtime.

anybody help please ?

Thanks

Re: Loading Object Data From A Text / INI / DAT files [Re: ACKNEX007] #135123
06/10/07 04:57
06/10/07 04:57
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
Store your info in some type of organized way.

fHandle = file_open()
file_str_write(fhandle, property1);
file_str_write(fhandle, property2);
file_str_write(fhandle, property3);
...
file_close(fHandle);


Just a basic outline. The rest is up to you!


xXxGuitar511
- Programmer
Re: Loading Object Data From A Text / INI / DAT f [Re: xXxGuitar511] #135124
06/10/07 08:06
06/10/07 08:06
Joined: Jun 2007
Posts: 236
acknex.exe
ACKNEX007 Offline OP
Member
ACKNEX007  Offline OP
Member

Joined: Jun 2007
Posts: 236
acknex.exe
Thank You !

i got it.

will it work with any formats ? (.DAT ,.TXT , etc ?)

Re: Loading Object Data From A Text / INI / DAT f [Re: ACKNEX007] #135125
06/10/07 08:10
06/10/07 08:10
Joined: Jun 2007
Posts: 236
acknex.exe
ACKNEX007 Offline OP
Member
ACKNEX007  Offline OP
Member

Joined: Jun 2007
Posts: 236
acknex.exe
is there any way to load something like this ?

_______________________________________________________________

action = myaction1;
scale_x= 1.5;
scale_y= 1.5;
scale_z= 1.5;
pos_x = 0;
pos_y = 0;
pos_z = 0;
material = my_mat1;

thanks..

any ideas please ??

Re: Loading Object Data From A Text / INI / DAT f [Re: ACKNEX007] #135126
06/10/07 10:08
06/10/07 10:08
Joined: Oct 2006
Posts: 873
S
Shadow969 Offline
User
Shadow969  Offline
User
S

Joined: Oct 2006
Posts: 873
teoretically yes, but i haven't tried doing this. Read string, compare it with something and do some action...

Re: Loading Object Data From A Text / INI / DAT f [Re: Shadow969] #135127
06/10/07 10:33
06/10/07 10:33
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline
User
tompo  Offline
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
yes... I hope...
then .txt should look like
myaction1,1.5,1.5,1.5,0,0,0,my_mat1

try something like this:

//veriables//
var veriables_var;
string myaction_str[20];
string scale_x_str[4]; string scale_y_str[4]; string scale_z_str[4];
string pose_x_str[4]; string pose_y_str[4]; string pose_z_str[4];
string material_str[10];

//function//
veriables_var = file_open_read("your.txt");

my.action = file_str_read(veriables_var,myaction_str);

file_str_read(veriables_var,scale_x_str);
scale_x = str_to_num(scale_x_str);
file_str_read(veriables_var,scale_y_str);
scale_y = str_to_num(scale_y_str);
file_str_read(veriables_var,scale_z_str);
scale_z = str_to_num(scale_z_str);

file_str_read(veriables_var,pos_x_str);
pos_x = str_to_num(pos_x_str);
file_str_read(veriables_var,pos_y_str);
pos_y = str_to_num(pos_y_str);
file_str_read(veriables_var,pos_z_str);
pos_z = str_to_num(pos_z_str);

material = file_str_read(veriables_var,material_str);

file_close(veriables_var);

Last edited by tompo; 06/10/07 10:41.

Never say never.
Re: Loading Object Data From A Text / INI / DAT f [Re: tompo] #135128
06/10/07 11:47
06/10/07 11:47
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline
Senior Expert
HeelX  Offline
Senior Expert
H

Joined: Jul 2001
Posts: 6,904
If you do this by simply saving/loading numeric or string information, this WILL NOT work for actions and materials. If you want save which function and which material an entity owns, build a lookup table which associates a unique identifier number with all (available) functions and materials and save the ID instead. Later, during loading, you take the ID from the file and take the associated material/function and assign it.

Re: Loading Object Data From A Text / INI / DAT f [Re: HeelX] #135129
06/10/07 12:18
06/10/07 12:18
Joined: Jun 2007
Posts: 236
acknex.exe
ACKNEX007 Offline OP
Member
ACKNEX007  Offline OP
Member

Joined: Jun 2007
Posts: 236
acknex.exe
Thanks Guys,

i will take a look from your examples..
tompo .. Thanks again for the Full Explaination. :-)

Re: Loading Object Data From A Text / INI / DAT f [Re: ACKNEX007] #135130
06/10/07 21:19
06/10/07 21:19
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline
User
tompo  Offline
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
Quote:

If you do this by simply saving/loading numeric or string information, this WILL NOT work for actions and materials.




Maybe it's right... I haven't test it so for action or material use f.e. numbers and vars and then your txt file will be looking like:
1,1.5,1.5,1.5,0,0,0,1

then:
file_str_read(veriables_var,material_str);
material_var = str_to_num(material_str);
if(material_var ==1){my.material = my_mat1;}

or use str_cmp (String1, String2) function
I hope it will be helpfull


Never say never.
Re: Loading Object Data From A Text / INI / DAT f [Re: tompo] #135131
06/10/07 21:31
06/10/07 21:31
Joined: Jun 2007
Posts: 236
acknex.exe
ACKNEX007 Offline OP
Member
ACKNEX007  Offline OP
Member

Joined: Jun 2007
Posts: 236
acknex.exe
Thank You..

i will test it and let you know. how it works..

Page 1 of 3 1 2 3

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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