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
emile


Newbie


Joined: 30 Oct 2005
Posts: 3

Posted: 30 Oct 2005 05:46:04 am    Post subject:

Hello Everyone. I just ran across this forum as I googled my problem. Naturally I had to join such a great community! My problem is no doubt extremely simple for most of you. But for me it has been something I have spent a few lunches hunched over my TI89 with a furrowed brow.
The Program I am trying to make is to perform as a timer of sorts. I want to display in real time calculations based on the interval of time between keypresses. The key I decided to use for the keypress is 'enter'.
The problem I ran into is how to increment by one the variable to which I am storing getTime(). I would like to store the getTime() output into a new variable each time the 'enter' key is pressed. Here is relevant code so far, no laughing out loud please ;-)

----------------------------------------------------------------------------------------
Loop

getKey()-->k
While k=0
getkey()-->k
EndWhile

If k=49
Goto manual
EndIf

If k=50
Goto rt
EndIf

If k=264
DispHome
EndIf

EndLoop

//real time (here I used the 'diamond' C fo a comment)
Lbl rt
Loop

getKey()-->k
While k=0
getKey()-->k
EndWhile

If k=264
DispHome
EndIf

//if k = 'enter'
If k=13 Then
getTime()-->tme
EndIf


EndLoop
-----------------------------------------------------------------------------------
Ok, my problem is how to get getTime()-->tme to store its value into a new variable each time. like, tme1, tme2 tme3 etc.
that way I can display an average time between keypresses and various other calculations using each keypresses individual time. Since I do not know how many times the user will press enter, I want to increment by one the tme variable if possible. Any suggestions? Even if it is along the lines of RTFM lol. I am a N00b. Thank you.
-Emile Razz
Back to top
Darth Android
DragonOS Dev Team


Bandwidth Hog


Joined: 31 May 2003
Posts: 2104

Posted: 30 Oct 2005 08:35:02 am    Post subject:

I'm not fluent in TI-89 basic, but I'm pretty sure the 89 suppports lists.

All I can give you is TI-83 plus code, but perhaps it will help you.

You can have it store to a different element of the list each time like this:
1+dim(List name->dim(List name
getTime()->List name(dim(List name

Where List name is the name of the list.

What this code does:
The first line determines how many elements are in the list, adds one to it, then saves this to the size of the list to add one new element to the list.
The second line uses dim() to find out the last element (the one we just created) and then stores the output of getTime() into it.

Sorry I can't give you 89 code, but I hope this helps.

Also, it is bad practice to use the Goto command. It makes code hard to follow and can lead to memory leaks. 99% of the time they can be avoided (on the 83+, only when using menus can they not be avoided).

Good luck with your code.

P.S. I generally stereotype "Emile" as a female name. Does this mean we have a female programmer finally?


Last edited by Guest on 30 Oct 2005 08:37:04 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: 30 Oct 2005 12:33:20 pm    Post subject:

It supports lists, but getTime() already returns a list so you don't want to do that.

try this:

Code:
{}->hours
{}->mins
{}->secs
...
getTime()->timelist
timelist[1]->hours[dim(hours)+1]
timelist[2]->mins[dim(mins)+1]
timelist[3]->secs[dim(secs)+1]
. You could also try converting the output of getTime() into seconds:

Code:
{}->secs
getTime()->timelist
3600*timelist[1]+60*timelist[2]+timelist[3]->secs[dim(secs)+1]
Back to top
emile


Newbie


Joined: 30 Oct 2005
Posts: 3

Posted: 30 Oct 2005 03:38:40 pm    Post subject:

Done with the program. The help from Darth Android got me thinking and I was able to fix my error in thinking. Then after I finished I saw that Sir Robin suggested exactly what I arrived at. You guys are extremely helpful. Don't know what I'd do without you. Granted, I should have done some more in depth reading before posting even tho I didn't get flamed. Hope I can return the favor some day. O, I'm not a girl Darth, sorry haha. Damned parents are too french. Pronounced E-meal. Kind of like emilio estevez minus the io and the estevez. Nope, programming remains the realm of the male for the most part. And, for some reason, the realm of the male more likely to be an appreciator of Star Wars. Hmmmmm. haha. Thanks again. -Emile
Back to top
Rezek
Better Than You


Calc Guru


Joined: 24 Apr 2005
Posts: 1229

Posted: 30 Oct 2005 03:45:53 pm    Post subject:

If you want to thank us, stick around! We don't bite Wink
Back to top
Darth Android
DragonOS Dev Team


Bandwidth Hog


Joined: 31 May 2003
Posts: 2104

Posted: 30 Oct 2005 04:57:31 pm    Post subject:

No, but there are a few here that nibble every now and then :P

Anyways, glad we could help.
Back to top
Rezek
Better Than You


Calc Guru


Joined: 24 Apr 2005
Posts: 1229

Posted: 30 Oct 2005 05:22:46 pm    Post subject:

I've gotten bit a few times myself, it made me quite short with the offender Wink
Back to top
Brazucs
I have no idea what my avatar is.


Super Elite (Last Title)


Joined: 31 Mar 2004
Posts: 3349

Posted: 30 Oct 2005 05:44:14 pm    Post subject:

Now, Emile can be both a guy's and a girl's name...
Back to top
Darth Android
DragonOS Dev Team


Bandwidth Hog


Joined: 31 May 2003
Posts: 2104

Posted: 31 Oct 2005 07:36:12 am    Post subject:

Keep to the topic please.

Oh, I almost forgot, welcome to UTI, Emile!
Back to top
Brazucs
I have no idea what my avatar is.


Super Elite (Last Title)


Joined: 31 Mar 2004
Posts: 3349

Posted: 31 Oct 2005 12:05:46 pm    Post subject:

Good one, Darth ;)

Welcome Emile! Hope you stay around for oodles of time.
Back to top
emile


Newbie


Joined: 30 Oct 2005
Posts: 3

Posted: 31 Oct 2005 04:20:23 pm    Post subject:

Thank You. This will be a great place to further my skills at programming. Going to lurkem around till I need to post again. I love programming this TI89. Fits in my pocket and has all the power I need. Wish they had them when I was younger. Back then it was all commodore 64 haha. Thanks again. -Emile
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