Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Help ,how do I Load a 2 dim array

Author
Message
Lance
20
Years of Service
User Offline
Joined: 22nd Jul 2003
Location: Third planet from Sun
Posted: 10th Feb 2018 18:46
I finally sat down and sort of figured out how to make and save an array .. I am using [300,4] . I broke down the 300 part using a variable (A) starting with A=1 and inc it as I need [A,4]. It works and I save it out as a text file which my map editor reads in and loads .. But , I do need to load the file back into the array to make changes .

file= opentowrite("raw:C:HighB/MyFolderZ/score.txt",0)

length=A //Blocks.length

for n=2 to length // ROW
for data=0 to 4 // COLUMN = 5 values
write=Blocks[n,data]
WriteLine (file, str(write))
next data
next n
CloseFile(file)



This is what the text file looks like .. The rems don't get written to the file .
1 // Block number
2 // Texture number
-15 // X pos
2 // Y pos
0 //Z pos
2 // Block number
2 // Texture number
-15 // X pos
2 // Y pos
0 //Z pos
3 // Block number
2 // Texture number
-15 // X pos
2 // Y pos
0 //Z pos

Help ............

Lance
Markus
Valued Member
19
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 10th Feb 2018 19:05 Edited at: 10th Feb 2018 19:47
maybe you can use .save .load
see below JSON
https://www.appgamekit.com/documentation/guides/12_array_changes.htm

AGK (Steam) V2017.12.12 : Windows 10 Pro 64 Bit : AMD (17.12.1) Radeon R7 265 : Mac mini OS High Sierra (10.13)
greycheek
8
Years of Service
User Offline
Joined: 13th Mar 2016
Location:
Posted: 11th Feb 2018 16:11
Why not try ReadInteger() and WriteInteger() instead?
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 12th Feb 2018 03:34 Edited at: 12th Feb 2018 03:44
An old method is as follows


but the json method above is much better if your familiar with json files
fubar
Lance
20
Years of Service
User Offline
Joined: 22nd Jul 2003
Location: Third planet from Sun
Posted: 13th Feb 2018 00:10


fubarpk :

Thanks , got me going in the right direction ..
Lance

Login to post a reply

Server time is: 2024-03-29 08:48:37
Your offset time is: 2024-03-29 08:48:37