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  Next
» View previous topic :: View next topic  
Author Message
Phobia


Newbie


Joined: 06 Feb 2008
Posts: 20

Posted: 06 Apr 2009 12:31:04 pm    Post subject:

How can I let an user name lists for my game to save data?

I'm saying this because I have made 1/2 years ago a lovely Smile version of Pacman with 2 ghosts, lifes and map-editor included that is pretty fast and was made with levels in mind.

To spare the Pics and have "unlimited" maps the map-editor lets you compress and restore the map to a list.

The problem is that the list has a fixed name. I would like to prompt the user the name of the list so that he could create and restore his own maps without modifying the source code each time he wants to change map.


I would like a solution that required the less memory possible but anything that works will be great! Maybe Codex or one of those apps? I've always worked with TI-BASIC only so you'd have to guide me .... :P



I also thought of maps that end with a number in the name: PACM001,PACM002 so that after specifying a number the user could have access to the desired map and this would also make it easier to choose the next level but even so, I cannot choose a list with a string/int provided by the user, it must be hard-coded in the program and that's why I'm asking for help because hard-coding the map names makes a program big............. :(

Please answer quickly


Last edited by Guest on 06 Apr 2009 12:42:27 pm; edited 1 time in total
Back to top
JoeYoung


Advanced Member


Joined: 15 Nov 2008
Posts: 316

Posted: 06 Apr 2009 02:27:21 pm    Post subject:

use strings rather than lists. CelticIII makes the world go round.
Back to top
woodswolf


Advanced Newbie


Joined: 26 Feb 2009
Posts: 53

Posted: 06 Apr 2009 02:53:17 pm    Post subject:

The problems with strings is that, if some other game uses the same string, you lose every data. Lists can be named to your liking.

I encountered this problem a long time ago, it can only be done in ASM if I recall correctly
Back to top
elfprince13
Retired


Super Elite (Last Title)


Joined: 11 Apr 2005
Posts: 3500

Posted: 06 Apr 2009 03:16:53 pm    Post subject:

loading data from a named list is easy.
Quote:

Input "Name",Str1
expr("L"+Str1)->L1 <-little list-name L

saving data to a named list could be problematic, since if I remember correctly you can only use expr() for statements that return a value, and as far as I know there are no ways to store to a list by name that return a value.


Last edited by Guest on 11 Jul 2010 05:55:40 pm; edited 1 time in total
Back to top
JoeYoung


Advanced Member


Joined: 15 Nov 2008
Posts: 316

Posted: 06 Apr 2009 04:32:47 pm    Post subject:

or, you can use even more Celtic commands to store to a program or appvar, and name it whatever the hell you want. it'll even store as many strings as you want.
Back to top
simplethinker
snjwffl


Active Member


Joined: 25 Jul 2006
Posts: 700

Posted: 06 Apr 2009 05:41:39 pm    Post subject:

You could use this program. Have the name of the desired list in Str0, then run prgmCLIST. It will create a list with that name (but will truncate if the name's length is >5) of length one, with its only element initialized to zero. This will overwrite a list with the same name if it exists.
[attachment=2634:CLIST.8XP]
Back to top
Phobia


Newbie


Joined: 06 Feb 2008
Posts: 20

Posted: 07 Apr 2009 03:42:15 am    Post subject:

What can I write in the AppVar? I would like to store lists inside it. Then using numbered lists: PACM001,PACM002.... after getting the number by the user I would go to the correct line. Can this be done?

About the other approach:Then I use a string to store the info in that list?
I mean this:
If I want the list PAC001 i do this in the main program?:


"PAC001"->Str0
pgrmCLIST
"Comment:save a number (X)
X->L"PAC001"

-----------------
I believe that it doesn't work like this.. :s
Back to top
Galandros


Active Member


Joined: 29 Aug 2008
Posts: 565

Posted: 07 Apr 2009 04:04:39 am    Post subject:

Phobia wrote:
"PAC001"->Str0
pgrmCLIST
"Comment:save a number (X)
X->L"PAC001"

-----------------
I believe that it doesn't work like this.. :s

Type:
X->LPAC001

You don't need those parentheses...
Back to top
Phobia


Newbie


Joined: 06 Feb 2008
Posts: 20

Posted: 07 Apr 2009 04:35:13 am    Post subject:

But that's if you already know the name of the list, imagine this:

X is an arbitrary number

Input "Name:",Str0
pgrmCLIST
X->LStr0(1

Is that what you mean?
Back to top
Galandros


Active Member


Joined: 29 Aug 2008
Posts: 565

Posted: 07 Apr 2009 05:04:09 am    Post subject:

Phobia wrote:
But that's if you already know the name of the list, imagine this:

X is an arbitrary number

Input "Name:",Str0
pgrmCLIST
X->LStr0(1

Is that what you mean?

you have to run:
Asm(pgrmCLIST
(find Asm( in the Catalog)

After that the list is already created with one element.
Then you have to write the data you need to the created list. (with the expr( trick?)


Last edited by Guest on 07 Apr 2009 05:05:14 am; edited 1 time in total
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 07 Apr 2009 09:36:04 am    Post subject:

prgmCLIST doesn't help: with TI-Basic, you can still only read from a list given by name. Either use something like Celtic to save data in appvars or whatnot, or save a list in Ans, output text asking the user to store Ans to NAME, and exit the program.
Back to top
Phobia


Newbie


Joined: 06 Feb 2008
Posts: 20

Posted: 07 Apr 2009 12:28:37 pm    Post subject:

So how do I use Celtic? Where can I find a guide?
Back to top
JoeYoung


Advanced Member


Joined: 15 Nov 2008
Posts: 316

Posted: 07 Apr 2009 02:04:55 pm    Post subject:

In the progress topic of the CelticIII subdivision of this forum, Iambian posted the newest version of Celtic, labled Celtic 3.09p. This has the application ad a comprehensive README explaining how to use it. If you know xLib, this won't be too much of a problem.
Back to top
Harrierfalcon
The Raptor of Calcs


Super Elite (Last Title)


Joined: 25 Oct 2006
Posts: 2535

Posted: 07 Apr 2009 04:22:45 pm    Post subject:

I would stick with CelticII for this particular purpose. It's significantly smaller and still has the functions you need.

Ask Weregoose for a link. Just read the readme, and make sure you don't do anything risky without backing up your programs.
Back to top
Iambian


Advanced Member


Joined: 13 Mar 2004
Posts: 423

Posted: 07 Apr 2009 05:09:05 pm    Post subject:

metagross111 wrote:
In the progress topic of the CelticIII subdivision of this forum, Iambian posted the newest version of Celtic, labled Celtic 3.09p. This has the application ad a comprehensive README explaining how to use it. If you know xLib, this won't be too much of a problem.


It's up to version 3.09q. That version fixes a couple of bugs. If you find more, let me know.
The .8xk file, the source used to build the app, the readme, and a few more informational documents are included in the .zip file.
...
If you want to save space, go with Celtic II. For something with more features for it (and if you intend on using xLIB graphics), you can go with Celtic III. The instructions for using it for the purpose I think you want to use it for will be for Celtic III, since that's the application I'm trying to push.

To store data to a appvar, you must first recognize that it will be structured similar to a "BASIC program". If you want to edit the appvar from the BASIC editor, you can convert it to a program type by using the command, assuming that the name of the file being used to store the data is "PACLEV"

Code:
det(0,"rowSwap(PACLEV",2)

To convert it back to an appvar, execute the same line of code again, except omitting the "rowSwap(" token.

If the file has not yet been created, you can do so by doing

Code:
det(0,"rowSwap(PACLEV",5)

To *add* lines of "code" to the appvar "PACLEV", assuming that Ans contains the list to be added,

Code:
det(6,"rowSwap(PACLEV",det(1,Ans),det(5,"rowSwap(PACLEV",0))

As an explanation, det(6...) is the linewrite function, the det(1...) command converts Ans (list) to a string so it can be stored into the file as a string (which can then be read out and expr'd to list format), and the det(5...) is being used to retrieve the number of lines that is currently in the program so that the entire command will append the next entry to the file.

Each line is its own entry, and as such, you can use that line number to identify which map you want to take out. For example, if you want to extract entry 1 and convert it to a list, do the following:

Code:
1->X
expr(det(5,"rowSwap(PACLEV",X))->L1

Which extracts the entry number denoted by X (in this case,1, to where X may be this up to the max number of entries you has in the file), and converts the extracted code to a list, which is then stored to L1.

...

Correct me if I'm wrong. If it doesn't work, let me know and I'll see where I (or the app) went wrong.


Last edited by Guest on 07 Apr 2009 05:15:52 pm; edited 1 time in total
Back to top
Phobia


Newbie


Joined: 06 Feb 2008
Posts: 20

Posted: 07 Apr 2009 05:48:37 pm    Post subject:

I really need the space so I guess I'll use CelticII, hope it works in the same way.


Hmmm :s I can't find CelticII for download, only the III, someone?


Thanks


Last edited by Guest on 07 Apr 2009 05:52:46 pm; edited 1 time in total
Back to top
Iambian


Advanced Member


Joined: 13 Mar 2004
Posts: 423

Posted: 07 Apr 2009 06:01:36 pm    Post subject:

Consider that the Celtic III app takes up very little RAM, since most of its functions are done directly from Flash.

If you're still not convinced... you can get working versions of Celtic II from projects that currently use it. Try visiting Omnimaga for the file, since I don't think that UTI's download section really works. I honestly don't know where else I've deposited the program >.<
Back to top
Weregoose
Authentic INTJ


Super Elite (Last Title)


Joined: 25 Nov 2004
Posts: 3976

Posted: 07 Apr 2009 06:08:03 pm    Post subject:

Heh. No one asked me for a link yet.

http://www.unitedti.org/downloads/[228]Celtic2c.zip


Last edited by Guest on 07 Apr 2009 06:08:54 pm; edited 1 time in total
Back to top
simplethinker
snjwffl


Active Member


Joined: 25 Jul 2006
Posts: 700

Posted: 07 Apr 2009 06:24:59 pm    Post subject:

DarkerLine wrote:
prgmCLIST doesn't help: with TI-Basic, you can still only read from a list given by name. Either use something like Celtic to save data in appvars or whatnot, or save a list in Ans, output text asking the user to store Ans to NAME, and exit the program.

That's a good point. I was thinking that you could access the elements with the expr("L"+Str0 thing, but I forgot you couldn't store elements with that trick.


Last edited by Guest on 11 Jul 2010 05:55:23 pm; edited 1 time in total
Back to top
Phobia


Newbie


Joined: 06 Feb 2008
Posts: 20

Posted: 08 Apr 2009 11:28:00 am    Post subject:

Is there a limit for the list you save in the program? My lists have almost 900bytes :s
In the README it says the limit is 255bytes or am I wrong?
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  Next
» View previous topic :: View next topic  
Page 1 of 2 » All times are UTC - 5 Hours

 

Advertisement