Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (degenerate_762), 1,098 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 3 1 2 3
How to save the contents of an array, WRS/resource #466020
05/21/17 05:34
05/21/17 05:34
Joined: Apr 2002
Posts: 1,246
ny
jumpman Offline OP
Serious User
jumpman  Offline OP
Serious User

Joined: Apr 2002
Posts: 1,246
ny
Hi friends

I have a A* path calculation in the beginning of my level to compute pathfinding paths. George's AUM back in the day made a TXT file that was loaded to speed up the level loading.

Is there a way to save the contents of an array into a WRS file, and then copy this array into another? I can do the mem_copy stuff i think, But how do I save a big array into a seperate file, that cant be opened like a TXT file?

Re: How to save the contents of an array, WRS/resource [Re: jumpman] #466021
05/21/17 07:32
05/21/17 07:32
Joined: Oct 2011
Posts: 1,082
Germany
C
Ch40zzC0d3r Offline
Serious User
Ch40zzC0d3r  Offline
Serious User
C

Joined: Oct 2011
Posts: 1,082
Germany
Just save and read it in binary mode?

Re: How to save the contents of an array, WRS/resource [Re: Ch40zzC0d3r] #466023
05/21/17 15:32
05/21/17 15:32
Joined: Apr 2002
Posts: 1,246
ny
jumpman Offline OP
Serious User
jumpman  Offline OP
Serious User

Joined: Apr 2002
Posts: 1,246
ny
Sorry, I've never heard of binary mode, What is that?

Re: How to save the contents of an array, WRS/resource [Re: jumpman] #466025
05/21/17 18:51
05/21/17 18:51
Joined: Oct 2011
Posts: 1,082
Germany
C
Ch40zzC0d3r Offline
Serious User
Ch40zzC0d3r  Offline
Serious User
C

Joined: Oct 2011
Posts: 1,082
Germany
You write the bytes from the array byte by byte to a file.
For reading you do the exact same thing again vice versa, no need to use any kind of encoding or whatnot.

Re: How to save the contents of an array, WRS/resource [Re: Ch40zzC0d3r] #466026
05/21/17 19:00
05/21/17 19:00
Joined: Apr 2002
Posts: 1,246
ny
jumpman Offline OP
Serious User
jumpman  Offline OP
Serious User

Joined: Apr 2002
Posts: 1,246
ny
what kind of file can I write to?

Re: How to save the contents of an array, WRS/resource [Re: jumpman] #466027
05/22/17 00:48
05/22/17 00:48
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
Any. Binary files are an obscure Windows concept which doesn't exist on virtually any other OS (as in, all files are binary, cause that's what they are!).

In any case, there is no such thing as a file type. You can write jpeg data into a word file, because files are just binary data on disk. Windows tries really really hard to tell you that file types are a thing via extensions, but again, you can write binary data in a .txt file just fine. Obviously, users might expect certain conventions, eg that txt files contain readable text and not random binary nonsense. But who cares, it's not like anyone is going to drag you in front of the file system court.


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: How to save the contents of an array, WRS/resource [Re: WretchedSid] #466028
05/22/17 02:09
05/22/17 02:09
Joined: Apr 2002
Posts: 1,246
ny
jumpman Offline OP
Serious User
jumpman  Offline OP
Serious User

Joined: Apr 2002
Posts: 1,246
ny
I.....did not know that. Well I knew, but I didn't know you could just save it out like that in gamestudio. So I made up an extension and saved it out, and was able to open and read it laugh

So I could also bind these in a wrs, so they aren't seperate files correct?

Thank you wretchedsid!!!!

Re: How to save the contents of an array, WRS/resource [Re: jumpman] #466032
05/22/17 09:00
05/22/17 09:00
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline
Serious User
Reconnoiter  Offline
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
Yeah you can manually bind to wrs through;
#define PRAGMA_BIND "blabla.txt";

Maybe you dont even have to do that, if use you it specifically in your script.

Re: How to save the contents of an array, WRS/resource [Re: Reconnoiter] #466036
05/22/17 13:40
05/22/17 13:40
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
The only thing you have to take into account is that 'txt' files are not binded into resource files. I don't nknow why but they have to be renamed if I am not wrong.

Re: How to save the contents of an array, WRS/resource [Re: txesmi] #466039
05/22/17 14:59
05/22/17 14:59
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Go to
GStudio8 -> data -> options.scr,
open it with a text editor, find
EXCLUDE_RESOURCE = "WRS;TMP;AVI;MPG;MOV;DLL;C;H;XML;LOG;TXT;PNG"
and remove
TXT
to include txt files in the WRS as well. Reason for this default setting probably is that you cannot use file_open_read on txt files which are contained in the WRS. You either have to extract them first (file_copy or what it's called) or (probably better) use file_load.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
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