Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - FutureCow

#101
Hi Gernot,

Just some minor corrections for the help file
1) In the "Types" tutorial section
Titel -> Title
Autor -> Author
Bibel -> Bible
BUCHs -> Books? (I'm assuming the buch is German)

2) DATA
defines the beginning of a data block

3) DELETE
the loop gets continued from the top

4) DIMDEL
will remove the last element

5) INTEGER
Cuts off the post comma values of a number -> Shouldn't "Comma" be "Full Stop"?

6) OPENFILE
occourence -> occurrence

7) I would like to suggest in the loadanim/loadsprite documentation that the fact that the ID numbers used are not unique to the one command but shared by both commands gets added.

It might be useful to have a "Documentation" suggestions/corrections section on the forum i. If there was a forum for it then people could suggest changes/additions, and if you agreed with the suggestion you could add the examples / corrections people posted when you had the time.

Cheers!
#102
I'm designing a new game like the old pipe mania (aka pipe dreams) but I need some help with the algorithm for game play.

My problem is a bit hard to describe so I've drawn some simplified pics of a level to try to explain it :D

The game requires the player to make an enclosed pipe system, joining water sources to outlets, and passing through certain switches. Depending on the level, some switches / pipes will already be placed, the player adds various combinations of pieces to complete the level requirements.

In the attached image1 I have coloured some pieces to explain them
* water sources (yellow)
* water destination (red)
* T junctions connecting two pipes (pink)
* Switch (green) As you can see it has labelled inputs and an output on it.

The first thing I need to do when the player thinks they have "completed" the level is to check all pieces are connected. This is already done.
The second thing is where my issue is. Water is supposed to flow in the direction of the arrows as indicated by the second picture. Some pieces (like the taps, drain and switch) have definite inputs and output ends. The ends of the pipe pieces are variable depending on what they're connecting to (ie. sometimes water flows right to left in a horizontal pipe, other times left to right depending on which end ultimately connects to an output and which to an input).

It's a very easy thing to loop through every piece and check that where it has an output the next piece's end is an input. What I'm trying to avoid though is the player having to label each and every piece's ends as either input or output. So my problem is how do I programatically assign input/output sides to each bit of pipe in the diagram assuming the only pieces with known ends are the ones in red, green or yellow.

I was originally going to loop left to right, top to bottom as it's just a tiled map, but that wouldn't work if, for example the puzzle was the mirror of the one shown here (such that inputs were on the right, output on the left).
I think I need some sort of tree for each path, or a linked list or something. *shudder* I suspect I'm going to need recursion - but I have no idea how to do it in pseudocode let alone code it in GLBasic (assuming it supports recursion which I don't know yet!)

Does my description of the problem make sense?

The pieces are stored in a map[ x][y]   array of type where type has the fields
PieceType
Side1InputOrOutput
Side2InputOrOutput
Side3InputOrOutput
Side4InputOrOutput


[attachment deleted by admin]
#103
It would be helpful if you could rearrange the order of your file tabs by dragging/dropping them between other file tabs.
#104
I'd like all the functions / subroutines to be in alphabetical order by default. It would be great if there was some way to do this.
#105
It would be good if you could see all the functions / subroutines from your program in the "Jumps" tab instead of just the ones from the current file. Maybe the ones in the current file could be highlighted?
#106
If you attempt to gosub to a non-existant subroutine, the problem isn't caught by the precompiler. The error you get is something similar to
QuoteC:\glbasic\gpc_temp0.cpp: In function `int __GLBASIC__::__MainGameSub_()':
C:\glbasic\gpc_temp0.cpp:22: error: `mysubroutine' was not declared in this scope
#107
It would be useful if the IDE would highlight matching brackets as you type them so you are sure of putting the right things at the right spot in your code.

#108
If you double click one of the source files to open it up, the function names don't update until you click somewhere in the source window. This is different to if you change files by selecting the file's tab at the top of the code window where the function names change immediately.
#109
I would like the preprocessor to check the right amount of parameters are being passed to functions and display an appropriate error message, rather than getting a somewhat cryptic error from the compiler.

eg. I have a function like follows
Code (glbasic) Select
function ProcessTimers: A, B
but call it with ProcessTimers(1234)

I would like an error message like
Quote"myfile.gbas"(158) error : wrong number of parameters passed to function ProcessTimers

