http://tifreakware.net/forum/viewtopic.php?f=87&t=131

http://www.cemetech.net/programs/index.php?mode=file&path=/prizm/SampleMenuPrizm.zip

I remember Sarah saying something about creating a item's system menu, and so after learning how lists work on the Prizm, I threw this sample program together. There are also 2 additional lists in there that if you change them to be the names of the first 2 lists, it will show how it works without being >7 items shown.

Feel free to ask questions if you don't understand any of the code.


Code:
'ProgramMode:RUN
ClrText
{1,2,3,4,5,6,7,8,9,10,11,12}->List 1
{5,6,1,2,0,5,7,3,5,0,0,5}->List 2
{1,2,5,6}->List 3
{5,5,5,5}->List 4
"POTIONETHER BREAD MUTTONWATER RUM   SWORD SHIELDBOOTS CAP   SHIRT PANTS "->Str 1
1->A
1->B
1->W
Dim List 1->C
While W=1
If List 1[B]>0
Then
Locate 3,1,StrMid(Str 1,(B*6)-5,6)
Locate 12,1,"  "
Locate 12,1,List 2[B]
IfEnd
If C>1
Then
If List 1[B+1]>0
Then
Locate 3,2,StrMid(Str 1,((B+1)*6)-5,6)
Locate 12,2,"  "
Locate 12,2,List 2[B+1]
IfEnd
IfEnd
If C>2
Then
If List 1[B+2]>0
Then
Locate 3,3,StrMid(Str 1,((B+2)*6)-5,6)
Locate 12,3,"  "
Locate 12,3,List 2[B+2]
IfEnd
IfEnd
If C>3
Then
If List 1[B+3]>0
Then
Locate 3,4,StrMid(Str 1,((B+3)*6)-5,6)
Locate 12,4,"  "
Locate 12,4,List 2[B+3]
IfEnd
IfEnd
If C>4
Then
If List 1[B+4]>0
Then
Locate 3,5,StrMid(Str 1,((B+4)*6)-5,6)
Locate 12,5,"  "
Locate 12,5,List 2[B+4]
IfEnd
IfEnd
If C>5
Then
If List 1[B+5]>0
Then
Locate 3,6,StrMid(Str 1,((B+5)*6)-5,6)
Locate 12,6,"  "
Locate 12,6,List 2[B+5]
IfEnd
IfEnd
If C>6
Then
If List 1[B+6]>0
Then
Locate 3,7,StrMid(Str 1,((B+6)*6)-5,6)
Locate 12,7,"  "
Locate 12,7,List 2[B+6]
IfEnd
IfEnd
2->W

While W=2
Cyan Locate 1,A,">"
Getkey->K
If K
Then
Locate 1,A," "
IfEnd
If K=28
Then
If A=1 And B>1
Then
B-1->B
1->W
IfEnd
If A>1
Then
A-1->A
IfEnd
IfEnd
If K=37
Then
If A=7 And B+6<Dim List 1
Then
B+1->B
1->W
IfEnd
If A<7 And A<C
Then
A+1->A
IfEnd
IfEnd

WhileEnd
WhileEnd
tifreak8x wrote:
http://tifreakware.net/forum/viewtopic.php?f=87&t=131

http://www.cemetech.net/programs/index.php?mode=file&path=/prizm/SampleMenuPrizm.zip

I remember Sarah saying something about creating a item's system menu, and so after learning how lists work on the Prizm, I threw this sample program together. There are also 2 additional lists in there that if you change them to be the names of the first 2 lists, it will show how it works without being >7 items shown.

Feel free to ask questions if you don't understand any of the code.


