CEMETECH
Leading The Way To The Future
Login [Register]
Username:
Password:
Autologin:

Don't have an account? Register now to chat, post, use our tools, and much more.
Latest Headlines
Online Users
There are 108 users online: 4 members, 78 guests and 26 bots.
Members: balping, dodormeur, gbl08ma.
Bots: MSN/Bing (1), Magpie Crawler (3), VoilaBot (5), Googlebot (17).
RSS & Social Media
SAX
You must log in to view the SAX chat widget
Author Message
yeongJIN_COOL


Member


Joined: 28 Apr 2011
Posts: 161

Posted: 12 Feb 2012 02:32:35 pm    Post subject: Prizm BASIC question

I'll post a question whenever I need help. Smile

First of all, how does getKey work in Prizm?
Apparently, it doesn't work like TI's getkey.
I read the manual, but I still haven't got any clue.
Back to top
gbl08ma


Power User


Joined: 26 Nov 2011
Posts: 476
Location: Portugal

Posted: 12 Feb 2012 02:37:33 pm    Post subject:

You put GetKey value in a variable, like this:

GetKey->K

Then the value of K will contain the key pressed. For example, the EXE key has a value of 31.
_________________
My blog, where I write about random things... | tiny URL shortener
View JPEG images on your Prizm | Utilities for the Casio Prizm - clock, stopwatch, calendar/agenda, add-in manager and more!
Back to top
yeongJIN_COOL


Member


Joined: 28 Apr 2011
Posts: 161

Posted: 12 Feb 2012 02:38:35 pm    Post subject:

Oh. So I have to store getKey in variable?
Thanks.
Back to top
Ashbad


... I think redheaded girls are kind of cool


Joined: 01 Dec 2010
Posts: 2418
Location: Stomp Stomp Stomp, The Idiot Convention

Posted: 12 Feb 2012 02:50:19 pm    Post subject:

yeongJIN_COOL wrote:
Oh. So I have to store getKey in variable?
Thanks.


Well, it's used exactly like with the 84+'s BASIC, so you can store it to a variable if you want to; either way, it can be used on it's own like a value holding the last key pressed.
_________________
-Ashbad
Back to top
yeongJIN_COOL


Member


Joined: 28 Apr 2011
Posts: 161

Posted: 12 Feb 2012 07:05:05 pm    Post subject:

one more question:
This code gives me syntax error.


Code:

Lbl B
GetKey→K
If K=27
Locate 3,3,"HI
IfEnd
Goto B


it gives me error at If K=27 part.
Back to top
Ashbad


... I think redheaded girls are kind of cool


Joined: 01 Dec 2010
Posts: 2418
Location: Stomp Stomp Stomp, The Idiot Convention

Posted: 12 Feb 2012 07:14:37 pm    Post subject:

yeongJIN_COOL wrote:
one more question:
This code gives me syntax error.


Code:

Lbl B
GetKey→K
If K=27
Locate 3,3,"HI
IfEnd
Goto B


it gives me error at If K=27 part.


Use "Then".
_________________
-Ashbad
Back to top
yeongJIN_COOL


Member


Joined: 28 Apr 2011
Posts: 161

Posted: 12 Feb 2012 07:15:08 pm    Post subject:

oh. I have to use then?
Thanks
Back to top
Ashbad


... I think redheaded girls are kind of cool


Joined: 01 Dec 2010
Posts: 2418
Location: Stomp Stomp Stomp, The Idiot Convention

Posted: 12 Feb 2012 07:16:10 pm    Post subject:

yeongJIN_COOL wrote:
oh. I have to use then?
Thanks


Yes, just like in TI-BASIC; however, you can't ever omit it, even for one line if blocks.
_________________
-Ashbad
Back to top
yeongJIN_COOL


Member


Joined: 28 Apr 2011
Posts: 161

Posted: 15 Feb 2012 07:39:13 pm    Post subject:

Apparently, this doesn't work:


Code:

...codes...
If A=6
Then
Goto Q
IfEnd
A=7[thick arrow]Goto T


the label exists, but it gives me GO error. Anyone knows why?
Back to top
yeongJIN_COOL


Member


Joined: 28 Apr 2011
Posts: 161

Posted: 15 Feb 2012 08:17:16 pm    Post subject:

Ok. The program gives me the error right here. D:


Code:

...codes...
If A=6
Then
Goto Q //Gives me error here
IfEnd
Lbl Q

what did I do wrong?
Back to top
zeldaking


Power User


Joined: 31 Jul 2011
Posts: 470
Location: Utah

