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
Author Message
yugniht


Member


Joined: 29 May 2003
Posts: 167

Posted: 21 Jun 2003 08:28:02 pm    Post subject:

I'm making a Dstar game and I have already made the game. I've just about finished the level editor (on calculator). It stores the levels as matrices. My question is, what is the best way to have the program recognize the custom levels. For example, many asm programs save them as progs, and recognize that. I want to be able to start the game, choose custom levels, and be able to choose which one. Is there any way to do this without having the user do any work, i.e. editing a sub program or something.
Back to top
Darth Android
DragonOS Dev Team


Bandwidth Hog


Joined: 31 May 2003
Posts: 2104

Posted: 21 Jun 2003 09:32:05 pm    Post subject:

not in BASIC i believe...
Back to top
Spyderbyte


Advanced Member


Joined: 29 May 2003
Posts: 372

Posted: 21 Jun 2003 09:58:39 pm    Post subject:

Well for starters you could check to see if the dimensions of any of the matricies match.


ClrList L1
For(A,1,10
If dim(expr(sub("[A][B][C][D][E][F][G][H][I][J]",A,1)))={X,X}
1->L1(A
End

This should give you a list of which matricies match the dimensions of the level. By the way, you do need the closing parenthases (or however you spell it), and the string actually needs to have the matrix names pasted in from the menu.

For choosing I think you could have something like this:

Lbl 1
ClrHome
Output(1,2,"Custom Levels:"
0->C
For(B,1,9
For(A,3,7
C+1->C
Output(A,B,C
Output(A,B+1,":"
If L1(C )=1
Output(A,B+3,sub("[A][B][C][D][E][F][G][H][I][J]",C,1
If C<8
Disp "
End
End
Input " Level? ", A
If L1(A)=0
Goto 1

If you decide to use both of these, you may want to store the matrices into a string instead of typing it twice. What they do (If they both work, I only tested them mentally) is first make a list of which matricies have the right dimensions, and then only display the ones that do. The part about Disp " if C<8 is just there are 7 Displays, putting input at the bottom.

You could probably modify this to check a certain element and make the list that way, but I'm kinda tired right now.

Feel free to ask questions!

Spyderbyte


Last edited by Guest on 21 Jun 2003 09:59:18 pm; edited 1 time in total
Back to top
yugniht


Member


Joined: 29 May 2003
Posts: 167

Posted: 21 Jun 2003 10:42:01 pm    Post subject:

That's pretty good, but in the beginning, if you check the dim( of a matrice that isn't there, you get an ERR:undefined. Well, at least you do in VTI. I'll think about it, there might be a way around it. Thanks for the help so far.
Back to top
Spyderbyte


Advanced Member


Joined: 29 May 2003
Posts: 372

Posted: 21 Jun 2003 11:39:18 pm    Post subject:

Oops! I'll give that second idea some more thought.

Sorry about that!

Spyderbyte
Back to top
Arcane Wizard
`semi-hippie`


Super Elite (Last Title)


Joined: 02 Jun 2003
Posts: 8993

Posted: 22 Jun 2003 06:49:31 am    Post subject:

Maybe you could use a list to kep track of all the custom levels.

For example you allow a max of 10 custom levels:

game:
10->Dim(LCLVL) //avoid err:undefined with list
" "->Str1 //avoid undefined error for str1
For(X,1,10) //check which levels have been created
If LCLVL(X)
Str1+Sub("abcdefghij",X,1)->Str1 //add level to list
End

//display which levels are available so user can pick one:
For(X,1,length(Str1)
Disp sub(str1,x,1
End
Input "Which level ?",Str0
If Instring(Str0,Str1) //check if the chosen level exists, might have to swap str0 with str1, it has to check if str0 is in str1
Then
//load level, for example if str0 is "a" load level from matrix [A]
Else
//tell user he must pick a level from the list
End

map editor:
//make map, store it in matrix [A]
map_data->[A]
1->LCLVL(1


Last edited by Guest on 22 Jun 2003 06:51:25 am; edited 1 time in total
Back to top
yugniht


Member


Joined: 29 May 2003
Posts: 167

Posted: 22 Jun 2003 12:28:59 pm    Post subject:

I'm kind of shocked, because that is sort of what I thought of last night, after I logged off. When the user picked which matrix it would choose, I would store that number to a list. And when a user wanted to pick which one, I would display the list as possible choices. Thanks for all the help guys!
Back to top
Spyderbyte


Advanced Member


Joined: 29 May 2003
Posts: 372

Posted: 22 Jun 2003 01:34:46 pm    Post subject:

Um you're welcome, but wouldn't the list remain if the user changed one of the matricies? What if he/she needed it for something else?

Just a thought.

Spyderbyte
Back to top
yugniht


Member


Joined: 29 May 2003
Posts: 167

Posted: 22 Jun 2003 02:31:46 pm    Post subject:

a small problem compared to the big picture. I would rather the user edit a list instead of a program. what do ya think of it so far. If it shows up, the first pic is the editor, and the second pic is me playing the custom level.


Last edited by Guest on 23 Jun 2003 02:55:26 pm; edited 1 time in total
Back to top
Arcane Wizard
`semi-hippie`


Super Elite (Last Title)


Joined: 02 Jun 2003
Posts: 8993

Posted: 22 Jun 2003 06:31:24 pm    Post subject:

Well, you could always store the maps in a custom list. The game looks pretty fun.

Last edited by Guest on 22 Jun 2003 06:31:40 pm; edited 1 time in total
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
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are UTC - 5 Hours

 

Advertisement