EDIT: for some reason, the GMC's code thingy made the text all green. Weird.
Hey gang! Hope I'm posting in the right forum ![]()
I recently started working on a pokemon simulator. While this may mean nothing to you, here is my dilemna:
turn=1
i=0
repeat(2)
{
i+=1
f='C:\Users\Cheshire\Desktop\'+get_string('Team '+string(i)+' file location?','basic')+'.txt'
ff=file_text_open_read(f)
t=file_text_read_string(ff)
file_text_close(ff)
t=string_replace_all(t,'team[','team['+string(i)+',')
j=0
repeat(6)
{
j+=1
l=0
repeat(4)
{
l+=1
move[j,l]=''
}
}
j=0
repeat(6)
{
j+=1
l=0
repeat(4)
{
l+=1
t=string_replace(t,'move['+string(j)+','+string(l)+']','move['+string(i)+',move['+string(j)+','+string(l)+']]')
}
}
execute_string(t)
get_string(t,'')
}
dialogue=''
command=''
ncommand=0
This is meant to open up two different files (for the two different teams, I didn't want to just copy+paste the code and change some minor variables), and edit some of the text within, then execute it. Because the team files are formatted for individual teams, they use arrays that don't differentiate between team 1 and team 2, see below sample team file.
team[1]='Squirtle' team[2]='Charmander' team[3]='Bulbasaur' team[4]='' team[5]='' team[6]='' move[1,1]='Tail Whip' move[1,2]='Bubble' move[1,3]='Withdraw' move[1,4]='Scratch' move[2,1]='Scratch' move[2,2]='Growl' move[2,3]='Ember' move[2,4]='Smokescreen' move[3,1]='Tackle' move[3,2]='Growl' move[3,3]='Vine Whip' move[3,4]='Leach Seed' move[4,1]='' move[4,2]='' move[4,3]='' move[4,4]='' move[5,1]='' move[5,2]='' move[5,3]='' move[5,4]='' move[6,1]='' move[6,2]='' move[6,3]='' move[6,4]=''
The error I'm getting is this:
Error in code at line 1: team[1,1]='Squirtle' team[1,2]='Charmander' team[1,3]='Bulbasaur' team[1,4]='' team[1,5]='' team[1,6]='' move[1,move[1,1]]='Tail Whip' move[1,move[1,2]]='Bubble' move[1,move[1,3]]='Withdraw' move[1,move[1,4]]='Scratch' move[1,move[2,1]]='Scratch' move[1,move[2,2]]='Growl' move[1,move[2,3]]='Ember' move[1,move[2,4]]='Smokescreen' move[1,move[3,1]]='Tackle' move[1,move[3,2]]='Growl' move[1,move[3,3]]='Vine Whip' move[1,move[3,4]]='Leach Seed' move[1,move[4,1]]='' move[1,move[4,2]]='' move[1,move[4,3]]='' move[1,move[4,4]]='' move[1,move[5,1]]='' move[1,move[5,2]]='' move[1,move[5,3]]='' move[1,move[5,4]]='' move[1,move[6,1]]='' move[1,move[6,2]]='' move[1,move[6,3]]='' move[1,move[6,4]]='' ^ at position 113: Wrong type of array index
As you can see, all the correct code is getting replaced (this is the first team, the first iteration of i, and hence it's move[team,[move[pokemon,movename]] ), and it's ready to run, but I get the error :/
What am I doing wrong? I feel like it's something obvious.
I know I could be using for()s, but I prefer using repeat()s.



Find content
Male

