Omnimaga

Calculator Community => Casio Calculators => Topic started by: fxdev on January 18, 2011, 02:58:58 pm

Title: Getting started in Casio-Basic? You can ask here.
Post by: fxdev on January 18, 2011, 02:58:58 pm
This is a thread where you can put your Casio-Basic related questions.
Me and the other Casio guys will try to answer these.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: DJ Omnimaga on January 18, 2011, 03:12:49 pm
-One question I have is can we omit quotes at the end of Locate? In TI-BASIC you can do things such as Output(1,1,"HELLO WORLD instead of Output(1,1,"HELLO WORLD") as long as the next code is on a different line, but I was wondering if it was the same on Casio? That usually saved us some bytes of RAM.

-Also are there any assembly tools that allow us to run programs directly from the Storage memory or even just a program that works in a parser hook way and allows you to move/copy back and forth programs from the RAM to storage? That isn't really BASIC-related, although some 83+ BASIC games uses such programs to get around the 24 kilobytes of RAM limit.

-Also how would we recall a picture from a program on the Prizm? I tried RecallPict 1 (after storing a pic with StorePict 1) and it does nothing... ???

On an unrelated note, somebody started writing a guide to help people porting TI-BASIC programs to Casio BASIC or vice-versa a while ago. I can't find the topic right now but I'll try to find it later.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: fxdev on January 18, 2011, 03:39:11 pm
Quote
-One question I have is can we omit quotes at the end of Locate? In TI-BASIC you can do things such as Output(1,1,"HELLO WORLD instead of Output(1,1,"HELLO WORLD") as long as the next code is on a different line, but I was wondering if it was the same on Casio? That usually saved us some bytes of RAM.
"Locate" and "Text" seem to allow this, but it's bad practice and does not seem to work with the ":" command either. Actually, I have never used this. The few bytes you save get lost by using special characters.

Quote
-Also are there any assembly tools that allow us to run programs directly from the Storage memory
Maybe this is what you are looking for?
http://casiokingdom.org/modules.php?name=Downloads&d_op=viewdownloaddetails&cid=16&lid=542&ttitle=FX9860G_LOADER_2.00#dldetails

Quote
-Also how would we recall a picture from a program on the Prizm? I tried RecallPict 1 (after storing a pic with StorePict 1) and it does nothing... ???
You could try clearing the screen first using "cls" and you should disable any background image with "BG-None". Unfortunately, there is no way to test if a picture exists - causing a memory error sometimes.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: DJ Omnimaga on January 18, 2011, 04:07:46 pm
Quote
-One question I have is can we omit quotes at the end of Locate? In TI-BASIC you can do things such as Output(1,1,"HELLO WORLD instead of Output(1,1,"HELLO WORLD") as long as the next code is on a different line, but I was wondering if it was the same on Casio? That usually saved us some bytes of RAM.
"Locate" and "Text" seem to allow this, but it's bad practice and does not seem to work with the ":" command either. Actually, I have never used this. The few bytes you save get lost by using special characters.
Ah ok, I guess it is different between both brand of calcs. On TI, we try to save every possible byte by using such optimization. It is even considered a good practice among us. The only time it should be avoided is with For() when it only contains an IF instruction that is often False, due to a TI-OS glitch. Does special characters actually take more space than the regular ones? I remember something similar on TI with lowercase letters.

Quote
-Also are there any assembly tools that allow us to run programs directly from the Storage memory
Maybe this is what you are looking for?
http://casiokingdom.org/modules.php?name=Downloads&d_op=viewdownloaddetails&cid=16&lid=542&ttitle=FX9860G_LOADER_2.00#dldetails
Does this allow copying individual programs to the RAM? Being forced to copy entire packages might not be something I want, especially when each program is 15 KB large.

Quote
-Also how would we recall a picture from a program on the Prizm? I tried RecallPict 1 (after storing a pic with StorePict 1) and it does nothing... ???
You could try clearing the screen first using "cls" and you should disable any background image with "BG-None". Unfortunately, there is no way to test if a picture exists - causing a memory error sometimes.
Nope, no luck. Here's my code (Casio Prizm OS 01.01.0200):

Code: [Select]
Cls
Vertical -3
StoPict 1
Cls
BG-None
RclPict 1
Basically I wanted to clear the screen, display a line at -3, Store the screen content in picture 1, clear the screen again, then re-display the picture 1 content again. Not an useful program, but it was for testing purpose since I'm experimenting with the language.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: fxdev on January 18, 2011, 04:35:18 pm
Quote
Does special characters actually take more space than the regular ones?
As long as they're non-ASCII.

Quote
Does this allow copying individual programs to the RAM? Being forced to copy entire packages might not be something I want, especially when each program is 15 KB large.
As far as I know, this copies any program within a *.g1m/*.g2m file into the user RAM.
You may ask Simon to obtain the source code.

Quote
Nope, no luck. Here's my code (Casio Prizm OS 01.01.0200):

Code: [Select]
Cls
Vertical -3
StoPict 1
Cls
BG-None
RclPict 1
And if you go to RUN|MAT and enter "Cls:RclPict 1"? This will display the coordinate system with an additional vertical line on my fx-9750GII.
Inside RUN|MAT you can press [Shift]+[F3] and reset the view window with [F1] - just in case the vertical line is not within the display area...
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: DJ Omnimaga on January 18, 2011, 04:45:52 pm
Yeah in RUN|MAT it works fine, just not in PRGM.

However I noticed it seems to work if I set the pic as a background. I guess a background could do the job maybe, although that doesn't allow dual-layer ASCII graphics it seems D: (see animated screen capture for what I mean about dual-layer ASCII graphics).

Thanks a lot by the way!
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: fxdev on January 18, 2011, 04:53:02 pm
Maybe this is because the program execution stops after RclPict 1?
Try putting it into a loop or append the small triangle command after RclPict to pause the interpreter (until you press [EXE]).
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: DJ Omnimaga on January 18, 2011, 04:59:51 pm
Actually I noticed something even worse: Cls doesn't do anything O.O

(Btw I tried with the triangle thing and also For 1->Z to 999:Next)

Could this just be my OS? I think you or someone else who has access to OS 1.02 should try on it to see. I hope Casio won't wait a year or two before releasing 1.02. X.x
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: fxdev on January 18, 2011, 05:30:41 pm
Have a look at this:

Code: [Select]
// Program: INIT
Cls
BG-None
AxesOff
Horizontal -1
Horizontal 1
StoPict 1
Cls
Vertical -1
Vertical 1
StoPict 2

// Program: TEST
Prog "INIT"
While 1
Cls:RclPict 1_ // '_' is the small triangle
Cls:RclPict 2_
WhileEnd

Quote
Actually I noticed something even worse: Cls doesn't do anything
Indeed, when "Cls" is followed by a loop, the screen won't be cleared immediately.

PS: I don't own a Prizm yet.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: DJ Omnimaga on January 18, 2011, 05:38:44 pm
I see. Well, I tried replacing _ with For 1->A To 999:Next and the pics wouldn't show up. I guess RecallPict only works as soon as the program is paused. Thanks for the help!
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: fxdev on January 18, 2011, 05:44:07 pm
You could use the famous PxlOff 1,1 trick to force a screen refresh. ;-)
Actually, lots of those refresh issues were fixed with the fx-9860G series; however, a few are still there...
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: z80man on January 18, 2011, 05:46:35 pm
O yeah I forgot to say earlier. Unlike TI-BASIC pixel coordinates don't start at 0, but instead 1. Also the client area is 187x379.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: DJ Omnimaga on January 18, 2011, 05:55:21 pm
Ah, right, although on the Prizm PxlOff is so friggin slow (3 pixels per second rate) so that would slow down the game quite a lot. X.x

EDIT: Why does PxlOn 1,1 works, but not PxlOn X,Y? We can't even use variables as arguments? I get a message saying the arguments must be an integer, even though they're integers

For 1->X To 96
For 1->Y To 64
Pxl-On X,Y
Next
Next
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: fxdev on January 18, 2011, 06:15:06 pm
X and Y are used internally when drawing things - so you should not use them.
The same is true for r and theta when doing polar stuff.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: DJ Omnimaga on January 18, 2011, 06:17:56 pm
oh, right. I'll try with other variables, then. Thanks.

EDIT: Ok that works. Is there any way to speed up drawing or something? I find it hard to believe a 6 MHz calc with a 8 bits CPU can fill 5985 pixels by the time a 29 MHz 32 bits CPU one can't even fill 300 O.O
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: fxdev on January 18, 2011, 06:30:36 pm
Use "F-line" with view window setting 1,127,0,1,63,0.
Also, there is a trick to precede "F-Line" with "SketchThick" to further increase its performance.

Here is a test program that does this:

Code: [Select]
Cls
LabelOff
ViewWindow 1,127,0,1,63,0
For 1->I To 5
Cls
For 1->J To 31
SketchThick F-Line 1,2J,126,2J
Next
Next

EDIT: Wow, on the Prizm this is REALLY slow...
I'm sorry, but Casio-Basic has always had a bad design when it comes to graphics.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: DJ Omnimaga on January 18, 2011, 06:43:42 pm
Cool thanks for the tip. I actually changed ViewWindow 1,127,0,1,63,0 to ViewWindow 1,127,0,1,75,0 and For 1->J To 31 to For 1->J To 37, though, since there was a small white gap between lines.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: fxdev on January 18, 2011, 06:48:42 pm
Actually, this was supposed to fill the entire screen...
Are you overwriting the status bar? If not, then this must be a bug.

Incredible, the Prizm makes Casio-Basic even crappier!
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: AngelFish on January 18, 2011, 06:52:45 pm
Wow, I'm really behind on my Casio-BASIC tutorials  :P

Anyway, here's a link to the first one on my site: http://www.fishbot.co.cc/tutorials.html

It may or may not be readable. I'm getting different outputs depending on how my browser views the page.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: DJ Omnimaga on January 18, 2011, 06:56:39 pm
Actually, this should fill the entire screen...
Are you overwriting the status bar? If not, then this must be a bug.

Incredible, the Prizm makes Casio-Basic even crappier!
Not really sure what you mean, but that seems weird. X.x

And yeah it definitively seems they screwed up the BASIC language pretty bad. I hope someone ports Axe Parser and other languages to the calc and opens it to ASM dev so we can produce better games or have ASM utilities that extends and improve the BASIC language.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: fxdev on January 18, 2011, 07:00:46 pm
My suggestion for all Casio people is: Don't buy the Prizm and migrate to TI - they have better BASIC! :w00t:
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: AngelFish on January 18, 2011, 07:01:21 pm
Um, why would you migrate to TI if you bought the Prizm?
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: jnesselr on January 18, 2011, 07:02:41 pm
My suggestion for all Casio people is: Don't buy the Prizm and migrate to TI - they have better BASIC! :w00t:
True, but hopefully once it is fully hacked, we can do better with the color screen.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: DJ Omnimaga on January 18, 2011, 07:06:41 pm
TI-Nspire BASIC is actually 1000x worse than Casio BASIC. O.O (There are no getkey, pxl-on, line, Locate, Text nor proper command prompt input command)

Also once the Prizm is cracked there are quite big possibilities with that color screen, especially since the processor can apparently be overclocked to 100+ MHz. O.O :P
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: z80man on January 20, 2011, 11:24:31 pm
Okay for some reason in the color menu you can not select white. (It's greyed out  :P) I need this feature to erase some lines in programs though. Also I tried Erase color, but that just causes a syntax error.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: DJ Omnimaga on January 21, 2011, 02:50:14 am
Ya I wonder what's up with that. On the home screen you just type a space, though.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: fxdev on January 21, 2011, 08:14:38 am
Reminds me of several people requesting an F-LineOff command to clear a line. But up to this day, there are only the PxlOff/PlotOff and Cls/ClrGraph commands to clear a pixel or the entire screen. If you only want to clear some portion, you have to stick to printing blank characters...
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: z80man on January 21, 2011, 03:27:19 pm
Reminds me of several people requesting an F-LineOff command to clear a line. But up to this day, there are only the PxlOff/PlotOff and Cls/ClrGraph commands to clear a pixel or the entire screen. If you only want to clear some portion, you have to stick to printing blank characters...
Oh well that sucks  :P . If you noticed in the menu of my Snake game the arrow is on a black background because that was the only way I could erase it. Originally it was a white background, but then I couldn't get rid of it when it moved. Also is there a way to draw large text on the graph screen like you could do in TI-BASIC.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: fxdev on January 21, 2011, 04:19:20 pm
Quote
Also is there a way to draw large text on the graph screen like you could do in TI-BASIC.

The command "Text" works in graphics mode. It's part of the sketch menu (press [Shift] + [F4]).
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: z80man on January 21, 2011, 04:39:13 pm
Quote
Also is there a way to draw large text on the graph screen like you could do in TI-BASIC.

The command "Text" works in graphics mode. It's part of the sketch menu (press [Shift] + [F4]).
I know that. I'm wondering if I can make it the same size as homescreen text like in TI-BASIC text(-1,0,0,"Hello    would draw Hello in the large font.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: fxdev on January 21, 2011, 06:19:35 pm
No, you cannot use a larger font when in graphics mode.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: DJ Omnimaga on January 22, 2011, 01:00:30 am
That said, when erasing large portions of the screen, even on a 83+ we used Text( instead of Line(. It was much faster (although we had to use the large fonts for the speed) because it erased 8 lines at once :P

That said, I wonder if graphs can be used in BASIC... if the shading is fast enough, maybe that could be a faster way to draw stuff on the screen? (although it can be harder)
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: z80man on January 22, 2011, 01:48:58 am
Graphs can be drawn, but I haven't experiemented with that yet in basic. There is also something called dynamic graphs which are supposed to move or something. Just from the graph menu I was able to get some interesting color effects not normaly availible in basic. Its also relativily fast. Faster than the 83+.  :D
(http://img.removedfromgame.com/imgs/1-DispCap1.bmp)
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: Builderboy on January 22, 2011, 02:29:51 am
Wow that looks neat O.O its already becoming apparent that Casio Basic is different in so many ways than Ti Basic, this thread should really help though, everything is already looking really excelent!
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: Ranman on January 22, 2011, 02:37:03 am
I learned how to program Casio BASIC (FX-6300G and FX-7700G) probably 5 years before I bought my first TI graphing calc.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: fxdev on January 22, 2011, 05:38:40 pm
You can further speed up drawing by using some of the statistics functions: http://www.casiocalc.org/?showtopic=2078
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: DJ Omnimaga on January 24, 2011, 02:21:10 pm
That's cool. I'll really have to figure out how to actually add shading to my graphs...

@Ranman I got a FX-7000G and 7700GE. The BASIC language on them are similar but the other calc got a bit more RAM. It was the 1st gen BASIC language which has no locate/getkey and graph screen drawing commands. Yet the language gave more freedom than on the TI-Nspire. O.O
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: z80man on January 27, 2011, 01:43:45 am
Couple of questions regarding basic. First off how do I take user input. Such as numbers and strings. Second is use of matricies and lists. Mostly on referencing a single index in that matrix or list. Last off is drawing with statistics functions. I tried the example code on casiocalc, but I couldn't get it to run.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: fxdev on January 27, 2011, 01:51:44 pm
Quote
First off how do I take user input. Such as numbers and strings.

?->A // or "A="?->A
?->A~Z // assign to all variables (except r and theta)
?->Str 1 // input a string
?->List 1 // input a list (use "List ?" or "{?,?,?,...}")
?->Mat A // input a matrix (use "Mat ?" or "[[?,?,...][?,?,...]...]")

There is no way to convert an integer to a string... :(

Combine '?' and 'Locate':
" " // can be preceded by color commands
Locate 1,1,"Personal Settings:"
"Name="?->Str 1

Question: Does the Prizm's Locate command support color commands (e.g. Green Locate 1,1,...)?

You don't like the '?' command?
Here is a small shell-like program:

Code: [Select]
ClrText
"_ "->Str 1
Locate 1,1,">> _"
Do:While Getkey // wait for key release
WhileEnd
Do:Getkey // wait for key press
LpWhile Not Ans
StrLeft(Str 1,StrLen(Str 1)-2)->Str 1 // remove underscore
Ans=44=>StrLen(Str 1)=>StrLeft(Str 1,StrLen(Str 1)-1)->Str 1 // [DEL]
Ans=61=>Str 1+" "->Str 1 // [.]
Ans=76=>Str 1+"A"->Str 1 // [X,theta,T]
Ans=66=>Str 1+"B"->Str 1 // [log]
...
Str 1+"_ "->Str 1
Locate 4,1,StrRight(Str 1,19)
LpWhile Ans=/=31 And StrLen(Str 1)<255 // [EXE]
StrLeft(Str 1,StrLen(Str 1)-2)->Str 1 // remove underscore
Prog "PARSE" // start parsing...

Quote
Second is use of matricies and lists. Mostly on referencing a single index in that matrix or list.

{2,2}->Dim Mat A // or [[1,2][3,4]]->Mat A
3->Dim List 1 // or {1,2,3}->List 1

1->Mat A[1,1]
2->Mat A[1,2]
3->Mat A[2,1]
4->Mat A[2,2]

1->List 1[1]
2->List 1[2]
3->List 1[3]
4->List 1[4] // works too!
5->List 1[5] // works when List 1[4] exists!
...

You can also use variables:
1->I
2->List I[2]

Or even strings:
"NICE"->List 1[0] // the so called 'subject name' of a list
2->List "NICE"[2]
List 1[0]->Str 1
3->List Str 1[3]

Unfortunately, neither do string commands work with variables (e.g. Str I) nor does "?->List 1[0]" work.

Workaround for the last one:
?->Str 1
Str 1->List 1[0]

Btw, there is a way to check for empty lists: :D

Code: [Select]
// EXPECT_SIZE... expected list size (>1)
// MAGIC_NUMBER... some special value
EXPECT_SIZE->List 1[1]
If Dim List 1=/=List 1[1]
Then "Data not found!"
Else If List 1[List 1[1]]=/=MAGIC_NUMBER
Then "Data corrupted!"
Else "Data loaded!"
IfEnd:IfEnd

Quote
Last off is drawing with statistics functions. I tried the example code on casiocalc, but I couldn't get it to run.

I have never used this technique, but the program seems to work for me.
However, there are two small bugs:
(1) Change "Ans=28=>B-10->B" to "Ans=28=>B+10->B"
(2) Add "AxesOff" somewhere at the top

And I also don't like Gotos:
So replace "Lbl 0:Getkey:Ans=0=>Goto 0" with "Do:Do:Getkey:LpWhile Not Ans" and "Goto 0" at the bottom with "LpWhile 1".
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: AngelFish on January 27, 2011, 06:11:26 pm

Question: Does the Prizm's Locate command support color commands (e.g. Green Locate 1,1,...)?

Yes.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: fxdev on January 27, 2011, 06:35:33 pm
Oh, nice.

So you no longer have to write...
Green " "
Locate 1,1,"Green Text"
...as on the CFX models. :)
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: AngelFish on January 27, 2011, 06:36:06 pm
Nope. There's also almost no difference in speed either.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: DJ Omnimaga on January 27, 2011, 08:08:30 pm
I'm glad we can use matrices that way on the Prizm. This shall be useful for tilemaps.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: bsl on February 13, 2011, 08:20:20 pm
Here is a Prizm commands <=> text conversion table.
Works well on the Prizm, except for converting text like @7FF5
It would be nice to get the special symbols off the calculator somehow.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: AngelFish on February 13, 2011, 08:24:15 pm
Oh, yeah. I managed to get all entries in the the special symbols table off of the calc a couple days ago. Here you go. The normal letters are marker symbols so that each line could be easily identified in Text/hex format.

Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: DJ Omnimaga on February 16, 2011, 04:43:43 pm
One nice tool would be a PRIZM program to txt converter and vice-versa for those who wants to program in Notepad. Personally I prefer programming on a calc rather than the computer, but some people prefer the opposite.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: z80man on February 17, 2011, 01:44:12 am
One nice tool would be a PRIZM program to txt converter and vice-versa for those who wants to program in Notepad. Personally I prefer programming on a calc rather than the computer, but some people prefer the opposite.
Doesn't the OS already have that?
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: AngelFish on February 17, 2011, 01:45:36 am
Yeah, but it doesn't handle 2 byte characters very well. I don't think that's much of an issue, though, since Notepad would be little better with them.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: DJ Omnimaga on February 17, 2011, 02:53:59 am
I didn't know the calc itself could convert programs to txt files. Could you tell me how?

EDIT: Nvm, found your answer in another topic
Go into the program menu and scroll the bar over until you see "Save As." Then simply connect to your computer and look in the programs folder.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: DJ Omnimaga on February 18, 2011, 11:30:31 pm
Btw, Light_Spirit discovered a special functionality in the Prizm program transfer: When you send a program from an older calc to the Prizm, the Text coordinates are multiplied by 3, to fit the new screen resolution.

http://www.planet-casio.com/Fr/forums/lecture_sujet.php?id=9627&page=1#51753
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: m1ac4 on March 10, 2011, 07:34:11 am
I have a question about regression calculations.
What I want to do is when I calculate a statistical regression in a program, I would like to automatically place the resulting equation in a Y= equation of my choice.  What I would do in TI-Basic is this:
Code: (TI-Basic) [Select]
This by default uses L1 and L2 to calculate a linear regression and pastes the resulting equation in Y1
LinReg (ax+b) Y1
How would I do this in Prizm-Basic?
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: fxdev on March 17, 2011, 08:10:19 am
I could not find a way how to do this.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: m1ac4 on March 17, 2011, 09:56:56 am
 :( In that case, I'll just have to store the coefficients to some variables and work with that to get what I want.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: DJ Omnimaga on March 22, 2011, 04:04:17 pm
Btw in Casio BASIC is it better to use lists or matrices for tilemapping?
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: m1ac4 on March 22, 2011, 06:24:11 pm
A concept game I am working on uses both lists and a matrix for tilemapping.  The matrix is 7x21 to represent all of the tiles you can have.  I use a list to store the map data.  Using RLE compression and compressing that further by storing data for two instances of tile and repetition in a single list element, I can generally achieve at least 70% compression.  So to answer your question, using a matrix for uncompressed data would be good but since you are dealing with 147 real #s you would want to compress the data to store it.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: DJ Omnimaga on March 22, 2011, 07:34:50 pm
Isn't compression very slow, though? ???
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: m1ac4 on March 22, 2011, 07:41:47 pm
My estimate for what I did would be about seven seconds to compress and two seconds to decompress.  In this case that delay time is reasonable (drawing the tilemap to the screen takes just over 10 seconds because of the Locate command).
I think a two second lag time to decompress is worth saving around 80% of space in what I am doing.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: DJ Omnimaga on March 22, 2011, 07:43:19 pm
Well if it's 2 second to decompress I guess it's fine then. Do you have any source code to do that?
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: z80man on March 23, 2011, 01:01:34 am
I always thought a string was best for tilemapping. But I'm not sure yet what is the equivalent of the sub() for Casio Basic.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: m1ac4 on March 23, 2011, 09:58:01 am
I think that the StrMid( command would be the equivalent.  Syntax would be StrMid(string,index,length)
@DJ_O: I timed decompression with a stopwatch and it comes out to approximately 3 seconds (I really need to stop observing the run indicator as a timer since perception can be inaccurate).  I can get the source code off of my calc but I don't have the time at the moment (school) and I need include a short explanation with it too.

Edit: I had considered using strings but I have never done this before and I wanted to try storing the data in a separate list file to attempt to prevent the average user from accidentally corrupting it.  I'll have to look into using strings at another time.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: m1ac4 on March 24, 2011, 07:44:05 pm
Since DJ asked, I retrieved the code from my calculator and documented it.  Keep in mind that I ripped some of this out of larger programs but the complete routines are included.  Any advice that you can provide would be most helpful in helping me become a better Basic programmer so feel free to provide it if you wish.  Thanks in advance.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: DJ Omnimaga on March 24, 2011, 09:28:14 pm
I always thought a string was best for tilemapping. But I'm not sure yet what is the equivalent of the sub() for Casio Basic.
Yeah I wasn't sure as well. I checked a tutorial on Planet Casio but it seemed to miss such command. Maybe StrMid as what m1ac4 says.

I am curious how fast reading from string is... if it's fast enough, I wonder if there could be some form of scrolling games. On the 83+ we can't do that much because the farther you get into the string, the slower it gets.

Btw thanks for the routine, I'll have to check it later.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: AngelFish on March 29, 2011, 12:18:35 am
I have a question about regression calculations.
What I want to do is when I calculate a statistical regression in a program, I would like to automatically place the resulting equation in a Y= equation of my choice.  What I would do in TI-Basic is this:
Code: (TI-Basic) [Select]
This by default uses L1 and L2 to calculate a linear regression and pastes the resulting equation in Y1
LinReg (ax+b) Y1
How would I do this in Prizm-Basic?

Use the "Y= Type" token, then do <expression>->Y1, where the Y is accessed through Vars F4 Y.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: m1ac4 on March 29, 2011, 07:30:57 am
Thanks.  However, my question was more to do with regression calculation copying than with simply putting an equation into the Y= editor.  If you calculate a regression in statistics mode you see the results plus the option to copy the equation to the editor by pressing F6 and selecting the equation.  This works fine outside of a program but I have no idea how to do it this direcly inside of a program.  Unless found otherwise, I will have to manually store the generated coeffecients to some variables and then insert the equation (something along the lines of "Ax+b", "Ax2+bx+c" ect.) with the method that you have described.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: AngelFish on March 29, 2011, 11:25:11 am
Yeah, as far as I've seen, the regression equation is impossible to plot automatically. The BASIC really needs better interactions among its variables.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: fxdev on April 19, 2011, 09:32:59 am
Some BASIC tutorials and tricks (in German): http://www.casiocalc.org/?showtopic=5469
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: m1ac4 on April 21, 2011, 10:03:51 am
These things look quite useful, thanks./me bookmarks google translate
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: Spyro543 on April 29, 2011, 05:21:36 pm
Where can I find some physics tutorials? (bouncing, etc.)

And how about using actual sprites instead of text or graphs? Is this possible in programs? I know it's possible in add-ins...
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: z80man on April 30, 2011, 03:47:31 am
Um the problem with Casio BASIC is that drawing is really slow and I mean really slow :P I don't know about the fx 9860g, but the Prizm has a large set of special characters in which many could pass as sprites. The only issue is that special characters glitch when on the right side of the screen. Also for other drawing commands I've heard its must faster to use plotting than individual lines, but I've never used that before.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: DJ Omnimaga on May 17, 2011, 03:39:52 am
Graphs can be drawn, but I haven't experiemented with that yet in basic. There is also something called dynamic graphs which are supposed to move or something. Just from the graph menu I was able to get some interesting color effects not normaly availible in basic. Its also relativily fast. Faster than the 83+.  :D
(http://img.removedfromgame.com/imgs/1-DispCap1.bmp)
Could you tell me how you did that by the way? I tried in the Dynamic Graphing app and couldn't find out how :/ You should explain step by step and tell me which key to press or something.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: JosJuice on May 17, 2011, 10:51:49 am
Graphs can be drawn, but I haven't experiemented with that yet in basic. There is also something called dynamic graphs which are supposed to move or something. Just from the graph menu I was able to get some interesting color effects not normaly availible in basic. Its also relativily fast. Faster than the 83+.  :D
(http://img.removedfromgame.com/imgs/1-DispCap1.bmp)
Could you tell me how you did that by the way? I tried in the Dynamic Graphing app and couldn't find out how :/ You should explain step by step and tell me which key to press or something.
Do you need help with getting that specific pattern in Dyna Graph, or just help with using Dyna Graph? It doesn't really look like this pattern was made in Dyna Graph, because I don't think it's supposed to move...
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: DJ Omnimaga on May 17, 2011, 02:12:11 pm
He did that in DynaGraph. I am trying to figure out how to recreate it. I worry that my calc OS has some glitch, though, because two of the options there did nothing at all and there was no graph option.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: JosJuice on May 17, 2011, 02:17:53 pm
Well, I'm not really sure how he did that, but to use Dyna Graph:

First, type an equation that works. Not all of them work, and I don't know which ones because I suck at math. You can find some that work under "BUILT-IN" (F5). (Try the first one if you're not sure which one you want.) Now, select VAR (F4). You can change settings here if you want to, or just press "DYNA" (F6) to start. It might take a while for it to load - every step of the animation is rendered before the beginning of the animation starts being displayed.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: DJ Omnimaga on May 17, 2011, 02:19:20 pm
How long does it take to load? O.O
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: JosJuice on May 17, 2011, 02:20:32 pm
If you use five frames of animation (the default), roughly the time it takes to draw five graphs. It's around 5-7 seconds, I think.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: DJ Omnimaga on May 17, 2011, 02:49:51 pm
Oh wait nvm I had like 1e28 in B. No wonder why it never loaded. :P

Btw that looks cool, too bad it wouldn't be practical in games due to the speed.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: m1ac4 on May 18, 2011, 07:40:58 am
That doesn't look like dyna graph.  This looks like its the regular graph mode with several inequality equations.  The shading for these graphs overlap causing a dithering pattern that results in those extra colors.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: DJ Omnimaga on May 23, 2011, 12:15:19 am
Ah maybe. I wonder, then, if that could be used in games... I can imagine the creation of some dungeon graphics using a bunch of graphs on top of each others, although if the maps are complicated that might slow map loading down.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: z80man on May 23, 2011, 12:23:54 am
I've been working on making a program to demonstrate the abilities of graphs and how they can be used used in programs, but I still can't get the syntax right for changing the color of graphs. Otherwise I have every other function that I wanted to demonstrate in place. One way to draw graphs smoothly in a game is to use the command SimulOn which causes every graph to be drawn at the same time instead of separately.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: DJ Omnimaga on May 23, 2011, 12:32:37 am
I see. I hope there are no bugs. That said I checked the syntax of certain programs and it seems kinda hard to dechiper at first O.o
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: m1ac4 on May 23, 2011, 07:40:06 am
I've been working on making a program to demonstrate the abilities of graphs and how they can be used used in programs, but I still can't get the syntax right for changing the color of graphs. Otherwise I have every other function that I wanted to demonstrate in place. One way to draw graphs smoothly in a game is to use the command SimulOn which causes every graph to be drawn at the same time instead of separately.
Would this help? http://ourl.ca/9185/174354 (http://ourl.ca/9185/174354)
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: z80man on May 24, 2011, 01:12:42 am
Ah thanks that works. I'll see if I can demonstrate now the possibility of using graphs and plot functions to make games.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: DJ Omnimaga on May 25, 2011, 03:13:00 pm
Yeah I remember that. Anyway one idea I had for example would be if the Prizm supports X=, we could use 4 lines to form dungeon walls or something, although in some cases it might not be super practical, plus it would be slow.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: z80man on May 25, 2011, 11:56:52 pm
Yeah I remember that. Anyway one idea I had for example would be if the Prizm supports X=, we could use 4 lines to form dungeon walls or something, although in some cases it might not be super practical, plus it would be slow.
There is x= but I need to check if you can draw y= and x= at the same time. For something like that though I would recommend using the plot functions as though are probably faster. Graphs seem to be best for inequalities as they can do special color combinations. Dynamic graphs don't support inequalities but can quickly draw complicated animated effects one the the pre-rendering has finished. Also note that you can load a background image on all graph operations. I do have a pretty cool program already that uses dynamic graphs in which the camera quickly runs down a 3D tunnel. I'll post that soon once I clean it up a little.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: JosJuice on May 26, 2011, 01:12:31 am
Yeah I remember that. Anyway one idea I had for example would be if the Prizm supports X=, we could use 4 lines to form dungeon walls or something, although in some cases it might not be super practical, plus it would be slow.
There is x= but I need to check if you can draw y= and x= at the same time.
It's possible. I tried drawing one line at every edge of the screen... It worked, but the colors made it look all rainbow-y :P
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: DJ Omnimaga on June 12, 2011, 02:56:22 am
Hmm I wonder how you do that...

THat said I tried drawing many graphs and it wouldn't be very reliable for drawing dungeons, as the pattern is different for every line and I couldn,t figure out how to change it.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: sjasogun1 on September 23, 2011, 06:26:49 am
EDIT: Somehow the entire problem vanishes once I replace PlotOn with PxlChg. I don't know how, but it works.

I have a problem with the PxlTest command in an IF statement. I basically want a dot to move around the screen without running into any pixels that are on. But for some reason the dot will move regardless of whether or not there is a dot in the way. I used a different program to check it by breaking the program when the dot is next to a pixel in the on state, and it says it is on, no matter how i formulate it (PxlTest(B,A), PxlTest(B,A)=0, PxlTest(B,A)=/=1, etc) it will definitely say the pixel is on. But the IF-statement will simply ignore whatever state the pixel is in. I'll post the code for the IF-statement when the down button is pressed.

Code: [Select]
If Getkey=28 And PxlTest(64-B+1)=0
(the 64 is because I use PlotOn to place the pixel, making the Y-coordinate (the B variable in this case) inverted. Because the graph screen is 64 high this makes sure the coordinates are correct)
Then A->D:B->E:B+1->B
(D and E just remove the old dot image when it has moved)
IfEnd

If you think it's the inversion making it go wrong it isn't; as I said before I tested it by continuously using PxlChg on the pixel that should be tested to make sure the right pixel is tested. Can anybody help me?
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: pokemonrules9 on September 24, 2011, 04:02:37 pm
I just started in Casio-Basic and I seem to be having some problems.  I'm starting on some simple text-based games, and I'm trying to clear the screen when the F1 key is pressed.  The text appears, but a 0 shows up in the upper right hand corner, and it won't do anything.  I feel like I've tried everything, but nothing is working!  :'( Can someone tell me what I'm doing wrong?
Spoiler For Spoiler:
Locate 4,4,"some text"
0->K
Getkey->K
If K=79
Then
ClrText
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: glrenden on September 24, 2011, 04:48:48 pm
great guys.. got some idea.. really big help.. wait i will fix mine..  :w00t:
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: flyingfisch on September 24, 2011, 04:48:59 pm
try:

Locate 4,4,"some text"
0->K
While K=0
Getkey -> K
If K=79
Then ClrText
WhileEnd
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: pokemonrules9 on September 24, 2011, 05:39:52 pm
try:

Locate 4,4,"some text"
0->K
While K=0
Getkey -> K
If K=79
Then ClrText
WhileEnd
Trying that gave me a syntax error on the last line...  ???
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: flyingfisch on September 24, 2011, 05:50:28 pm
Code: [Select]
Locate 4,4,"some text"
0->K
While K=0
Getkey -> K
If K=79
Then ClrText
IfEnd
WhileEnd

I forgot IfEnd :P

Here is a really good casio-BASIC tut: http://www.casiocalc.org/index.php?act=findpost&pid=31798
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: pokemonrules9 on September 24, 2011, 05:57:02 pm
IT WORKED! :D haha. Thank you for answering that simple question  :P
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: flyingfisch on September 24, 2011, 05:59:01 pm
Your welcome. and be sure to check out that tut.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: boot2490 on September 24, 2011, 06:23:57 pm
That looks almost JUST like TI BASIC!
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: flyingfisch on September 24, 2011, 06:58:37 pm
they are very similar...
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: sjasogun1 on September 29, 2011, 02:49:28 pm
They are similar, but I really feel TI-BASIC is the better programming language because of the ability to wrap strings around the screen, having the ability to check a certain part of a string (Casio-BASIC would need to extract the symbol from the string, store it into a seperate string and compare it with the comparison string) and the ability to use HEX codes to generate icons. Especially the last function got me jealous of TI-calc owners D: The fastest method of drawing a sprite on CASIO is storing the coordinates of the pixels into two lists and drawing them all using Scatter,List 1,List 2 (also with some other things before and after it I can't remember) and changing the V-Window settings to move the sprite around.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: JosJuice on September 30, 2011, 08:53:52 am
the ability to use HEX codes to generate icons. Especially the last function got me jealous of TI-calc owners D:
That's not an actual TI-BASIC feature. The program Doors CS makes it work when you open files using it, but in all other cases, you can't have an icon.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: m1ac4 on September 30, 2011, 09:45:28 am
They are similar, but I really feel TI-BASIC is the better programming language because of the ability to wrap strings around the screen
You can do that in a complicated fashion with the quotation marks (e.g. "String that is more than 21 characters long").  Just not with Locate.
... having the ability to check a certain part of a string (Casio-BASIC would need to extract the symbol from the string, store it into a seperate string and compare it with the comparison string
That is what StrCmp( is for.  Actually, I'm not quite sure what you mean here.

I find myself more challenged by Casio Basic.  It does seem a little bit more awkward sometimes.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: sjasogun1 on October 06, 2011, 07:54:28 am
On the casio you have to extract the part of the string you need with StrMid(, assign it to another string and then use StrCmp to compare that one with a "test" string that would contain the character you want to check. It's really obnoxious and slow so I don't use it.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: m1ac4 on October 06, 2011, 09:58:00 am
What I have done several times for such a situation is
Code: [Select]
StrCmp(StrMid(Str #,<index>,<length>),"String")=0Where "String" is whatever I am testing for (either a string # or something like "A").  This would combine all of the steps and run much faster.  It is somewhat of a handful but it works.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: pokemonrules9 on October 18, 2011, 10:40:42 pm
I've been making some simple programs the last few days.  I made a snake game and a few others like that.  Recently, I've been working on more complex programs and have ran out of variables to use.  I tried to use matrices, and they're not really working.  I did what the tutorial said to, and it keeps telling me that i have a syntax error right after i say "Mat".  Could anyone give me an example of how a matrix would look?
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: Jonius7 on October 19, 2011, 12:53:30 am
I used to program some casio basic so here i can tell you (ps: it was for a 9850, should also work for 9860
eg for a 4x4 matrix: (EDITTED)  [[0,0,0,1][0,0,1,0][0,1,0,0][1,0,0,0]]-> Mat A
would create the matrix:
0 0 0 1
0 0 1 0
0 1 0 0
1 0 0 0
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: m1ac4 on October 19, 2011, 07:43:40 am
There is an additional square bracket at the beginning that is necessary.  In Jonius7's example it would start like [[0,0,0,1][0,0 ...
Also, pokemonrules9 do you know about the variables theta and r?  It took me a while to realize I could use them in programs and having those additional two can be useful.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: Jonius7 on October 19, 2011, 08:20:36 am
There is an additional square bracket at the beginning that is necessary.  In Jonius7's example it would start like [[0,0,0,1][0,0 ...
Also, pokemonrules9 do you know about the variables theta and r?  It took me a while to realize I could use them in programs and having those additional two can be useful.
Oh yes, i've forgotten about that. I've forgotten quite a lot of casio basic i once knew.
The way I learned Casio BASIC was to look at other people's games. I would download the cat file for 9850 and  open it in a word document. the code to type was readable. and i had to type it manually anyway, as i had no link cable. So when I typed Sean Tan's Star Wars game (about 20000 bytes) I managed to reduced it by 4000 bytes or so by using a list instead of a one column matrix.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: flyingfisch on October 19, 2011, 09:51:22 am
a mistake that newbies usually make is to say some thing like: 1 -> Mat A[1,1]

when actually, you need to do this first to prevent a mem error: [[0][0]] -> Mat A

That creates a matrix. 1-> Mat A[1,1] does not create a matrix, so if it doesn't exist, you get a mem error.

Just thought i'd add that info, since a lot of BASIC progs have that problem.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: Jonius7 on October 20, 2011, 09:33:27 am
There are other ways to create a matrix other than [[0][0]] -> Mat A, however, I have not programmed casio for 2 years and have forgotten. Something like Dim Mat A, or setting the number of rows and columns
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: m1ac4 on October 20, 2011, 09:54:14 am
There are other ways to create a matrix other than [[0][0]] -> Mat A, however, I have not programmed casio for 2 years and have forgotten. Something like Dim Mat A, or setting the number of rows and columns
You are right, the syntax is {<rows>,<columns>} -> Dim Mat A.
It's also worth noting that the closing brackets at the end are optional (e.g [[0][0->Mat A).  It looks messier but it saves space.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: Jonius7 on October 20, 2011, 10:08:19 am
I know there are ways to check for particular values in a matrix:
And display certain characters as a result:
Eg: a 5 x 5 matrix

Code: [Select]
[[5][5]]->Mat A
[[1,2,3,1,2][2,3,1,2,1][3,1,2,1,2][1,2,1,2,3][2,1,2,3,1]]->Mat A
For 1->A To 5
For 1->B To 5
Mat A[A,B] = 1 => Locate B,A, "O"
Mat A[A,B] = 2 => Locate B,A, "M"
Mat A[A,B] = 3 => Locate B,A, "N"
Next
Next

Try and see what that says
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: DJ Omnimaga on October 26, 2011, 04:45:10 am
So has anyone figured out a way to have dynamic coloring? I mean for example if I got the code:

Code: [Select]
For 1->A To 10
Red Locate 1,1,"HELLO WORLD!"
Red Locate 1,2,"THIS IS A TEST"
Red Locate 1,3,"PROGRAM!"
Red Locate 1,4,"BUT IT TAKES"
Red Locate 1,5,"WAY TOO MUCH"
Red Locate 1,6,"BLEEPING SPACE"
Red Locate 1,7,"OPTIMIZE PLZ!"
Magenta Locate 1,1,"HELLO WORLD!"
Magenta Locate 1,2,"THIS IS A TEST"
Magenta Locate 1,3,"PROGRAM!"
Magenta Locate 1,4,"BUT IT TAKES"
Magenta Locate 1,5,"WAY TOO MUCH"
Magenta Locate 1,6,"BLEEPING SPACE"
Magenta Locate 1,7,"OPTIMIZE PLZ!"
Blue Locate 1,1,"HELLO WORLD!"
Blue Locate 1,2,"THIS IS A TEST"
Blue Locate 1,3,"PROGRAM!"
Blue Locate 1,4,"BUT IT TAKES"
Blue Locate 1,5,"WAY TOO MUCH"
Blue Locate 1,6,"BLEEPING SPACE"
Blue Locate 1,7,"OPTIMIZE PLZ!"
Cyan Locate 1,1,"HELLO WORLD!"
Cyan Locate 1,2,"THIS IS A TEST"
Cyan Locate 1,3,"PROGRAM!"
Cyan Locate 1,4,"BUT IT TAKES"
Cyan Locate 1,5,"WAY TOO MUCH"
Cyan Locate 1,6,"BLEEPING SPACE"
Cyan Locate 1,7,"OPTIMIZE PLZ!"
Green Locate 1,1,"HELLO WORLD!"
Green Locate 1,2,"THIS IS A TEST"
Green Locate 1,3,"PROGRAM!"
Green Locate 1,4,"BUT IT TAKES"
Green Locate 1,5,"WAY TOO MUCH"
Green Locate 1,6,"BLEEPING SPACE"
Green Locate 1,7,"OPTIMIZE PLZ!"
Yellow Locate 1,1,"HELLO WORLD!"
Yellow Locate 1,2,"THIS IS A TEST"
Yellow Locate 1,3,"PROGRAM!"
Yellow Locate 1,4,"BUT IT TAKES"
Yellow Locate 1,5,"WAY TOO MUCH"
Yellow Locate 1,6,"BLEEPING SPACE"
Yellow Locate 1,7,"OPTIMIZE PLZ!"
Next

Pretty repetitive, right? O.O

Well I wonder if I can simply have something like the following pseudo code?
Code: [Select]
For 1->A To 10
For 1->B To 6
If B=1
Then
<code to set color to Red>
EndIf
If B=2
Then
<code to set color to Magenta>
EndIf
If B=3
Then
<code to set color to Blue>
EndIf
If B=4
Then
<code to set color to Cyan>
EndIf
If B=5
Then
<code to set color to Green>
EndIf
If B=6
Then
<code to set color to Yellow>
EndIf
<color set> Locate 1,1,"HELLO WORLD!"
<color set> Locate 1,2,"THIS IS A TEST"
<color set> Locate 1,3,"PROGRAM!"
<color set> Locate 1,4,"BUT IT TAKES"
<color set> Locate 1,5,"WAY TOO MUCH"
<color set> Locate 1,6,"BLEEPING SPACE"
<color set> Locate 1,7,"OPTIMIZE PLZ!"
Next
Next

I forgot if we need the Then/EndIf when there's only one command to execute, since it has been so long since I last coded in Casio BASIC, but you get the idea. It might also be very helpful for tilemap generation.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: fxdev on October 26, 2011, 09:36:50 am
Here's my solution (Replace '_' by ' '):

Code: [Select]
"HELLO WORLD!________
_THIS IS A TEST______
_PROGRAM!____________
_BUT IT TAKES________
_WAY TOO MUCH________
_BLEEPING SPACE._____
_OPTIMIZE PLZ!_______
_"->Str 1
ClrText:0->I
Do:I+1->I:I>7=>1->I
For 1->J To 7
I=1=>Black Locate 1,J,Str 1
I=2=>Blue Locate 1,J,Str 1
I=3=>Red Locate 1,J,Str 1
I=4=>Magenta Locate 1,J,Str 1
I=5=>Green Locate 1,J,Str 1
I=6=>Cyan Locate 1,J,Str 1
I=7=>Yellow Locate 1,J,Str 1
StrRotate(Str 1,21)->Str 1
Next
LpWhile Getkey=/=47
ClrText:" "
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: DJ Omnimaga on October 26, 2011, 04:58:04 pm
Wait I thought Locate had no word-wrapping? ???

EDIT Actually nvm I didn't notice the sub-string command stuff.

EDIT That works, thanks :D

EDIT THat string rotate command is just cool! O.O
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: z80man on October 27, 2011, 12:58:37 am
I like how casio BASIC has all those string based functions similar to the high level ones found in languages such as C. I find them useful for heavily text based programs such simple CAS's and other math/science programs.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: DJ Omnimaga on October 27, 2011, 01:24:19 am
If it wasn't for the fact Locate lacks word-wrap, some of them could be very handy for scrolling.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: sjasogun1 on December 08, 2011, 04:42:34 am
I've been attempting to make a 'protected' program. I want people to be able to run it at any time but I want to prevent them from transferring the program(s) to other calculators. Unfortunately the built-in password function of the fx-9860 GII only prevents one from editing the program, not from transferring it. I've been trying to think of ways to make sure people can't transfer the program to others but so far to no avail.

The problem with an idea such as a password built in the program I modify for each person I give the program to is that the password will just be copied along with the program. Does anybody know a solution to this problem or whether or not there even is one?
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: Eiyeron on December 08, 2011, 11:04:07 am
Nope, sorry. i dunno how I could block a program. Send a backup will you send the totality of your ram, and thus what that's let's the program start.

You could with C progs, but for basic, i Think no.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: z80man on December 10, 2011, 02:39:05 am
Unless you could call a C lib from a basic program then no. Such lib would need someway to individually identify the calculator it runs on such as for example checking a unique hardware id
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: sjasogun1 on January 18, 2012, 07:46:55 am
In the guide of the Casio fx-9860 GII I found a list of data items that can be sent over communications. In regards to my previous question a data type that is missing from this list could be used to contain a unique password of sorts. The problem is that I haven't found any data types not present on this list. But since there is a list in the first place I am sure they must exist. Do any of you see a data item missing from this list?

Spoiler For Spoiler:
ALPHA MEM (alpha memory contents)
<CAPTURE> (Capture memory group)
CAPT n (Capture memory (1 to 20) data)
CONICS (Conics setting data)
DYNA MEM (Dynamic Graph functions)
EQUATION (Equation calculation coefficient values)
E-CON2 (E-CON2 setup memory contents)
FINANCIAL (Financial data)
<F-MEM> (Function memory group)
F-MEM n (Function memory (1 to 20) contents)
<G-MEM> (Graph memory group)
G-MEM n (Graph memory (1 to 20) contents)
<LISTFILE> (List file group)
LIST n (List memory (1 to 26 and Ans) contents)
LIST FILE n (List file memory (1 to 6) contents)
<MATRIX> (Matrix group)
MAT n (Matrix memory (A to Z and Ans) contents)
<PICTURE> (Picture memory group)
PICT n (Picture (graph) memory (1 to 20) data)
<PROGRAM> (Program group)
Program names (Program contents (All programs are listed.))
RECURSION (Recursion data)
SETUP (Setup data)
STAT (Stat result data)
<STRING> (String memory group)
STR n (String memory (1 to 20) data)
SYSTEM (OS and data shared by applications (clipboard, replay, history, etc.))
<S-SHEET> (Spreadsheet group)
Spreadsheet data names (Spreadsheet data (All spreadsheet data are listed.))
TABLE (Table data)
<V-WIN> (V-Window memory group)
V-WIN n (V-Window memory (1 to 6) contents)
Y=DATA (Graph expressions, graph draw/non-draw status, V-Window contents, zoom factors)

Original data can be found through the link down here, page 318 and 319.
http://education.casio.com/resource/pdfs/GII%20User%20Guide.pdf
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: sjjubb1989 on August 21, 2013, 07:20:04 pm
Everytime I try to use LOCATE 1,1, "test" I never am able to. It always says "Syntax Error".

I upgraded my FX-9750GII to the FX-9860GII operating system, is this a possible reason that LOCATE always gives a syntax error?
Title: Re: Re: Getting started in Casio-Basic? You can ask here.
Post by: DJ Omnimaga on August 22, 2013, 01:00:08 am
Make sure there's no space between Locate 1,1, and "text". However I didn't code in Casio Basic for a year so I might not remember the real syntax well anymore. Anyway also make sure to select Locate from program commands, not type it letter by letter.
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: Eiyeron on August 22, 2013, 03:31:24 am
Yup, there isn't any space between the comma and the text
Title: Re: Getting started in Casio-Basic? You can ask here.
Post by: Jonius7 on August 24, 2013, 01:29:15 am
Necroposts! Can't believe I answered in this forum 2 years ago.
Yeah, pretty much any special command should not be typed letter for letter, rather go through the menus and locate the commands.