This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's TI-BASIC subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. TI-Basic => TI-BASIC
United-TI Archives -> TI-Basic
 
    » Goto page 1, 2, 3 ... 11, 12, 13  Next
» View previous topic :: View next topic  
Author Message
Arcane Wizard
`semi-hippie`


Super Elite (Last Title)


Joined: 02 Jun 2003
Posts: 8993

Posted: 03 Jul 2003 04:25:20 am    Post subject:

I'll start of with a menu routine, you put the title and options in Ans as a string and seperate them with "," and also end the string with "," before calling the routine. It returns the option that was chosen by the user in X.

"TITLE,OPTION1,OPTION2,OPTION3,OPTION4,OPTION5,OPTION6,"

ClrDraw
Ans->Str9 //put menu data in Str9
1->Dim(L1) //set up L1
1->X //prepare X
instring(str9,",")->L1(1) //get position of first "," and put it in L1(1
Ans->B //put same position in B
length(Str9)->A //length of Str9 in A

Repeat B=A //repeat until last "," has been stored
instring(sub(Str9,B+1,A-B),",")->L1(X+1 //store position of "," relative to last ","
X+1->X //next ","
sum(L1,1,X)->B //total of all "," positions from beginning of menu string, used as offset for finding next ","
End

Text(1,20,sub(Str9,1,L1(1)-1) //display title
For(X,1,Dim(L1)-1) //loop through options
Text(10+7(X-1),20,sub(Str9,sum(L1,1,X)+1,L1(X+1)-1)) //and display them
End

10+7(X-2)->A //max y position of cursor, 10+7*number of options-1
10->X //cursor position
Repeat B //repeat until 2nd or clear is pressed
getKey->K
If K:Text(X,10," ") //erase left cursor, 4 spaces
If K:Text(X,81," ") //erase right cursor, 4 spaces
X+7((K=34 and X<A)-(K=25 and X>10))->X //move cursor if it's more than 10 and less than max y position of cursor
Text(X,10,"{") //display left cursor
Text(X,81,"}") //display right cursor
(K=21 or K=45)->B //clear or 2nd pressed in B
End

(X-10)/7+1->X //option chosen in X


Last edited by Guest on 03 Jul 2003 01:12:39 pm; edited 1 time in total
Back to top
JesusFreak
JesusFreak


Active Member


Joined: 17 Jun 2003
Posts: 537

Posted: 03 Jul 2003 12:14:51 pm    Post subject:

i followed this just like you worte and got itt to work some what 2 things:
1) the erase doesn't work maybe i did it wronge but after checking a few times i have the same code as you did.
2) so how does he select the option, if he hits enter on optin1 how does he go to Lbl 1( i know they are bad but i still use them)??
Back to top
Arcane Wizard
`semi-hippie`


Super Elite (Last Title)


Joined: 02 Jun 2003
Posts: 8993

Posted: 03 Jul 2003 01:10:21 pm    Post subject:

