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 / reading from a type...

Author
Message
iaretony
23
Years of Service
User Offline
Joined: 6th Jun 2003
Location:
Posted: 2nd Jul 2003 04:07
This is really wierd... At the bottom of the code I assign a number to a member of a TYPE I made up, then I assign that to a variable, then I print that variable...

It is NOT 1, it is in the thousands.... Whats up with this?

Tony
Trowbee
23
Years of Service
User Offline
Joined: 12th Apr 2003
Location: United Kingdom
Posted: 2nd Jul 2003 04:15
i had to add an endfunction to that, but the variable foo returned a 1 when i ran it :-s.

Are you sure you havent altered the variable somewhere else or something?
Shadow Robert
23
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 2nd Jul 2003 04:47
dunno the functions in 1.04.1 seem to be bugged, and not a little bit but quite badly.

if your not getting the right value, email lee about it

IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 2nd Jul 2003 20:26
Can't say that I've noticed any problems with functions, and as you know, I don't use gosubs.
Shadow Robert
23
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 2nd Jul 2003 20:37
well simple code like



should work... but it doesn't always - Lee's said he's fixxed the problems in update5 but still, it was working once upon a time

Philip
23
Years of Service
User Offline
Joined: 15th Jun 2003
Location: United Kingdom
Posted: 2nd Jul 2003 20:38
You don't use gosubs at all?

Really? Whoa... impressive.

(Takes hat off to IanM)

Philip

Coming up... a hell of a 3D Space Trading Game!
Shadow Robert
23
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 2nd Jul 2003 20:58
its not so impressive really... he's a C++ coder, they're not used in the same way in that so generally you tend not to use them.

if it weren't for this pesky function problem then i wouldn't use them either, i'd still use labels but not gosubs.

IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 2nd Jul 2003 22:56
What Raven said it right, there are no gosubs in C++, and the nearest thing are the setjmp/longjmp functions, which I avoid like the plague!

Despite that though, I have a fundamental problem with goto and gosub, although I have been known to use the odd goto to exit from a deep set of loops, or jump to function cleanup code before exiting the function (only in BASIC or C - not required in C++ if you code it right).

Raven, If you look at my A* code in the Code snippets, you'll see that it's not simple code I'm talking about - that stuff should be really sensitive to variable corruption.

Maybe it's due to declaring globals within functions, which is another thing I don't do ... actually, thinking about it, maybe I can see how that could happen.

Your code (updated to compile cleanly ):



If you move the line 'global m_Cube as dword' outside the function, it compiles and works as expected.
Shadow Robert
23
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 3rd Jul 2003 00:41
yeah i know mate, but really it defeats the point in using the global... more importantly it screws up the way i develop completely

(hehe and i called it Restore, because you'd call that function each time you change the screensize and such when it looses all 3D data - so you Restore the data )

thing is i'm sure that they were useable in p3.1 lol ho hum, its annoying though cause now i have to setup every little detail in the main program and you can't include them in external functions either which ment i had to rewrite alot of my libraries, thank god i didn't decide to release them cause i can see alot of people going
"i downloaded your sdk and it doesn't work " lol

Login to post a reply

Server time is: 2026-07-17 13:55:40
Your offset time is: 2026-07-17 13:55:40