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 Discussion / should i put this in a function?

Author
Message
JoelJ
21
Years of Service
User Offline
Joined: 8th Sep 2003
Location: UTAH
Posted: 2nd Jan 2004 08:47
excuse the newbish question...
im going to have it, when you click on a matrix tile, it checks all the tiles around it (up down left right upleft...) to determine numbers and such (you'll understand better once i get it working)

but my question is, should i do it in a function or a sub? i would think to do it in a sub, but from what everyone has said in the past, its best to use a function, but im not sure if it would be best in this situation.

thanx for your future input

Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 2nd Jan 2004 09:40
If it's to be used alot ( which it would be, clicking on the matrix ) then whack it in a function...

If you need any help putting it in a function, just ask

Hope I Helped...


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
JoelJ
21
Years of Service
User Offline
Joined: 8th Sep 2003
Location: UTAH
Posted: 2nd Jan 2004 09:47 Edited at: 2nd Jan 2004 09:50
ok...i'v already started it in a function, and its all going good for now

[edit]
i lied
i have a question...before you said:

so when i want to set matrix tile 1, tilex, tiley, TEXTURENUMBER and i want to use texture 1, would TEXTURENUMBER be a 1 or a 0

ReD_eYe
22
Years of Service
User Offline
Joined: 9th Mar 2003
Location: United Kingdom
Posted: 2nd Jan 2004 12:36
it would be 1


GO TO THE ETERNAL DESTINY FORUMS!!! http://forums.eternaldestinyonline.com
Do it now!!!
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 2nd Jan 2004 15:27
indeed it would...

remember, when dealing with objects/images/sounds etc, there is never a number 0 object/sound/whatever ( with the exception of bitmaps, 0 being the screen ).

Hope I Helped...


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
JoelJ
21
Years of Service
User Offline
Joined: 8th Sep 2003
Location: UTAH
Posted: 3rd Jan 2004 02:19
how about arrays? do they start at 0? because i keep getting an array out of bounds error, but (i dont think) i shouldnt...

Emperor Baal
21
Years of Service
User Offline
Joined: 1st Dec 2003
Location: The Netherlands - Oudenbosch
Posted: 3rd Jan 2004 02:20
arrays start at 0 (I hate that )


Quote: "
Amd 2500+ | 1024mb pc2700 | A7N8X-X | Geforce4 ti 4200 128mb
"
JoelJ
21
Years of Service
User Offline
Joined: 8th Sep 2003
Location: UTAH
Posted: 3rd Jan 2004 02:23
heres my function:

and here's how i call it:


and heres my problem:
Quote: "Runtime error at line 454. Array Accessed out of bounds at line 454"

line 454 is:

and map is my array. can anyone tell me why i get that error?

Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 3rd Jan 2004 04:46
When you call the function, you are passing it undefined variables, ie variables that equal null or 0.

Thus, when the calculation of tiley - size is carried out, it will return -1 ( 0 - 1 = -1 ) and that is where you are getting your error...

use this to call it:



Hope I Helped...


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
heartbone
22
Years of Service
User Offline
Joined: 9th Nov 2002
Location:
Posted: 3rd Jan 2004 06:19 Edited at: 3rd Jan 2004 06:20
Darwin the problem is not what you are passing the function, the problem is that you are using an unintialized variable: tiley, within the function.


I know I helped.

The more you see, the more you know.
The more you know, the more you see.
JoelJ
21
Years of Service
User Offline
Joined: 8th Sep 2003
Location: UTAH
Posted: 3rd Jan 2004 07:38 Edited at: 3rd Jan 2004 07:40
@JT: didnt work, same error
@heartbone: but why isnt it intilized? it should be...

Quote: "I know I helped"

hate to break it to ya....j/k

JoelJ
21
Years of Service
User Offline
Joined: 8th Sep 2003
Location: UTAH
Posted: 3rd Jan 2004 07:43
HAHA! i think iv got it
should be


heartbone
22
Years of Service
User Offline
Joined: 9th Nov 2002
Location:
Posted: 3rd Jan 2004 18:15
Isn't programming fun?

The more you see, the more you know.
The more you know, the more you see.
JoelJ
21
Years of Service
User Offline
Joined: 8th Sep 2003
Location: UTAH
Posted: 3rd Jan 2004 21:51
oh yeah...but spelling isnt

Login to post a reply

Server time is: 2025-06-07 10:58:26
Your offset time is: 2025-06-07 10:58:26