Oh, sorry for that, I forgot to add that it should be 4 spaces and to change the X coordinate for the 2nd cursor, it should be:
Text(X,10," " //4 spaces
Text(X,81," " //4 spaces

And here's an example of in game code:

GAME:
ClrDraw
AxesOff
Text(1,1,"THIS IS A GAME"
Pause
"MENU,NEW GAME,LOAD GAME,QUIT,"
prgmMENU //returns option chosen in X
If X=1:Goto NG
If X=2:Goto LG
If X=3:Goto QG
Lbl NG
ClrDraw
Text(1,1,"THIS IS A NEW GAME"
Pause
Goto MM
Lbl LG
ClrDraw
Text(1,1,"LOADING GAME..."
Pause
Goto MM
Lbl QG
ClrDraw
AxesOn
ClrHome

Menu:
//insert my menu routine here


Last edited by Guest on 03 Jul 2003 01:11:43 pm; edited 1 time in total
Back to top
Darth Android
DragonOS Dev Team


Bandwidth Hog


Joined: 31 May 2003
Posts: 2104

Posted: 03 Jul 2003 01:44:59 pm    Post subject:

Data Storage and Recall:

"NAME1::DATA1::NAME2::DATA2::->Str0
"NAME2->Str1

actuall program:


Code:
length(Str1)+2+inString(Str0,Str1+"::"->A
if A=2+length(Str1
Then
DelVar AReturn
End
sub(Str0,A,inString(Str0,"::",A)-A->Str1


Last edited by Guest on 03 Jul 2003 01:45:36 pm; edited 1 time in total
Back to top
Adm.Wiggin
aka Tianon


Know-It-All


Joined: 02 Jun 2003
Posts: 1874

Posted: 03 Jul 2003 02:23:38 pm    Post subject:

ya, in case we want to use commas...
Back to top
Arcane Wizard
`semi-hippie`


Super Elite (Last Title)


Joined: 02 Jun 2003
Posts: 8993

Posted: 03 Jul 2003 02:39:39 pm    Post subject:

I have never heard, seen or programmed a menu option with a "," in it.
Back to top
JesusFreak
JesusFreak


Active Member


Joined: 17 Jun 2003
Posts: 537

Posted: 03 Jul 2003 10:56:10 pm    Post subject:

is it okay if i use you prgm, if so do i need to put your name down for making it.
Back to top
Arcane Wizard
`semi-hippie`


Super Elite (Last Title)


Joined: 02 Jun 2003
Posts: 8993

Posted: 04 Jul 2003 11:34:30 am    Post subject:

Jup, that's why I posted it here, so people could use it in their programs. You dont have to add me to the credits or anything unless you feel you couldn't have written the code yourself, but it's up to you. I won't sue you or something, a 'thanks to' would be more than I expect.
Back to top
JesusFreak
JesusFreak


Active Member


Joined: 17 Jun 2003
Posts: 537

Posted: 04 Jul 2003 12:16:50 pm    Post subject:

I will add your name ( a thanks to) b/c i didn't write the code so someone else did, and i can't take the credit for it, also is there a easier way to do that code multi. times with out repeating it??
Back to top
Arcane Wizard
`semi-hippie`


Super Elite (Last Title)


Joined: 02 Jun 2003
Posts: 8993

Posted: 04 Jul 2003 12:32:52 pm    Post subject:

You could add it as a subroutine:

prgmGAME:
If Ø=1:Goto F1
Goto MM
Lbl F1
//put my menu routine here
Return
//rest of the game:
Lbl MM
1->Ø
"MENUNAME,OPT1,OPT2,OPT3,"
prgmGAME


Last edited by Guest on 04 Jul 2003 12:34:44 pm; edited 1 time in total
Back to top
JesusFreak
JesusFreak


Active Member


Joined: 17 Jun 2003
Posts: 537

Posted: 04 Jul 2003 12:40:03 pm    Post subject:

wow how did you know my game name?
Back to top
Arcane Wizard
`semi-hippie`


Super Elite (Last Title)


Joined: 02 Jun 2003
Posts: 8993

Posted: 04 Jul 2003 12:40:54 pm    Post subject:

I'm a wizard. /joke

Last edited by Guest on 04 Jul 2003 12:41:02 pm; edited 1 time in total
Back to top
JesusFreak
JesusFreak


Active Member


Joined: 17 Jun 2003
Posts: 537

Posted: 04 Jul 2003 12:45:18 pm    Post subject:

no wonder you know so much!
Back to top
Arcane Wizard
`semi-hippie`


Super Elite (Last Title)


Joined: 02 Jun 2003
Posts: 8993

Posted: 04 Jul 2003 12:49:26 pm    Post subject:

Anyway, if you wouldn't use it as a subroutine you would have to put the routine in another program like in the previous example and call that program, if you don't do that there's no point to the routine because if you put it in every time you have a menu it takes much more memory than just coding the menu and the whole point of the routine is to save memory.
Back to top
Darth Android
DragonOS Dev Team


Bandwidth Hog


Joined: 31 May 2003
Posts: 2104

Posted: 05 Jul 2003 04:48:43 pm    Post subject:

my routine had nothing to do with Arcane Wizard's (Did u know that?)
Back to top
JesusFreak
JesusFreak


Active Member


Joined: 17 Jun 2003
Posts: 537

Posted: 05 Jul 2003 04:55:59 pm    Post subject:

yes, you can you put the thing on here?
Back to top
Darth Android
DragonOS Dev Team


Bandwidth Hog


Joined: 31 May 2003
Posts: 2104

Posted: 05 Jul 2003 06:22:28 pm    Post subject:

what is the "thing" u want me to put on here?
Back to top
JesusFreak
JesusFreak


Active Member


Joined: 17 Jun 2003
Posts: 537

Posted: 05 Jul 2003 10:35:24 pm    Post subject:

sry, your routine?
Back to top
JesusFreak
JesusFreak


Active Member


Joined: 17 Jun 2003
Posts: 537

Posted: 05 Jul 2003 11:06:28 pm    Post subject:

You could make one, try splitting code from menus you like and putting it together (you need to know the code well for this) or just start from scratch .
Look at other menus trick they did.
Back to top
Darth Android
DragonOS Dev Team


Bandwidth Hog


Joined: 31 May 2003
Posts: 2104

Posted: 06 Jul 2003 01:11:49 pm    Post subject:

what do u want it to look like?
Back to top
Display posts from previous:   
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
    » Goto page 1, 2, 3 ... 11, 12, 13  Next
» View previous topic :: View next topic  
Page 1 of 13 » All times are UTC - 5 Hours

 

Advertisement