|
Post by Wayne Rayner on Jun 12, 2010 1:35:38 GMT -5
Ok well it's not really an error however I'm trying to create a library for basic4GL for game development. It is going to include functions a whole lot of them for the fact.
My problem is I was testing it for the functions I have. But I never called one and it came with an error. Saying functions didn't return anything. is there a way to call a function to false?
|
|
|
Post by DJLinux on Jun 12, 2010 2:28:34 GMT -5
I can't help without the source code.
Joshy
|
|
|
Post by Wayne Rayner on Jun 12, 2010 2:43:26 GMT -5
well simply the source code a t the moment is really not much and it uses the toolbox plugin that you created.
function.gb
Function screenRes800600() WindowSize(800,600) ResizeSpriteArea(800,600) EndFunction Function screenRes1440900() WindowSize(1440,900) ResizeSpriteArea(1440,900) EndFunction
and then i tested the function in test.gb
include library/function.gb
screenRes800600()
but the thing is I wasn't using one function and it returned an error of function wasn't called or whatever.
All I'm trying to do is make a list of functions that can be used for the ease of game making in basic4GL
|
|
|
Post by Supermonkey on Jun 12, 2010 6:52:21 GMT -5
What you want is a SUB not a FUNCTION. FUNCTIONS must return a value, subs return no value, which is why you are getting the error, as the screenRes function returns no value. Also, you really need to read the programmers guide, instead of having many screen res functions that statically set the screen resolution you can use parameters to allow the user to specify a value i.e.
Sub screenRes(width, height) WindowSize(width, height) ResizeSpriteArea(width, height) EndSub
|
|
|
Post by DJLinux on Jun 12, 2010 12:00:05 GMT -5
sub ScreenRes(w,h) if w<128 then w=128 elseif w>2048 then w=2048 end if if h<32 then h=32 elseif h>2048 then h=2048 end if WindowPosSize(0,0,w,h) ResizeSpriteArea(w,h) End sub
ScreenRes(1024,768) while TRUE Sleep(100) wend
|
|
|
Post by Darkjester on Jun 13, 2010 3:23:54 GMT -5
Function ScreenRes(winw, winh) windowsize(winw,winh) resizespritearea(winw,winh) return 0 end function
|
|
|
Post by Wayne Rayner on Jun 13, 2010 3:36:02 GMT -5
Yea my mistake I should of had it where the person using it chooses the screen height. Also the thing is I like functions over sub routines.
thanks darkjester helped me a lot.
thanks for all your input as it did help me out.
|
|