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 Technology & Calculator Open Topic 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. Calculator Tech Support => Technology & Calculator Open Topic
Author Message
scriptkitty


Newbie


Joined: 27 Feb 2008
Posts: 3

Posted: 27 Feb 2008 06:15:49 pm    Post subject:

20->Q
20->N
ClrDraw

lbl1
pxl-on(Q,N)
getkey->M
IF M = 25
then
goto 2
else
if M = 24
then
goto 3
else
If m = 26
then
goto 4
else
if M = 34
then
goto 5
else
goto 1


lbl2
pxl-off (Q,N)
Q-5->Q
goto 1

lbl3
pxl-off (Q,N)
N-5->N
goto 1

lbl4
Pxl-off (Q,N)
N+5->N
goto 1

lbl 5
Pxl-off (Q,N)



this should loop getkey and when you hit up down left or right, it should move a pxl occordingly
please help me with this

Ps yea i know i right bad code but im a self tought newb
Back to top
pugboy


Active Member


Joined: 11 Apr 2007
Posts: 544

Posted: 27 Feb 2008 06:22:53 pm    Post subject:

Add a goto 1 after Label 5.

Messy code :S


Code:
20->Q
20->N
ClrDraw
While K=24 or K=25 or K=26 or K=34      (I know there is a better way, can someone help out?)
getkey->K
Q->Y
N->X
If K
PxlOff(Y,X
X+(5(K=26))-(5(K=24->X
Y+(5(K=34))-(5(K=25->Y
PxlOn(Q,N
End


That uses a loop and has no memory leaks. Your code will eventually run out of RAM and quit. Try unarchiveing a lot and running you code for a while.


Last edited by Guest on 27 Feb 2008 06:30:07 pm; edited 1 time in total
Back to top
scriptkitty


Newbie


Joined: 27 Feb 2008
Posts: 3

Posted: 27 Feb 2008 06:24:25 pm    Post subject:

ohhhh... right...... ok thanks

now it works


Last edited by Guest on 27 Feb 2008 06:27:31 pm; edited 1 time in total
Back to top
Weregoose
Authentic INTJ


Super Elite (Last Title)


Joined: 25 Nov 2004
Posts: 3976

Posted: 27 Feb 2008 08:43:09 pm    Post subject:

pugboy: If you want to do your best to help someone out, the least you could do is test the code that you're about to provide; I think that the code you have there, while better demonstrating the kind of structure that one should work with, is really rather unsatisfactory in that it doesn't... actually... work. ;)

scriptkitty, friendly reminder? Don't break the rules given to you when you register? Thank ya. I deleted your second post (rule #1 upon signing up), but please stick around – make sure that you read through these to get you through the first week here at this wonderful community.

Welcome to United-TI! :biggrin:


Last edited by Guest on 27 Feb 2008 08:43:49 pm; edited 1 time in total
Back to top
SonicBoom95


Member


Joined: 31 Jan 2008
Posts: 237

Posted: 04 Mar 2008 12:58:52 pm    Post subject:

Pugboy:

Code:
:While max(K={24,25,26,34
...
...
...
:End


Last edited by Guest on 04 Mar 2008 12:59:10 pm; edited 1 time in total
Back to top
Weregoose
Authentic INTJ


Super Elite (Last Title)


Joined: 25 Nov 2004
Posts: 3976

Posted: 04 Mar 2008 05:42:45 pm    Post subject:

SonicBoom95 wrote:
Pugboy:

Code:
:While max(K={24,25,26,34
...
...
...
:End
That doesn't work, either. Read out the logic of that line. Test it. Do something. Don't just assume.

It galls me that broken code ever gets suggested as a solution.


Last edited by Guest on 04 Mar 2008 05:45:38 pm; edited 1 time in total
Back to top
adje


Newbie


Joined: 24 Dec 2007
Posts: 24

Posted: 05 Mar 2008 11:41:00 am    Post subject:

What a bout this one then?

Code:
ClrDraw
20->X:20->Y
Repeat K=45     // the program quits when you press CLEAR
getKey->K
If K                  // If a button is pressed the pixel turns white
PxlOff(Y,X
X-(K=24)(X!=0)+(K=26)(X!=94->X
// If you press LEFT (24) [U]and[/U] X is not 0, then X-1 -> x
Y-(K=25)(Y!=0)+(K=34)(Y!=62->Y
PxlOn(Y,X        // PxlOn/Off work with rows (Y) and columns (X)
End

94 and 62 are the measures of the screen (in pixels)
sorry for my bad english. Cool :)

+EDIT
i forgot the getKey Very Happy haha tnx vuurrobin


Last edited by Guest on 05 Mar 2008 02:53:15 pm; edited 1 time in total
Back to top
vuurrobin


Advanced Member


Joined: 09 Aug 2006
Posts: 428

Posted: 05 Mar 2008 01:38:00 pm    Post subject:

you are missing getkey....

I would also put a loop around the getkey instead of using If K. makes key responce faster (I think)

and use and. its faster and smaller than multiplying.

X-(K=24 and X)+(K=26 and X!=94->X
Y-(K=25 and Y)+(K=34 and Y!=62->Y


Last edited by Guest on 04 Aug 2010 01:19:39 pm; edited 1 time in total
Back to top
JoostinOnline


Active Member


Joined: 22 Aug 2007
Posts: 559

Posted: 05 Mar 2008 05:40:53 pm    Post subject:

@adje You cannot use tags like [ u][/u ] within a code box.
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