[Closed] How to Read/SAve File contents
it’s because you can have many presets stored in the scene wich means many variables, because i treat it like files, you can store many presets in many files, so i’m storing many files in many variables, don’t know if i’m explaining fine.
but to acces those variables, i don’t know the name, so i can get the name of the variable because the user tells me the name when he selects the preset in the UI, that’s cause the variable name is inside another variable
You can have an array with all the presets inside a variable and use the UI to determine the index of the selected preset inside the array.
I thought about that, but it’s a lot of work because if i delete a preset then i’ll need to readjust all the other indexes…maybe is an easy way to do that now that i’m thinking about it…i’ll think a bit more, anyway i found something strange:
fn count = (
BSpepe = #(1,2,3,4,5,6,7,8,9)
po="BS"
pa="pepe"
pepa = (po+pa)
pepin = 0
execute ("pepin ="+pepa+".count")
print pepin
)
count()
this works, it returns 9 as the value of pepin, also i tried with one of my global variables and it works too.
now this:
RPsavePrefix = "BS"
RlaySelName = "0BASE" -- 0BASE is the name of the selection inside a combobox, this with BS will be the name of one of my variables
local bufel2 = 0
RPsaveName = (RPsavePrefix + RlaySelName)
execute ("bufel2 ="+ RPsaveName+".count")
print bufel2
well here the value of bufel2 is still 0, it’s not modifying the bufel variable, i don’t understand anything, i tried to do this in the other piece of code, i mean with a global variable, and everything was fine…i don’t understand i’m missing something
I think i understand now.
If i use the command execute i’ll need to specify in what rollout is my variable to copy my global variable into it, that was the reason because my variable was not modified i think, testing now
Positive result.
Now i have every render preset stored inside a persistent global variable.
I thought about the variable with various presets, but i think that reorder the indexes when i delete various presets at once can be hard work, instead this way i have every preset separated and i can do whatever i want because i know it’s name even when i don’t know it’s name you understand me.
Thanks to the both of you, denisT and Marco!
I learned a lot with you, really.
I hope i’ll continue learning from you in other posts i’ll post as soon as i have some doubt (or i can resolve someone’s duobt).
I found great techers in this forum, really.
Thanks again!