Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Cant use variables in functions even when included...

Author
Message
AzureZeal
23
Years of Service
User Offline
Joined: 10th May 2003
Location:
Posted: 8th Jul 2003 02:02
I tryed to write a function via a external source file for the image loading part of my program. However, even when I include the image variables apon calling the function ( editorloadimg(x,y,z...) ) I get a paramater missmatch error "load image expects integer". If I replace the variables with numbers, the function works, and the images load fine. I even tryed declaring the variables inside the function right before loading the images, still gave me the error.

It has to be possible to use variables inside functions. What am I doing wrong?
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 8th Jul 2003 09:58
It it. Don't know. Show us what you are doing.
Guruchild
23
Years of Service
User Offline
Joined: 13th May 2003
Location: United States
Posted: 8th Jul 2003 12:18
I had a strange problem like that, except whenever I would try to modify a variable value in a function it would always screw up.

And for some reason I am getting strong sense of deja-vu posting this message... hmm..

-------------------------------------
I have a sign beside my door-hinge
that says nothing rhymes with orange.
Mentor
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 8th Jul 2003 18:10
source?

Mentor.

AzureZeal
23
Years of Service
User Offline
Joined: 10th May 2003
Location:
Posted: 8th Jul 2003 23:05
Hmm I think i may just be doing things wrong. In db classic this is how I did it...

`rem MAIN SOURCE
#include "load.dba"
imagenum = 1
load(imagenum)

`rem FUNCTION SOURCE
load(imagenum)
load image "grass.jpg",imagenum
endfunction

But this doesnt seem to work in dbpro. What SHOULD the code look like if I wanted to keep all my 'load image' commands in a seperate source file?

AzureZeal
23
Years of Service
User Offline
Joined: 10th May 2003
Location:
Posted: 8th Jul 2003 23:07
Whops left out the 'function'

so its

function load(imagenum)
load image "grass.jpg",imagenum
end function

Still not working

IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 8th Jul 2003 23:49
Try removing the #include statement, and use the editor to include source instead.

Hit Shift-F3, and then use the Browse button to locate the source file.

Login to post a reply

Server time is: 2026-07-18 19:13:11
Your offset time is: 2026-07-18 19:13:11