It's not too hard, you just have to use separate strings for each place, have a preset range of characters/letters in an array,then just weld them together into one string once the player confirms entry.
You will need to check each char both ways, though:
Code: Select all
//script0
var tx; tx=""
switch argument[0]
{
case 1: tx="A" ;break;
case 2: tx="B" ;break;
case 3: tx="C" ;break;
case 4: tx="D" ;break;
case 5: tx="E" ;break;
}
return tx
Code: Select all
//script1
var num; num=0
switch argument[0]
{
case "A": num=1 ;break;
case "B": num=2 ;break;
case "C": num=3 ;break;
case "D": num=4 ;break;
case "E": num=5 ;break;
}
return num
So, assuming each name entry started off with a default value, say "ABC", and the player had just set a record replacing the #5 hiscore slot:
Code: Select all
var sctx, s,txx; s=0
sctx=global.score_name[5]
repeat 3
{
s+=1
txx=string_char_at(sctx,s)
letter_num[s]=script1(txx)
}
Therefore, those arrays would read as :
letter_num[1]=1
letter_num[2]=2
letter_num[3]=3
Then, when saving...
Code: Select all
var txx,s; s=0;txx=""
repeat 3
{
s+=1
txx+=script0(letter_num[s])
}
global.score_name[5]=txx
Is the equivalent to
global.score_name[5]=""+"A"+"B"+"C", assuming each char was left the same.