Posted: 15 Feb 2012 08:22:12 pm    Post subject:

Well I would guess becuase the If A=6 command never reaches its respectable IfEnd. Don't know for sure, becuase I only spent a little time with Prizm basic, it annoys me.

Last edited by zeldaking on 15 Feb 2012 08:23:33 pm; edited 1 time in total
Back to top
yeongJIN_COOL


Member


Joined: 28 Apr 2011
Posts: 161

Posted: 15 Feb 2012 08:23:25 pm    Post subject:

@zeldaking: it does reach A=6. Even if it didn't it shouldn't give me GO:ERROR thingy. Is there something wrong with my code?
Back to top
zeldaking


Power User


Joined: 31 Jul 2011
Posts: 470
Location: Utah

Posted: 15 Feb 2012 08:25:24 pm    Post subject:

Let's think here the GO:Error is obvoiusly an error with some goto command, right? I know it reaches A=6 I am saying it never reaches the IfEnd so it messes the execution up. Maybe?
Edit:
You are right it shouldn't give you an error. I tried it on my Calc and it works fine, did you get the OS update? Maybe that has something to do with it. I don't know you should ask a smarter person than me.
Back to top
yeongJIN_COOL


Member


Joined: 28 Apr 2011
Posts: 161

Posted: 15 Feb 2012 08:42:25 pm    Post subject:

I'll post the entire code(it's quite short.)


Code:

Lbl S
ClrText
Red Locate 4,2,"ASCII
Blue Locate 13,2,"WORLD
Yellow Locate 1,1,"XXXXXXXXXXXXXXXXXXXXX
Yellow Locate 1,3,"XXXXXXXXXXXXXXXXXXXXX
Yellow Locate 1,7,"XXXXXXXXXXXXXXXXXXXXX
Locate 5,4,"NEW
Locate 5,5,"CONTINUE
Locate 5,6,"QUIT
0→K
4→A
While K!=78
Red Locate 3,A,">
0→K:While K=0
Getkey→K
WhileEnd
Locate 3,A,"
A+(K=37 And A!=6)-(K=28 and A!=4)→A
WhileEnd
If A=6
Then
Goto Q //Error here
IfEnd

Lbl Q
ClrText
Back to top
zeldaking


Power User


Joined: 31 Jul 2011
Posts: 470
Location: Utah

Posted: 16 Feb 2012 01:01:28 am    Post subject:

I only see one WhileEnd... is that the problem?
Back to top
comicIDIOT


Guru


Joined: 01 May 2006
Posts: 5108
Location: SFBA, California

Posted: 16 Feb 2012 01:42:14 am    Post subject:

zeldaking wrote:
I only see one WhileEnd... is that the problem?


I only see one While. So I think we're clear.

Yeong, you are able to eliminate the If:Then:Goto:End by doing this:


Code:
If A=6 => Goto Q


It saves bytes and won't cause memory leaks that will inevitably slow your program.
_________________


-Alex
Back to top
Purobaz


Advanced Newbie


Joined: 26 Nov 2011
Posts: 67
Location: France

Posted: 16 Feb 2012 03:15:18 am    Post subject:

Quote:
Code:
If A=6 => Goto Q

You don't need If :

Code:
A=6 => Goto Q

To avoid bugs, you shouldn't use Goto/Lbl.
Back to top
yeongJIN_COOL


Member


Joined: 28 Apr 2011
Posts: 161

Posted: 16 Feb 2012 07:06:33 am    Post subject:


Code:

A=6 => Goto Q

I'm actually aware of this "optimization" since I was in 8th grade. Very Happy
However, for goto, both code didn't work. All I remember is that my code were supposed to work if it was fx-9750g. (excluding all the new commands, of course.)
Back to top
m1ac4


Advanced Newbie


Joined: 16 Sep 2010
Posts: 43

Posted: 16 Feb 2012 07:31:17 am    Post subject:

If you use the Locate command with a string you should try placing a quotation mark at the end. If you do that your errors may just vanish.
Back to top
yeongJIN_COOL


Member


Joined: 28 Apr 2011
Posts: 161

Posted: 24 Feb 2012 07:07:40 pm    Post subject:

Is there a way to do substring with PRIZM basic?
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
    » Goto page 1, 2  Next
» View previous topic :: View next topic  
Page 1 of 2 » All times are GMT - 5 Hours

 
Jump to:  
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

© Copyright 2000-2013 Cemetech & Kerm Martian :: Page Execution Time: 0.031591 seconds.