Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
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
Author Message
EEDOK


Member


Joined: 06 Mar 2004
Posts: 117

Posted: 06 Mar 2004 11:57:27 pm    Post subject:

hey ppl been a while since I went to cirrus(2002 I do believe was the last time), and I thought it was about time I went back and did a few things that I was doing years ago(lol 2 years). But to my demise I ran into a problem in my simple game test program.

Now down to the problem. What happens is when repeated input is in the game, it quits the game, what I'm wondering is way to prevent this..

here's the code to the game

Code:
0Xmin
0Ymin
94Xmax
62Ymax
AxesOff
CoordOff
ClrDraw
0
28A
28B
31Z
47T
1U
Line(1,A,1,A+5)
Line(93,B,93,B+5)
Line(0,0,94,0)
Line(0,62,94,62)
1V
While =0
0K
For(J,0,5)
getKeyK
If K0
Goto 1
End
Lbl 1
If K=25
Then
Pt-Off(93,B)
B+1B
Pt-On(93,B+5)
End
If K=34
Then
Pt-Off(93,B+5)
B-1B
Pt-On(93,B)
End
If K=21
Then
Pt-Off(1,A)
A+1A
Pt-On(1,A+5)
End
If K=31
Then
Pt-Off(1,A+5)
A-1A
Pt-On(1,A)
End
If K=45
1
pxl-Test(Z,T+U)R
If R=1
UU
pxl-Test(Z+V,T)R
If R=1
VV
Pt-Off(T,Z)
T+UT
Z+VZ
If T>93 or T<1
47T
Pt-On(T,Z)

End

(or you can get it from http://eedok.voidofmind.com/game/PONG.8xp alternatively)

does anyone experienced in the realm of the 83+ know what's causing the problem and how to prevent it?
Back to top
Ray Kremer


Member


Joined: 16 Feb 2004
Posts: 237

Posted: 07 Mar 2004 09:32:31 pm    Post subject:

Quits as in exits, or quits as in errors out, and if the latter, what error and on which line?

This:
0K
For(J,0,5)
getKeyK
If K0
Goto 1
End
Lbl 1

seems pointless to me since it's going to Lbl 1 whether or not the If line is true or false, and having that in the For loop only opens you up to a memory leak. I can see what you're trying to do there, perhaps a better way would be

0K
For(J,0,5)
If K=0
getKeyK
End
Lbl 1
Back to top
EEDOK


Member


Joined: 06 Mar 2004
Posts: 117

Posted: 07 Mar 2004 10:25:25 pm    Post subject:

hmm that seems to eliminate the need for the label as well(too used to C, there needs to a be a basic break command Razz).. The unmatched end from the goto seems like it may be the problem, I'll test it out as soon as I can get my calculator back thanks Smile

Last edited by Guest on 07 Mar 2004 10:26:10 pm; edited 1 time in total
Back to top
Arcane Wizard
`semi-hippie`


Super Elite (Last Title)


Joined: 02 Jun 2003
Posts: 8993

Posted: 08 Mar 2004 12:12:32 pm    Post subject:

Breaking out of for loops:

For(X,1,100
If getKey:100->X
End

For(X,1,not(getKey)100
End

etc.

Why does being too used to C explain why you use labels? If there's any language where you don't need them it's C/C++.
Back to top
EEDOK


Member


Joined: 06 Mar 2004
Posts: 117

Posted: 08 Mar 2004 01:01:00 pm    Post subject:

Arcane Wizard wrote:
Breaking out of for loops:

For(X,1,100
If getKey:100->X
End

For(X,1,not(getKey)100
End

etc.

Why does being too used to C explain why you use labels? If there's any language where you don't need them it's C/C++.

I used labels cause it was the first thing that came to mind to replace break.

PS: don't be an asshole
Back to top
Jeremiah Walgren
General Operations Director


Know-It-All


Joined: 24 May 2003
Posts: 1937

Posted: 08 Mar 2004 02:34:45 pm    Post subject:

In case you didn't notice, you're the one who asked for help. They were just pointing some things out.
Back to top
EEDOK


Member


Joined: 06 Mar 2004
Posts: 117

Posted: 08 Mar 2004 04:19:23 pm    Post subject:

Jeremiah Walgren wrote:
In case you didn't notice, you're the one who asked for help.  They were just pointing some things out.

well this comment:
Quote:
Why does being too used to C explain why you use labels? If there's any language where you don't need them it's C/C++.
was uncalled for..
Back to top
Adm.Wiggin
aka Tianon


Know-It-All


Joined: 02 Jun 2003
Posts: 1874

Posted: 08 Mar 2004 06:52:09 pm    Post subject:

it was a simple question wondering the reasoning behind your statement.
Back to top
Arcane Wizard
`semi-hippie`


Super Elite (Last Title)


Joined: 02 Jun 2003
Posts: 8993

Posted: 09 Mar 2004 07:35:08 am    Post subject:

I was just wondering, well, what I asked.

I've never used labels in C/C++ so that got me curious as to why you did, maybe they where usefull after all, or maybe you thought they where the only way to control program flow. In that case people could help you by informing you on other methods and such.

Sorry if you felt offended by that.


Last edited by Guest on 09 Mar 2004 07:35:20 am; edited 1 time in total
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 GMT - 5 Hours

 

Advertisement