Omnimaga

Calculator Community => Casio Calculators => Topic started by: DJ Omnimaga on February 03, 2014, 07:11:39 pm

Title: PxlOn 1,1 works, but not PxlOn X,Y?? (PRIZM BASIC)
Post by: DJ Omnimaga on February 03, 2014, 07:11:39 pm
Could someone explain to me why the following PRIZM BASIC code works,

Code: [Select]
For 1->X To 300
For 1->Y To 216
Blue PxlOn 1,1
Next
Next

but not the following?

Code: [Select]
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
Title: Re: PxlOn 1,1 works, but not PxlOn X,Y?? (PRIZM BASIC)
Post by: blue_bear_94 on February 03, 2014, 08:29:37 pm
Did you try using just the body of the loop?
Title: Re: PxlOn 1,1 works, but not PxlOn X,Y?? (PRIZM BASIC)
Post by: Lunar Fire on February 03, 2014, 09:08:53 pm
Did you try specifying the step of the loop to 1, like this:

Code: [Select]
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.
Title: Re: PxlOn 1,1 works, but not PxlOn X,Y?? (PRIZM BASIC)
Post by: DJ Omnimaga on February 03, 2014, 09:54:43 pm
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.
Title: Re: PxlOn 1,1 works, but not PxlOn X,Y?? (PRIZM BASIC)
Post by: bb010g on February 03, 2014, 10:57:38 pm
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:
Code: [Select]
?→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#?)
Title: Re: PxlOn 1,1 works, but not PxlOn X,Y?? (PRIZM BASIC)
Post by: DJ Omnimaga on February 04, 2014, 12:28:43 am
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.
Title: Re: PxlOn 1,1 works, but not PxlOn X,Y?? (PRIZM BASIC)
Post by: Eiyeron on February 04, 2014, 08:40:37 am
Maybe because PxlOn overrides the both variables?
Title: Re: PxlOn 1,1 works, but not PxlOn X,Y?? (PRIZM BASIC)
Post by: Siapran on February 04, 2014, 10:01:22 am
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:
Code: [Select]
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)

Title: Re: PxlOn 1,1 works, but not PxlOn X,Y?? (PRIZM BASIC)
Post by: Eiyeron on February 04, 2014, 11:13:50 am
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
Title: Re: PxlOn 1,1 works, but not PxlOn X,Y?? (PRIZM BASIC)
Post by: DJ Omnimaga on February 04, 2014, 12:05:53 pm
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:
Code: [Select]
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!