Something like arrays possible?
8 posts
• Page 1 of 1
Something like arrays possible?
Hi! I'd like to make a script to convert an array of predetermined values to inputs.
I'd like to know if there are any ways to read a data structure like an array so I can choose the correct movement from there. I didn't find any array data types in the documentation however. Is it possible to do it in any other way like accessing a specific file on the microSD card and read values from there?
I'd like to know if there are any ways to read a data structure like an array so I can choose the correct movement from there. I didn't find any array data types in the documentation however. Is it possible to do it in any other way like accessing a specific file on the microSD card and read values from there?
Last edited by Yuri-chan on Fri Oct 02, 2020 5:18 pm, edited 1 time in total.
-
Yuri-chan - Staff Sergeant
- Posts: 10
- Joined: Sun Jun 28, 2020 3:57 pm
Re: Something like arrays possible?
Array example: https://www.consoletuner.com/wiki/index ... remapper&s[]=array
No, you can't read custom file format files from the sd-card by a script.
No, you can't read custom file format files from the sd-card by a script.
-
Scachi - Brigadier General
- Posts: 3044
- Joined: Wed May 11, 2016 6:25 am
- Location: Germany
Re: Something like arrays possible?
Thanks for your fast reply and the info about the arrays!
Is it possible to also do two-dimensional arrays like [100][100] for example?
Is the size of the arrays limited somewhat? I'd need a rather large one, so accessing an external file would definitely be the better solution to save memory.
Is it possible to also do two-dimensional arrays like [100][100] for example?
Is the size of the arrays limited somewhat? I'd need a rather large one, so accessing an external file would definitely be the better solution to save memory.
Last edited by Yuri-chan on Fri Oct 02, 2020 5:20 pm, edited 2 times in total.
-
Yuri-chan - Staff Sergeant
- Posts: 10
- Joined: Sun Jun 28, 2020 3:57 pm
Re: Something like arrays possible?
You have to test which array size the T2 is able to handle.
A .gpc script can not read custom files from a sd-card.
When you have a computer nearby you can try use GTuner IV computer vision, to have access to python, to read files from your harddisk and send data to the .gpc script.
viewtopic.php?f=15&t=15147
A .gpc script can not read custom files from a sd-card.
When you have a computer nearby you can try use GTuner IV computer vision, to have access to python, to read files from your harddisk and send data to the .gpc script.
viewtopic.php?f=15&t=15147
-
Scachi - Brigadier General
- Posts: 3044
- Joined: Wed May 11, 2016 6:25 am
- Location: Germany
Re: Something like arrays possible?
Thanks for your reply! Since I run a Mac, the Windows-only solution with Python is out of the question for me, even if I have my computer nearby when doing this. I still thank you for bringing it up, as it's definitely a potential solution.
I have the T2 ordered already but it didn't arrive yet, so I'm preparing all this in theory to get to it faster when it arrives later this week. I haven't found any information about the memory specs of it though, so I don't know if the 58 kilobytes data + the additional code to do the actual moves would fit a combo slot on the T2.
I'd like to keep the workarounds to a minimum, so I really hope that the data will fit into the T2's RAM.
I have the T2 ordered already but it didn't arrive yet, so I'm preparing all this in theory to get to it faster when it arrives later this week. I haven't found any information about the memory specs of it though, so I don't know if the 58 kilobytes data + the additional code to do the actual moves would fit a combo slot on the T2.
I'd like to keep the workarounds to a minimum, so I really hope that the data will fit into the T2's RAM.
Last edited by Yuri-chan on Fri Oct 02, 2020 5:21 pm, edited 1 time in total.
-
Yuri-chan - Staff Sergeant
- Posts: 10
- Joined: Sun Jun 28, 2020 3:57 pm
Re: Something like arrays possible?
When you need to split your script because of its memory usage you can use the function script_load to load the next script into the same slot, to only use one slot while using multiple scripts:
https://www.consoletuner.com/wiki/index ... cript_load
Computer Vision is not windows only anymore I think:
viewtopic.php?f=15&t=15477
https://www.consoletuner.com/wiki/index ... cript_load
Computer Vision is not windows only anymore I think:
viewtopic.php?f=15&t=15477
-
Scachi - Brigadier General
- Posts: 3044
- Joined: Wed May 11, 2016 6:25 am
- Location: Germany
Re: Something like arrays possible?
Will the second script just start after being loaded by the first script or will the user have to do something before the next part starts?
I'll also look into the Python solution, thanks for linking me to this thread. However, I cannot go beyond Mac OS X 10.13 on my machine, so I will have to see if that will work for me.
I'll also look into the Python solution, thanks for linking me to this thread. However, I cannot go beyond Mac OS X 10.13 on my machine, so I will have to see if that will work for me.
Last edited by Yuri-chan on Fri Oct 02, 2020 5:23 pm, edited 1 time in total.
-
Yuri-chan - Staff Sergeant
- Posts: 10
- Joined: Sun Jun 28, 2020 3:57 pm
Re: Something like arrays possible?
When you load the next script, it is like switching slots, all information is lost.
You can't pass variables directly between scripts. But you can write information to the permanent memory from one script, and read it back from the next script. pmem_load() , pmem_read(), pmem_save(), pmem_write()
The loading of the next script is up to you. You can trigger it by code directly or have the user to press some button combination or whatever you are able to code.
You can't pass variables directly between scripts. But you can write information to the permanent memory from one script, and read it back from the next script. pmem_load() , pmem_read(), pmem_save(), pmem_write()
The loading of the next script is up to you. You can trigger it by code directly or have the user to press some button combination or whatever you are able to code.
-
Scachi - Brigadier General
- Posts: 3044
- Joined: Wed May 11, 2016 6:25 am
- Location: Germany
8 posts
• Page 1 of 1
Return to GPC2 Script Programming
Who is online
Users browsing this forum: Google [Bot] and 198 guests