Instead it gives the C code equivalent with DGInt's etc in it. eg :-
Quotetoo few arguments to function `DGInt __GLBASIC__::ProcessTimers(DGInt, DGInt)'
#110
I would like to be able to say
global dim myarray[20]

rather than having to do
global myarray[]
dim myarray[20]
#111
I think I've found a way to crash the compiler

I came across this when I cut and pasted some code into a new function. It appears that if you have a function and put a case statement in it without a select, you crash the compiler without an error. I have reproduced the fault by adding this bit of code to the bottom of my sourcefile.

Code (glbasic) Select
FUNCTION testfnc: a
CASE 1
b=1+ a
ENDFUNCTION


An Error Window pops up :-
Quotegpc.exe has encountered a problem and needs to close.
There's additional windows debug info (crash dump info) but I haven't pasted it here as it's Windows errors and not GLBasic compiler error messages.

I've fixed my code by adding a select statement, but the crash is a bug.
Version - 6.147 demo (it's not my standard PC which is why it's only the old demo version is installed =D )
#112
I would love automatic indenting and automatic indentation fixing.

eg. I would type
Code (glbasic) Select
for x=1 to 10
and it would automatically insert a tab on the next line.

Or I could highlight a section of code
Code (glbasic) Select
for x=1 to 10
print x,100+x,100+x
next

and select "fix indentation" and it would change it to
Code (glbasic) Select
for x=1 to 10
     print x,100+x,100+x
next
#113
I'd like to request that "-" could be used in function, subroutine and variable names. I know you can use the "_" (underscore) character, but hyphen would also be useful.
#114
If you have a function that ends with "endsub" everything still works when you should use "endfunction" instead.
It doesn't break anything but I just noticed it so thought I'd point it out.
#115
I'm trying to do the following

Code (glbasic) Select
type testtype
   a
   b
end type

dim myarray[][] as testtype


But all the ways I've tried keep having a syntax error. Anyone know how I can create a 2 dimensional array of a type structure?
#116
Bug Reports / Newton broken
2009-May-17
All the Newton examples are broken under the current version of GLBasic.
#117
Bug Reports / sin
2009-Apr-30
I was trying to work out the difference between the values returned by the "sin" and "asin" commands (ie. the range the returned values would be in) as it wasn't clear to me from the documentation page.

The documentation page for sin says
Quote
Return 1000 x the sinus (cosinus / tangens) of an angle# in DEG-mode (0-360?), since GLBasic works with integers.
ASIN, ACOS and ATAN are available, too. They return the real angle of a value.

That suggests to me that if I get a calculator and do
(sin 31 ) * 1000
I should get a number between 0 and 360 (when truncated to 0 decimal places). Instead this returns "515". Shouldn't sin therefore be returning 100 * sin rather than 1000 * sin?

Also, the documentation says that the sin(x) command should return an integer, it returns a float. ie the code
"a=sin(31)"
Will result in a=0.515...

Because it's returning a float rather than an int, the supplied code in the manual that is supposed to make an "X" go around in a circle makes it move a whole 4 pixels.

I'm compiling on a Windows PC in case that makes a difference.
#118
If you use ctrl-k to comment a line before one that has a breakpoint, the breakpoint disappears
#119
It would be good to have the equivalent of the "die" perl command so that you can abort the program with an error message. For example it would be good to be able to easily output "Error : Failed to set graphics mode" or similar.
#120
Here's my cutdown code to show the problem

Code (glbasic) Select

TYPE TypeA
A
B
ENDTYPE

TYPE TypeB
TypeAInstance AS TypeA
ENDTYPE

GLOBAL TypeBArray[] AS TypeB

FUNCTION DoStuff: Var1
X =  RND(TypeBArray[Var1].TypeAInstance.A - TypeBArray[Var1].B)
ENDFUNCTION


The line of code
Code (glbasic) Select

X =  RND(TypeBArray[Var1].TypeAInstance.A - TypeBArray[Var1].B)

should be
Code (glbasic) Select

X =  RND(TypeBArray[Var1].TypeAInstance.A - TypeBArray[Var1].TypeAInstance.B)


If I try to compile it as follows where the first "TypeAInstance" is missing :-
Code (glbasic) Select

X =  RND(TypeBArray[Var1].A - TypeBArray[Var1].TypeAInstance.B)

The precompiler correctly sees that the code is incorrect :-
Quote
_______________________________________
*** Configuration: WIN32 ***
precompiling:
GPC - GLBasic Precompiler V.2009.013 - 2D, WIN32
"bb.gbas"(13) error : wrong argument type : TYPE TypeB has no member A

If however the first "TypeAInstance" is there but the second type array is missing
ie.
Code (glbasic) Select

X =  RND(TypeBArray[Var1].TypeAInstance.A - TypeBArray[Var1].B)

Then the precompiler doesn't see the error. Instead, the compiler sees the error
Quote
_______________________________________
*** Configuration: WIN32 ***
precompiling:
GPC - GLBasic Precompiler V.2009.013 - 2D, WIN32
Wordcount:2 commands

compiling:
C:\DOCUME~1\shocking\LOCALS~1\Temp\glbasic\gpc_temp0.cpp: In function `DGInt __GLBASIC__::DoStuff(DGInt)':
C:\DOCUME~1\shocking\LOCALS~1\Temp\glbasic\gpc_temp0.cpp:15: error: 'class __GLBASIC__::TypeB' has no member named 'B'
*** FATAL ERROR - Please post this output in the forum
_______________________________________
*** Finished ***
Elapsed: 1.0 sec. Time: 12:53
Build: 0 succeeded.
*** 1 FAILED ***


If both the first and second "TypeAInstance" are missing, the precompiler sees that the first is missing and errors.