Heres the code you wanted Xorlak, I have it set up so that it checks for what the variable is out side of the #While loop so that I can animate a cursor....here's and example:
Uh oh, branches... (heh...)
It looks like the :itemselector branch gets hit if you press a wrong key, which is what you want. But I'm guessing the program ends because of something in that branch. You want nothing to happen when the user presses a wrong key, right? Here's a quick re-write that does that and eliminates that final branch:
#a$=""
#arrowY!=i!*10+269
#SetImageTransparent("/Menu/Left_Vertical_Arrow1.gif",200,arrowY!,20,25,0,0,255)
#a!=75
#done!=0
#while(done!=0)
{
#While(a$="")
{
#a!=a!+1
#If (a!=150)
{
#SetImage("/Menu/UnDescription.gif",200,arrowY!,20,25)
#SetImageTransparent("/Menu/Left_Vertical_Arrow2.gif",200,arrowY!,20,25,0,0,255)
}
#If (a!=300)
{
#SetImage("/Menu/UnDescription.gif",200,arrowY!,20,25)
#SetImageTransparent("/Menu/Left_Vertical_Arrow1.gif",200,arrowY!,20,25,0,0,255)
#a!=1
}
#Get(a$)
}
#If (a$=confirm$)
{
#done!=1
#RPGCode(itemuse[i!]$)
}
#If (a$="UP")
{
#done!=1
#If (i!=1){#Branch (:itemselector)}
#SetImage("/Menu/UnDescription.gif",200,arrowY!,20,25)
#i!=i!-1
#Branch (:itemselector)
}
#If (a$="DOWN")
{
#done!=1
#If (i!=Titem!){#Branch (:itemselector)}
#SetImage("/Menu/UnDescription.gif",200,arrowY!,20,25)
#i!=i!+1
#Branch (:itemselector)
}
#If (a$=back$)
{
#done!=1
#SetImage("/Menu/UnDescription.gif",200,280,260,226)
#SetImage("/Menu/UnDescription.gif",472,280,215,226)
#Kill(i!)
#Kill(Titem!)
#Kill(itemuse1$)
#Kill(itemuse2$)
#Kill(itemuse3$)
#Kill(itemuse4$)
#Kill(itemuse5$)
#Kill(itemuse6$)
#Kill(itemuse7$)
#Kill(itemuse8$)
#Kill(itemuse9$)
#Kill(itemuse10$)
#Kill(itemuse11$)
#Kill(itemuse12$)
#Kill(itemuse13$)
#Kill(itemuse14$)
#Kill(itemuse15$)
#Kill(itemuse16$)
#Kill(itemuse17$)
#Kill(itemuse18$)
#Kill(itemuse19$)
#Branch (:itemcheckstart)
}
Xorlak, i need a lot of help understanding the 2D array thing....its really confusing...
Hmmm, actually you want to do something like this, right?
#item["Potion"][char$]!=1
That'd require a 2D map rather than a 2D array, but I think I can modify Asimir's code to support that:
* Asimir's modified code
#method NumMapIn(arrayname$,arrayx$,arrayy$,arrayvalue!)
{
#command$ = "#" + arrayname$ + "." + arrayx$ + "." + arrayy$ + "! = arrayvalue!"
#rpgcode(command$)
#kill(arrayname$)
#kill(arrayx$)
#kill(arrayy$)
#kill(arrayvalue!)
#kill(command$)
}
#method NumMapOut(arrayname$,arrayx$,arrayy$,arrayvalue!)
{
#command$ = "#arrayvalue! = " + arrayname$ + "." + arrayx$ + "." + arrayy$ + "!"
#rpgcode(command$)
#kill(arrayname$)
#kill(arrayx$)
#kill(arrayy$)
#returnmethod(arrayvalue!)
#kill(arrayvalue!)
#kill(command$)
}
Now to do this:
#item["Potion"][char$]!=1
You would do:
#NumMapIn("item","Potion",char$,1)
And to get the value of that variable, you would do:
#NumMapOut("item","Potion",char$,dest!)
And dest! will be where to store the value of what you're looking for.