Code:
'ProgramMode:RUN
ClrText
{1,2,3,4,5,6,7,8,9,10,11,12}->List 1
{5,6,1,2,0,5,7,3,5,0,0,5}->List 2
{1,2,5,6}->List 3
{5,5,5,5}->List 4
"POTIONETHER BREAD MUTTONWATER RUM   SWORD SHIELDBOOTS CAP   SHIRT PANTS "->Str 1
1->A
1->B
1->W
Dim List 1->C
While W=1
If List 1[B]>0
Then
Locate 3,1,StrMid(Str 1,(B*6)-5,6)
Locate 12,1,"  "
Locate 12,1,List 2[B]
IfEnd
If C>1
Then
If List 1[B+1]>0
Then
Locate 3,2,StrMid(Str 1,((B+1)*6)-5,6)
Locate 12,2,"  "
Locate 12,2,List 2[B+1]
IfEnd
IfEnd
If C>2
Then
If List 1[B+2]>0
Then
Locate 3,3,StrMid(Str 1,((B+2)*6)-5,6)
Locate 12,3,"  "
Locate 12,3,List 2[B+2]
IfEnd
IfEnd
If C>3
Then
If List 1[B+3]>0
Then
Locate 3,4,StrMid(Str 1,((B+3)*6)-5,6)
Locate 12,4,"  "
Locate 12,4,List 2[B+3]
IfEnd
IfEnd
If C>4
Then
If List 1[B+4]>0
Then
Locate 3,5,StrMid(Str 1,((B+4)*6)-5,6)
Locate 12,5,"  "
Locate 12,5,List 2[B+4]
IfEnd
IfEnd
If C>5
Then
If List 1[B+5]>0
Then
Locate 3,6,StrMid(Str 1,((B+5)*6)-5,6)
Locate 12,6,"  "
Locate 12,6,List 2[B+5]
IfEnd
IfEnd
If C>6
Then
If List 1[B+6]>0
Then
Locate 3,7,StrMid(Str 1,((B+6)*6)-5,6)
Locate 12,7,"  "
Locate 12,7,List 2[B+6]
IfEnd
IfEnd
2->W

While W=2
Cyan Locate 1,A,">"
Getkey->K
If K
Then
Locate 1,A," "
IfEnd
If K=28
Then
If A=1 And B>1
Then
B-1->B
1->W
IfEnd
If A>1
Then
A-1->A
IfEnd
IfEnd
If K=37
Then
If A=7 And B+6<Dim List 1
Then
B+1->B
1->W
IfEnd
If A<7 And A<C
Then
A+1->A
IfEnd
IfEnd

WhileEnd
WhileEnd


I should really learn how to work with Str commands qq
That looks very straightforward to me, TIFreak8x, although I can't help but think that if you slightly relaxed your manic hatred for Goto and Lbl the code might be slightly shorter. Wink I don't mind if my menus are ever so slightly slower than my realtime game main loop, but that still looks quite optimal.
Just curious, how would the use of Lbl and Goto help in this instance?

And it's not manic hatred, it's knowing better than using those memory leaking commands Wink lol

Quote:
I should really learn how to work with Str commands qq


If it makes you feel any better, I didn't know much about Str commands until I messed with the Key2Text program. I simply read the owner's manual under the programming section and looked at code syntaxes until I found what I wanted that would work for me. Smile

I can happily go into detail on any of the above code that doesn't make sense to you.
tifreak8x wrote:
And it's not manic hatred, it's knowing better than using those memory leaking commands Wink 0x5


Agreed; with my response below I plan to make a program without Goto's!

Quote:
I can happily go into detail on any of the above code that doesn't make sense to you.
Can you, tifreak? I can follow some of it but not the color and string stuff.

For instance, does 'Cyan Locate 1,A,">"' place a Cyan >? I'm assuming so. I was curious how to do colors.
Sure.

For Locate, you use <COLOR> Locate Y,X,

As to the String, StrMid( is similar to sub( on the 83+ line.

StrMid(Str ,start,[end]

The end can be omitted and it will simply start at start and read to the end of the string. But you might as well look at StrLeft(, since it is just StrLeft(Str ,start
StrLeft() and StrRight() are a good idea, respectively, for replacing:

sub(Str,1,B -> StrMid(Str,1,B -> StrLeft(Str,B
sub(Str,A,length(Str)-A -> StrRight(Str,A
Due to a recent discovery on Sarah's part, it's been found that this program won't work with a string of over 255 characters. :/ I'll have to come up with a way around this.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement