0 Members and 1 Guest are viewing this topic.
Matrix::[[1,2,1,2,1,2][2,0,0,0,0,1][1,0,0,0,0,2][2,1,2,1,2,1->[A]:ClrHome:For(A,1,4:For(B,1,6:Output(A,B,sub("=87",1+[A](A,B),1:End:EndList::{1,2,1,2,1,2,2,0,0,0,0,1,1,0,0,0,0,2,2,1,2,1,2,1->L1:ClrHome:For(A,1,4:For(B,1,6:Output(A,B,sub("=87",1+L1(6A-6+B),1:End:EndString::"8787877====88====778787->Str1:ClrHome:For(A,1,4:Output(A,B,sub(Str1,6A-5,6:EndOnce these are all ran you will see8787877====88====7787878
You know, I never thought about using sub( for displaying maps before. Nice thought. However, you're working a little too hard on displaying the string map. xPNevermind. ;P
Sure. The 1s,2s,and 0s are references to the different tiles in the map. The For loop(s) then display either a single character, or a group of 6 characters in the string example. Basically the For loops let the sub( put the characters on the screen. I'd recommend learning about the sub( command. It's very important when dealing with strings, which happens quite frequently. http://tibasicdev.wikidot.com/subEdit: Here's a more in depth explanation with the matrix::[[1,2,1,2,1,2][2,0,0,0,0,1][1,0,0,0,0,2][2,1,2,1,2,1->[A] //Store the tile data into [A]:ClrHome //Clear the homescreen:For(A,1,4 //This will loop 4 times, making A = 1, 2, 3, and 4 as it adds one to A each time:For(B,1,6 //This loops 6 times and changes B:Output(A,B,sub("=87",1+[A](A,B),1 //This displays a = if the corresponding spot in the matrix is zero, a 8 if the spot is one, and a 7 if the spot is two. It places it at a spot relying on the values of A and B. :End //Ending the For(B loop:End //End of the For(A loopDoes this help? Edit x2: Meishe, ninjas are quite frequent when 5 people are viewing a topic.
Yes, all the stats (ie health, mp, money, strength, etc) are variables, and as meishe said, Lists are a good option for that, but if you don't plan on making too big of an RPG, you can just use the built in A-Z variables, but then you wouldn't be able to easily save your stats (as in have a save feature available for your RPG). That's why you should look into using custom named lists, which are highly unlikely to get written over.
As stated before, lists are your best bet.All you'd need to set it up is something like this:{LEVEL,CURRENT_HP,MAX_HP,CURRENT_MP,MAX_MP,MONEY→LCHARe.g.{1,100,100,75,75,0→LCHAR(Note: LCHAR can be replaced with any other name, like LSTATS or just LA)From that point on, you can refer to a stat like this:Say, if you need to get their level...LCHAR(1) will get it. From there, say they leveled up just do LCHAR(1)+1→LCHAR(1)LCHAR(4) will get the current MP and you can see the pattern.If you want to save, you'll need a separate list for that or if there's only one save, then you can just leave the list as is.Lists are on the calc regardless of whether you're in a program or not so if you only have one save, then a new char will overwrite the original list, and continuing would just use the list as is.With multiple saves you'd do something like this:LCHAR→LSAVE1 (for the first slot)LCHAR→LSAVE2 (for the second, etc.)Loading is the opposite,LSAVE1→LCHARetc.Throughout the program, all you'll need to refer to is LCHAR for stats and such though and only mess with the save files to save or load.