Code:
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"->Str1

how would i make arrow keys choose one specific letter from this in ti basic???
⠀⠀⠀⠀⠀⠀⠀⡀⣀⣠⣤⣀⣤⣄⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣠⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣷⣴⡄⠀⠀⠀⠀
⠀⢀⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣄⠀⠀
⢀⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀
⣸⣿⣿⣿⣿⣿⣿⢿⠏⠁⠀⠀⠀⠀⠀⢿⣿⣿⣿⣿⣿⣿⣿⡀
⢻⣿⣿⣿⣿⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⡇
⠀⠙⠻⠻⠿⠋⠁⠀⠀⠀⠀⠀⠀⠀⢀⣶⣿⣿⣿⣿⣿⣿⡿⠁
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⣿⣿⣿⣿⣿⣿⠃⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⡿⠟⠁⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿⣿⣿⣿⣿⣿⣿⣿⠷⠁⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⢀⣽⣿⣿⣿⣿⣿⣿⡿⠍⠁⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⣿⣿⣿⠟⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⡿⣿⡿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⣴⣶⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⣴⣿⣿⣿⣿⣿⣿⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⢿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠛⣿⣿⣿⣿⣿⣿⠗⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠈⠙⠛⠛⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀

Code:
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"->Str1
1->A
ClrHome
Repeat G=105
   Output(1,1,sub(Str1,A,1
   Repeat G=105 or G=24 or G=26
      getKey->G
   End
   If G=24 and A>1
   A-1->A
   If G=26 and A<length(Str1
   A+1->A
End
sub(Str1,A,1
Disp Ans


The selected character is returned as a one-character string in Ans.
Variable A keeps track of which character in the string is being selected.
Left and right arrow keys (getKey is 24 for left and 26 for right) allow A to change withing the range of 1 to the length of Str1.
The selected character is shown on screen.
Pressing Enter (getKey is 105) exits the loop, and the selected character is put into Ans and displayed.

---------Edit------------

Two bytes shorter, doesn't use G, but Str1 is limited to less than 105 characters long:

Code:
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"->Str1
1->A
ClrHome
Repeat Ans=105
   Output(1,1,sub(Str1,A,1
   Repeat max(Ans={105,24,26
      getKey
   End
   If Ans!=105
   A-(Ans=24 and A>1)+(Ans=26 and A<length(Str1->A
End
sub(Str1,A,1
Disp Ans


-----------Edit 2-------------------

Uses no Variables, just returns Ans. 3 bytes larger than original, but no limits on length of Str1.


Code:
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"->Str1
1
ClrHome
Repeat 105=imag(Ans
   Output(1,1,sub(Str1,real(Ans),1
   real(Ans)+[i]getKey
   [i]imag(Ans)+real(Ans)-(imag(Ans)=24 and real(Ans)>1)+(imag(Ans)=26 and real(Ans)<length(Str1
End
sub(Str1,real(Ans),1
Disp Ans


-----------Edit 3-------------------

Shaved off 11 bytes. This is the smallest version, and still does not modify any variables.


Code:
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"->Str1
1
ClrHome
Repeat 105=imag(Ans
   Output(1,1,sub(Str1,real(Ans),1
   [i]getKey+real(Ans)-(imag(Ans)=24 and real(Ans)>1)+(imag(Ans)=26 and real(Ans)<length(Str1
End
sub(Str1,real(Ans),1
Disp Ans
  
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