Tiny documentation error

Previous topic - Next topic

AndyH

Very minor documentation errors I've spotted.  Nothing end of the world but worth correcting for benefit of new users to the language.



SAVESPRITE - example code has an arrow char and " missing the ; I presume :)

Code (glbasic) Select
// SaveSprite
FOR i = 0 TO 1000
SETPIXEL RND(100), RND(100), RND(1677215)
NEXT
GRABSPRITE 0, 0,0, 100,100
SAVESPRITE "ugly.bmp", 0;

// MSPaint?
SHELLCMD("explorer.exe ugly.bmp", FALSE, TRUE, i)
This one not an error, but could help new users.  In help Index there is an entry for "Types" and "TYPE".  "TYPE" is more informative and gives an example, where as "Types" appears in the Contents - Tutorials section of the help and will likely be what the user sees first (I certainly did).  Could you add a link to the "TYPE" help page in the Refs section of "Types" (if I haven't confused you enough already ;) )


For the UCASE$ help topic the example has a bit of odd colour coding and ' COLOR="white">' in there;

Code (glbasic) Select
// UCASE$ - LCASE$
PRINT UCASE$("123 - miniMIN"), 0, 20
PRINT LCASE$("123 - MAXImax" COLOR="white">), 0, 40
SHOWSCREEN
MOUSEWAIT
LCASE$ has the wrong help page (it is a copy of the MIN help:

Code (glbasic) Select
LCASE$()

num#$ = MIN(a#$, b#$)
Returns the smaller value of a#$ and b#$.



// MIN / MAX
   a = RND(100)
   b = RND(100)
   PRINT "a: "+a+" b: "+b, 0, 100
   PRINT "max: " + MAX(a,b), 0,120
   PRINT "min: " + MIN(a,b), 0, 140
   SHOWSCREEN
   MOUSEWAIT

bigsofty

Well spotted Andy ;)
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

AndyH

More doc errors:


DIM refers to unknown variable 'feld' in its code example:


Code (glbasic) Select
DIM array[8][8]
FOR x=0 TO 7
    FOR y=0 to 7
        feld [x][y] = x*100 + y
    NEXT
NEXT

PRINT array [4][5], 100, 100
SHOWSCREEN
MOUSEWAIT
The GETDIGI...() help topic (found in Commands by Category -> Input-Output) appears to have the help for INKEY$ instead.  What is GETDIGI... ?

Code (glbasic) Select
GETDIGI...()

a$=INKEY$( )

This command retuns a inputed character rathen than a key-ID as KEY( ) would do. KEY( ) is faster, but INKEY$( ) offers nice ways for a user defined INPUT function.

Sample:


// ------------------------------------------------------------- //
// INPUT via INKEY$ - Input with starfield background
// ------------------------------------------------------------- //

// Steup Starfield data
DIM spd[640]
DIM sy[640]
 FOR x=0 TO 639
  spd[x]=RND(3)+1
  sy[x]=-RND(480)
 NEXT

 name$=""
 WHILE TRUE
  IF KEY(14)
   MIDSTR name$, name$, 0, LEN(name$)-1 // Backspace
  ELSE
   in$=INKEY$()
   IF in$<>"" THEN name$=name$+in$
  ENDIF
  PRINT name$, 0, 100
  GOSUB ShowStarfield
  SHOWSCREEN
 WEND
END


// ------------------------------------------------------------- //
// -=#  SHOWSTARFIELD  #=-
// ------------------------------------------------------------- //
SUB ShowStarfield:
LOCAL x
 FOR x=0 TO 639
  c=spd[x]
  y=sy[x]
  y=y+c
  IF y>480 THEN y=0
  sy[x]=y
  c=c*64 -1
  SETPIXEL x, y, RGB(c, c, c)
 NEXT
ENDSUB // SHOWSTARFIELD

Kitty Hello

OK, fixed in next update. GetDigi only links to GetJoy...

AndyH

Typo on types ;)



TYPE

TYPE name
members
ENDTYPE

With the TYPE command you can create data structures. A detailed description can be found in the tutorials.
In order to create a varialbe of type 'name' you type (no pun intended):

Kitty Hello