Quote: "You can just overwrite the previous entries, you know"
You're right... IDK why I didn't think of that lol.
But that's not the problem. Here is the code I am now using:
sync on
sync rate 60
dim array$(10)
array$(0)="body {"
array$(1)="car"
array$(2)="box"
array$(3)="dandelion"
array$(4)="cabinet"
array$(5)="dragon"
array$(6)="racoon"
array$(7)="small"
array$(8)="actor"
array$(9)="zipper"
array$(10)="}"
canpress=1
do
cls
mystring$="actor"
print array count(array$())
for a=0 to array count(array$())
print array$(a)
next a
if returnkey()=1
if canpress=1
for b=0 to array count(array$())
if mystring$=array$(b)
array$(b)="actor v2"
endif
next b
canpress=0
endif
else
canpress=1
endif
print
print mystring$
sync
loop
The "}" symbol needs to stay at the bottom of the array at all times. But whenever I try adding a new element to the array inside the for loop, the whole thing freezes up and crashes. How else could I do this?
Basically, in the end, it will check if the string already exists in the array, if so it will change the string and add a "v2" after it. If the string isn't already there it adds it to the second to last spot in the array, the last spot being "}".
If I take the insert element out of the for loop and put it just after it, it works fine, but then it adds a new slot whether or not the string already existed in the array.
EDIT: I kind of figured how to do it. I need to set a variable so that if it doesn't find the string, then it sets it to one. If that variable is set to one then it inserts the string to the bottom.
Since it's a for loop, it will always end up being one, because only one of the passes through the for loop won't set it to 0. I guess I'll just have to inc the variable, and if it is less than the array index then it doesn't add it to the bottom.
Am I on the right track?