Omnimaga
Calculator Community => Casio Calculators => Topic started by: DJ Omnimaga on February 03, 2014, 07:11:39 pm
-
Could someone explain to me why the following PRIZM BASIC code works,
For 1->X To 300
For 1->Y To 216
Blue PxlOn 1,1
Next
Next
but not the following?
For 1->X To 300
For 1->Y To 216
Blue PxlOn X,Y
Next
Next
The 2nd piece of code gives the following error: "Input value must be integer"?
Is this a PRIZM glitch or is it actually impossible to use variables as arguments for pixel drawing commands? O.O
-
Did you try using just the body of the loop?
-
Did you try specifying the step of the loop to 1, like this:
For 1->X To 300 Step 1
For 1->Y To 216 Step 1
Blue PxlOn X,Y
Next
Next
My guess is the basic incremental value is set to something other than 1, but I could be mistaken. I suggest you check it out.
-
I tried using PxlOn X,1 alone with a 1->X before and no loop and I still got the error. So the issue isn't related to the For loops.
-
Running ClrGraph:For 1→X To 1:PxlOn (Int X),(Int X):Next gives a Domain Error; ClrGraph:1→X:PxlOn (Int X),(Int X) works fine.
I made this DISTGRPH a while ago, and it works:
?→I:ClrGraph
For 0→J To I
PxlOn Intg (93.5×J÷I+(Intg (Ran# ×187×(I-J)÷I)+1)),Intg (189.5×J÷I+(Intg (Ran# ×379×(I-J)÷I)+1))
Next
(Aside: Why is there a space after Ran#?)
-
Nope, even if I use something like PxlOn (Int X),(Int Y) or PxlOn (Intg X),(Intg Y) I still get the same error as before.
Your program, on the other hand (the last one in code tag you posted), works fine.
-
Maybe because PxlOn overrides the both variables?
-
Aaah the joys of casio basic, where all the graphic functions use X and Y as global variables.
Actually the use for this override is justified by the function plot:
ViewWindow 1, 127, 0, 1, 63, 0
64 -> X
32 -> Y
Plot X, Y [triangle thingy]
Locate 1, 1, X
Locate 2, 1, Y
Using the display instruction on a Plot X, Y function allows the user to move a cursor around the screen and effectively modify the X and Y coordinates (confirmed by pressing EXE)
This is actually very useful for point and click games, or for graphical interfaces (especially on Casio g25 calculators (can't remember the international name), where there weren't any kind of decent Input/Output functions)
Since this function was created before any kind of graphical functions on the latest calculator models, the later functions inherited from this behaviour (just like the SH3 calculators' BASIC graphical screen inherited from the 127*63 resolution of the previous models, despite the physical screen being 128*64)
-
The graphical screen dimension is odd for the same reason in TI: have a center defined by a pixel and have even space after splitting the screen with the graphic axes
-
Aaah the joys of casio basic, where all the graphic functions use X and Y as global variables.
Actually the use for this override is justified by the function plot:
ViewWindow 1, 127, 0, 1, 63, 0
64 -> X
32 -> Y
Plot X, Y [triangle thingy]
Locate 1, 1, X
Locate 2, 1, Y
Using the display instruction on a Plot X, Y function allows the user to move a cursor around the screen and effectively modify the X and Y coordinates (confirmed by pressing EXE)
This is actually very useful for point and click games, or for graphical interfaces (especially on Casio g25 calculators (can't remember the international name), where there weren't any kind of decent Input/Output functions)
Since this function was created before any kind of graphical functions on the latest calculator models, the later functions inherited from this behaviour (just like the SH3 calculators' BASIC graphical screen inherited from the 127*63 resolution of the previous models, despite the physical screen being 128*64)
Oh wow, now that you mention it, I just realized that my issue was because I was using X and Y. I tried with different variables and now it works.
The 83+ had a similar issue with Y, but not with X. Since I always thought it was a bug with ClrDraw, I didn't realize a similar issue was present on Casio models.
Anyway thanks for the tip!