Documentation?

Previous topic - Next topic

Cliff3D

#30
From the web manual, the tutorial "The First Game" tells you to compile and run this code:

Code (glbasic) Select
// --------------------------------- //
// Project: OneMore

DIM playfield[10][10]
level = 0

// Main game
main:
MOUSESTATE mx, my, b1, b2
PRINT "<=", mx, my-8
SHOWSCREEN
GOTO main
END


This will not compile, much less run, issuing these errors instead:

*** Configuration: WIN32 ***
precompiling:
GPC - GLBasic Precompiler V.8.044 SN:fa03fc9b - 2D, WIN32
"OneMore.gbas"(23) warning : probably unassigned variable : mx
"OneMore.gbas"(23) warning : probably unassigned variable : my
"OneMore.gbas"(23) warning : probably unassigned variable : b1
"OneMore.gbas"(23) warning : probably unassigned variable : b2
"OneMore.gbas"(18) error : variable is not explicitly defined : playfield


unassigned variables shouldn't be a major problem (but they arren't declared anywhere?), but does DIM not define playfield?

MrTAToad

People can fill that in as we go along...

MrTAToad

Quote from: Cliff3D on 2010-Sep-07
From the web manual, the tutorial "The First Game" tells you to compile and run this code:

Code (glbasic) Select
// --------------------------------- //
// Project: OneMore

DIM playfield[10][10]
level = 0

// Main game
main:
MOUSESTATE mx, my, b1, b2
PRINT "<=", mx, my-8
SHOWSCREEN
GOTO main
END


This will not compile, much less run, issuing these errors instead:

*** Configuration: WIN32 ***
precompiling:
GPC - GLBasic Precompiler V.8.044 SN:fa03fc9b - 2D, WIN32
"OneMore.gbas"(23) warning : probably unassigned variable : mx
"OneMore.gbas"(23) warning : probably unassigned variable : my
"OneMore.gbas"(23) warning : probably unassigned variable : b1
"OneMore.gbas"(23) warning : probably unassigned variable : b2
"OneMore.gbas"(18) error : variable is not explicitly defined : playfield


unassigned variables shouldn't be a major problem, but does DIM not define playfield?

How DIM is used was changed a fair while after that tutorial.  Howadays, in order to make sure it complies with explicit declarations, you need something line :

Code (glbasic) Select
LOCAL playfield%[]; DIM playfield%[10][10]

Cliff3D

Quote from: MrTAToad on 2010-Sep-07
How DIM is used was changed a fair while after that tutorial.  Howadays, in order to make sure it complies with explicit declarations, you need something line :

Code (glbasic) Select
LOCAL playfield%[]; DIM playfield%[10][10]

I added:

Code (glbasic) Select
LOCAL playfield%, level, mx, my, b1, b2

and now get these errors:

compiling:
C:\DOCUME~1\Cliff\LOCALS~1\Temp\glbasic\gpc_temp0.cpp: In function `int __GLBASIC__::__MainGameSub_()':
C:\DOCUME~1\Cliff\LOCALS~1\Temp\glbasic\gpc_temp0.cpp:93: error: no matching function for call to `DIM(DGNat&, int, int)'
C:/Program Files/GLBasic/Compiler/platform/Include/glb.h:794: note: candidates are: void __GLBASIC__::DIM(__GLBASIC__::DGIntArray&, DGNat, DGNat, DGNat, DGNat)
C:/Program Files/GLBasic/Compiler/platform/Include/glb.h:795: note:                 void __GLBASIC__::DIM(__GLBASIC__::DGNatArray&, DGNat, DGNat, DGNat, DGNat)
*** FATAL ERROR - Please post this output in the forum
_______________________________________
*** Finished ***
Elapsed: 1.8 sec. Time: 23:02
Build: 0 succeeded.
*** 1 FAILED ***


This typifies why I started this thread. It's hard to learn from documentation when the documentation is wrong :(

(I was returning to the tutorials to learn about GLBasic, but instead I'm having to learn how to correct the manual so that I can learn from that?). This is now newbie-friendly :(

MrTAToad

The error message is ambigious here unfortunately.

You have defined playfield twice - once as an array and once as an integer, hence the error message.

However, I dont get that - I get : warning : variable already exists : playfield

Cliff3D

#35
ok -
Code (glbasic) Select
LOCAL playfield%[], level, mx, my, b1, b2 makes it work. So far :)

At: http://wiki.just-do-i-t.com/index.php?title=Variables could we have the variable types "sized" (eg accuracy and memory usage)?

MrTAToad


Cliff3D

#37
I tweaked your IDE page, you should review that.

I am working on documenting tutorial 10 as I go through - I am concerned that this Wiki is not flexible enough to format things well e.g. no {code}{/code} equivalent. Do we need to look elsewhere BEFORE we put too much effort in?

MrTAToad

There is

<source lang=glbasic>
</source>

for large bits of code.

okee

Also the font for the examples is very small, can that be easily adjusted ?
Android: Samsung Galaxy S2 -  ZTE Blade (Orange San Francisco) - Ainol Novo 7 Aurora 2
IOS: 2 x Ipod Touch (1G)

MrTAToad

Not that I know of

Moru

Quote from: okee on 2010-Sep-08
Also the font for the examples is very small, can that be easily adjusted ?

If you are using Opera you press the + key on the numpad. Firefox you hold ctrl and press + on the normal keypad. Internet Explorer you hold shift or control (forget which one) and use the mousewheel.

Moru

Great work on the wiki!

For those that wants to help but don't know how, there is help on the official page of mediawiki:

http://www.mediawiki.org/wiki/Help:Formatting

Cliff3D

Quote from: MrTAToad on 2010-Sep-08
There is

<source lang=glbasic>
</source>

for large bits of code.

Thanks, that's mostly an improvement - though light grey text on a white background (for keywoards) isn't the easiest combination to read, at least the code now stands out from the "chatty" text. I'll aim to do Tutorial 10 today, if I can, then perhaps go back to #1-9 if I get done.

Cliff3D

#44
Quote from: Cliff3D on 2010-Sep-08
ok -
Code (glbasic) Select
LOCAL playfield%[], level, mx, my, b1, b2 makes it work. So far :)

At: http://wiki.just-do-i-t.com/index.php?title=Variables could we have the variable types "sized" (eg accuracy and memory usage)?

It turns out that the code needed to be:

Code (glbasic) Select
GLOBAL  playfield%[], level
LOCAL mx, my, b1, b2, mousefree

DIM playfield[10][10]


I've updated the whole tenth tutorial now, fixing as I go along. I think in future it'll be easier to add to the Wiki if I'm not both trying to learn the product AND correct the tuorials (I'm starting to feel like a troublemaker pointing out the dozens of flaws in every nook and cranny). So tutorial 1 looks appealing to me for my next task.

Please check the new verison of tut #10 at:

http://wiki.just-do-i-t.com/index.php?title=10_The_First_Game