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 / Ok, either I'm going mad, or Dbpro is

Author
Message
SamKM
15
Years of Service
User Offline
Joined: 25th May 2009
Location:
Posted: 8th Apr 2013 03:28 Edited at: 8th Apr 2013 03:29
if object in screen(8) = 1 and object position z(4} < 4800 and showobject = 0 then showobject = 1 : shownow = timer()

Ok, there's my line! Besides being a bit wordy, I can't see anything wrong with it. But the compiler keeps saying 'Irregular number of brackets at line X'
If I close Darkbasic and reopen it... No change.
If I try to compile just that line in a blank project... I still get the error!
So, either I've spent one too many late nights up recently and got code blindness, and there's something obviously wrong with it, or my installation of Darkbasic is bugged!
Does anyone else get errors with it?

Thanks for any help


EDIT:

IT'S ME. Posting it here, I can see where I went wrong now. All too clearly.
*facepalm*

[href][/href]
Kezzla
16
Years of Service
User Offline
Joined: 21st Aug 2008
Location: Where beer does flow and men chunder
Posted: 8th Apr 2013 07:06
lol.
long coding session eh?

sometimes object position z just feels like being a little bit posh and breaks out a fancy bracket. It does it for the attention you know.

I'm not a complete idiot -- Some parts are just missing.
Burning Feet Man
17
Years of Service
User Offline
Joined: 4th Jan 2008
Location: Sydney, Australia
Posted: 8th Apr 2013 08:25
Always the simple things.

Help build an online DarkBASIC Professional help archive.
DarkBasic Help Wikia
TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 8th Apr 2013 10:20
Quote: "EDIT:

IT'S ME. Posting it here, I can see where I went wrong now. All too clearly.
*facepalm*"


May I?



TheComet

Taumatawhakatangihangakoauauotamateapokaiwhenuakitanatahu is a hill
Llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch is a town
Chargoggagoggmanchauggagoggchaubunagungamaugg is a lake
Kezzla
16
Years of Service
User Offline
Joined: 21st Aug 2008
Location: Where beer does flow and men chunder
Posted: 8th Apr 2013 12:33
Quote: "May I?"


I think it goes beyond that, this is one of those rare times when you have no choice but to break out this one...


I'm not a complete idiot -- Some parts are just missing.
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 10th Apr 2013 01:36 Edited at: 10th Apr 2013 01:50
Quote: "if object in screen(8) = 1 and object position z(4) < 4800 and showobject = 0"

Be careful that db will interpret this in the desired order for you.

if a = 1 and b < c
This could be interpreted several ways:
if (a = 1) and (b < c)
if a = (1 and b) < c
if a = (1 and (b < c))

It's usually a good idea to play safe and surround your terms with brackets.

You don't actually need to specify the one here because the value of object in screen(8) can only be 1 or 0, which is interpretted as TRUE or FALSE. So you can simply omit it:

if object in screen(8) and object position z(4} < 4800 and showobject = 0 then showobject = 1 : shownow = timer()


It seems like you are setting this "showobject" flag entirely based on the terms in this condition, therefore allow the condition to set the flag for you:

showobject = object in screen(8) * (object position z(4) < 4800)

I don't know what you are doing with the "shownow" timer but from what I see you could maintain it's function like so:

if showobject = 0 then shownow = timer()
showobject = object in screen(8) * (object position z(4) < 4800)

"shownow" is continually reset until showobject=1.


Mobiius
Valued Member
22
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 10th Apr 2013 14:20
Quote: "object position z(4) < 4800"

Just beware if you want to hide objects behind the camera that this command will not do it for you. This will only work if the camera z position is > 4800 and is pointing in the Z+ direction.

For example, if the camera is pointing in the Z- direction, then it will be hidden whilst in front of the camera, and shown whilst behind it.

I live for video games! (And beers, and football, and cars!)
See what I live for here: [url]http:\\www.TeamDefiant.co.uk[/url]

Login to post a reply

Server time is: 2025-05-17 16:01:25
Your offset time is: 2025-05-17 16:01:25