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. 68k Calculator Basic => TI-BASIC
Author Message
v0dKA


Newbie


Joined: 04 Mar 2006
Posts: 11

Posted: 20 Sep 2006 12:08:59 am    Post subject:

I'm trying to write a little BASIC program on my TI-89. Its purpose is to quiz my memorization of atomic masses (of the elements on the periodic table). I did most of the initialization routine, and I did not even write the actual quiz part of my program yet. However, I'm getting an error when I'm trying to run just what I have so far. I simply get an error on the home screen that says: "Argument must be a variable name".

What does this error mean?

When I press GO TO, it takes me to the line that I highlighted using ////// below:


Code:
atomic()
Prgm

ClrIO
Disp "Initializing elements..."
{1.01,12.01,14.01,16,19}->weights
{"H","C","N","O","F"}->elems

Disp "Mixing order..."

Local tmpelems:elems->tmpelems
Local tmpwts:weights->tmpwts

Local tmplist,tmplist2

Local i,j,k,rnd,dimquiz,dimtemp,qzelems,qzwts:{0}->qzelems:{0}->qzwts

For i,1,dim(elems)
rand(dim(tmpelems))->rnd
dim(qzelems)->dimquiz


tmpelems(rnd)->qzelems(dimquiz+1)
tmpwts(rnd)->qzwts(dimquiz+1)   ///////////////////// GO TO brings me to the beginning of this line

{0}->tmplist:{0}->tmplist2
dim(tmpelems)->dimtemp
1->j:1->k
While jœdimtemp
If j=rnd Then
j+1->j
Else
tmpelems(j)->tmplist(k)
tmpwts(j)->tmplist2(k)
EndIf
j+1->j
k+1->k
EndWhile
tmplist->tmpelems
tmplist2->tmpwts

EndFor

Disp tmpelems,tmpwts


EndPrgm


So, what might be the cause of this error?
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 20 Sep 2006 04:08:56 pm    Post subject:

You use [] brackets to select elements out of a list, not () parentheses.

Also, the traditional way to mix up the order of the elements is the following:


Code:
Local rlist
seq(rand(),i,1,dim(elems)) -> rlist
SortA rlist, elems, weights


If you have more properties of the elements, just add their corresponding lists to the SortA statement, separated by commas.


Last edited by Guest on 20 Sep 2006 04:52:43 pm; edited 1 time in total
Back to top
v0dKA


Newbie


Joined: 04 Mar 2006
Posts: 11

Posted: 23 Sep 2006 11:40:54 pm    Post subject:

I'm sorry I'm responding so late, but thanks for the help. And thanks for that awesome three-line list randomizing code! That was pretty much the only thing my program did so far, except in a hundred lines instead of three!
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