Hey guys, I'm writing a program, which has a settings menu, which saves your choices to an archived custom list. However, if they have not used my program before, they will get an ERROR message, as it is an invalid variable. Ways to see if they have used program?
Store a unique number into a unique list that won't get overwritten. Then check for that number. Bingo!
jcgter777 wrote:
Store a unique number into a unique list that won't get overwritten. Then check for that number/list. Bingo!


I don't think that will work, since if I check for that list, and it doesn't exist, I will get an error message.
Use SetUpEditor MYLST. It will create the list as a 0-element list if it doesn't exist, unarchive it if it exists and is archived, or do nothing if it exists and is unarchived.

EDIT: You should probably also SetUpEditor (with no arguments) afterwards to restore the list editor to editing the default L₁-L₆.
Runer112 wrote:
Use SetUpEditor MYLST. It will create the list as a 0-element list if it doesn't exist, unarchive it if it exists and is archived, or do nothing if it exists and is unarchived.

EDIT: You should probably also SetUpEditor (with no arguments) afterwards to restore the list editor to editing the default L₁-L₆.


Reading the TI_Basic Dev Wikidot page about that command, it will get you an ERROR: ARCHIVE if it is archived, rather than unarchive it.
It will still work with the other conditions however.
rohanmodi wrote:
Runer112 wrote:
Use SetUpEditor MYLST. It will create the list as a 0-element list if it doesn't exist, unarchive it if it exists and is archived, or do nothing if it exists and is unarchived.

EDIT: You should probably also SetUpEditor (with no arguments) afterwards to restore the list editor to editing the default L₁-L₆.


Reading the TI_Basic Dev Wikidot page about that command, it will get you an ERROR: ARCHIVE if it is archived, rather than unarchive it.


Incorrect.

Quote:
they may be archived, or they may not even exist. You can deal with both of those individually: storing to the dimension will create the list if it didn't exist, and the UnArchive command will move the list to RAM if it wasn't there.

However, if you're wrong about the list, both of these commands will cause an error. If the list exists but is archived, storing to its dimension will cause an ERR:ARCHIVE error. If the list doesn't exist, unarchiving it will cause an ERR:UNDEFINED error. Sounds like a vicious circle.


The keyword here is both. It's referring to Archive and Unarchive.

Quote:
The SetUpEditor command allows you to deal with both of these problems at once. Say the program saves its data in LSAVE. Use the SetUpEditor command on it, and from then on you know that the list exists AND that it is unarchived.


As stated, the SetUpEditor command resolves this by unarchiving the list if it is, indeed, archived.
Alex wrote:
rohanmodi wrote:
Runer112 wrote:
Use SetUpEditor MYLST. It will create the list as a 0-element list if it doesn't exist, unarchive it if it exists and is archived, or do nothing if it exists and is unarchived.

EDIT: You should probably also SetUpEditor (with no arguments) afterwards to restore the list editor to editing the default L₁-L₆.


Reading the TI_Basic Dev Wikidot page about that command, it will get you an ERROR: ARCHIVE if it is archived, rather than unarchive it.


Incorrect.

Quote:
they may be archived, or they may not even exist. You can deal with both of those individually: storing to the dimension will create the list if it didn't exist, and the UnArchive command will move the list to RAM if it wasn't there.

However, if you're wrong about the list, both of these commands will cause an error. If the list exists but is archived, storing to its dimension will cause an ERR:ARCHIVE error. If the list doesn't exist, unarchiving it will cause an ERR:UNDEFINED error. Sounds like a vicious circle.


The keyword here is both. It's referring to Archive and Unarchive.

Quote:
The SetUpEditor command allows you to deal with both of these problems at once. Say the program saves its data in LSAVE. Use the SetUpEditor command on it, and from then on you know that the list exists AND that it is unarchived.


As stated, the SetUpEditor command resolves this by unarchiving the list if it is, indeed, archived.


Oh I misread that, thank you for pointing it out.
I keep getting a syntax error when using SetUpEditor in a program.

I'm using it like this:

SetUpEditor DECI,DEGR

Edit: I still get error even after separating the lists.
IIRC you can't put two together like that. And maybe you need the small L in front, but I don't think so.

Also, please refrain from double posting within 24 hours. There's an edit button for a reason Wink.

EDIT: I meant double posting before someone else posts Razz. Good effort, though.
Try adding the small L in front of the names. (Found in catalog)
It seems right, though.
jcgter777 wrote:
IIRC you can't put two together like that. And maybe you need the small L in front, but I don't think so.

Also, please refrain from double posting within 24 hours. There's an edit button for a reason Wink.

Try adding the small L in front of the names. (Found in catalog)
It seems right, though.


Edit: I tried the L, it does now work, thank you so much.
Strange... the small L is usually not needed, an you can put as many lists as you want to in the SetUpEditor. I can't think of why not using the L would error, I never use the L in SetUpEditor, so you might want to see if there was any extra white/blank spaces? (although that's probably not why...)
jcgter777 wrote:

EDIT: I meant double posting before someone else posts Razz. Good effort, though.
Try adding the small L in front of the names. (Found in catalog)


It is in the list menu... which is a lot easier to get to than finding it in the Catalog.
I know this is an old thread, but rather than creating a new one on the same topic, I decided to just post in this one.

I had an idea for making the program run a particular section of code once if it was the first time the program was used: putting a custom list in the program download. The list would hold a special number that would be altered after the program ran once.

However, I didn't know first, if was a good idea to add lists to the program download, and second, if it would make transferring the files to calc harder. Are these valid concerns, or is it just a preference?
Captain Calc wrote:
I know this is an old thread, but rather than creating a new one on the same topic, I decided to just post in this one.

I had an idea for making the program run a particular section of code once if it was the first time the program was used: putting a custom list in the program download. The list would hold a special number that would be altered after the program ran once.

However, I didn't know first, if was a good idea to add lists to the program download, and second, if it would make transferring the files to calc harder. Are these valid concerns, or is it just a preference?

I think it is not user friendly and you should instead create the list in your program, which can be done using the SetUpEditor command (see Runer112's post).
  
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