Hi all,
The last time I had some fun digging out my Users Manual and doing some Super Basic programming using Qemulator on OS X. I tried to define a procedure which opens channels and windows with various formats on the screen. The procedure should be flexible and I want it to transmitt values in order that with a single command and 3 numbers I can open the channel, define the x-position and the colour. This causes errors as I don't know the right syntax for the scr_ command.
Example:
100 openchannel 4,120,3
110 def proc openchannel (number, xposition, colour)
120 open#number, scr_200x200axpositionx40
130 paper#number, colour: cls #number
140 end def
Any help?
Best,
Thor
Syntax Error scr_ command
Re: Syntax Error scr_ command
Hi,
try something like:
This should work.
The "SCR" syntax is
scr_<width>x<height>a<xpos>x<ypos>
Cheers,
Tobias
try something like:
Code: Select all
DEFine FUNCtion OpenChannel(x, y, w, h)
LOCal c$, i
c$="scr_" & w & "x" & h & "a" & x & "x" & y
i = FOPEN (c$)
RETurn i
END DEFine
The "SCR" syntax is
scr_<width>x<height>a<xpos>x<ypos>
Cheers,
Tobias
ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
Re: Syntax Error scr_ command
Think of a device name as an unquoted string. It will work perfectly well if you put in quotes, so something like OPEN #3,"scr_512x256a0x0" is the same as far as you are concerned as OPEN#3,scr_512x256a0x0 and also LET a$="scr_512x256a0x0":OPEN #3,a$
If you specify the name as a string, the QL will understand it. It will work out what you meant if it can, but mixing unquoted strings, numeric variables and quoted strinfg might not work. Just convert all unquoted strings to quoted strings, then string coercion will do its best to make sense of the mix of strings and numbers.
So something like OPEN #3,scr&variable might not work because the QL gets confused between unquoted strings and variable names. I don't know if this is going too advanced for this explanation, but the QL sometimes treats unquoted strings as something called TYPE NAME. In other words, in an unquoted string like OPEN#3,SCR , SCR is treated almost like a variable name which has not yet had a value assigned to it, so the QL converts it to a string like "SCR".
I hope this makes sense!
Dilwyn
If you specify the name as a string, the QL will understand it. It will work out what you meant if it can, but mixing unquoted strings, numeric variables and quoted strinfg might not work. Just convert all unquoted strings to quoted strings, then string coercion will do its best to make sense of the mix of strings and numbers.
So something like OPEN #3,scr&variable might not work because the QL gets confused between unquoted strings and variable names. I don't know if this is going too advanced for this explanation, but the QL sometimes treats unquoted strings as something called TYPE NAME. In other words, in an unquoted string like OPEN#3,SCR , SCR is treated almost like a variable name which has not yet had a value assigned to it, so the QL converts it to a string like "SCR".
I hope this makes sense!
Dilwyn
--
All things QL - https://dilwyn.qlforum.co.uk/index.html
All things QL - https://dilwyn.qlforum.co.uk/index.html
Re: Syntax Error scr_ command
Thor,
and if you're in need of a manual, the keywords and concepts sections for QPC2 that you can find on Marcel's site (http://www.kilgus.net/qpc/QPC_Keywords.pdf) are, in most cases, also applicable to a standard QL.
Tobias
and if you're in need of a manual, the keywords and concepts sections for QPC2 that you can find on Marcel's site (http://www.kilgus.net/qpc/QPC_Keywords.pdf) are, in most cases, also applicable to a standard QL.
Tobias
ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
-
- Trump Card
- Posts: 199
- Joined: Mon Jan 10, 2011 5:08 pm
Re: Syntax Error scr_ command
@Dilwyn @Tobias,
Thank you for you help and the info. I'll see if I can improve my Super Basic programming skills
Best,
Thor
Thank you for you help and the info. I'll see if I can improve my Super Basic programming skills
Best,
Thor