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 / problems with sync

Author
Message
kRx
20
Years of Service
User Offline
Joined: 2nd Apr 2005
Location: Canterbury, Kent, UK
Posted: 6th Jul 2005 06:38
this is proabbly the most stupid questoin ever but......

this works nicely


and this doesnt


why with sync commands it stops the whole thing, and is there a way to get around this as my battle system is almost done and all i need is a ATB timer (slowly increasing rectangle for those who dont know). if anyone can offer an explanation y or any help at all that will be great

thanks in advance

kR

kR
Eddie B
20
Years of Service
User Offline
Joined: 10th Apr 2005
Location:
Posted: 6th Jul 2005 06:42
Try



kRx
20
Years of Service
User Offline
Joined: 2nd Apr 2005
Location: Canterbury, Kent, UK
Posted: 6th Jul 2005 06:47
that does work but when i implement it into my code the wait command flashes everyhitng that isnt 3D which is wierd. what kinda things can be done to get around using a wait command?

thanks

kR
NanoBrain
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 6th Jul 2005 11:02
kRx,

Use variables with if statements. For example, if you need your program to not execute a specific line or group of code until a certain time has passed, then instead of using the wait command, create a counter variable which is incremented each loop by 1. Once that variable reaches a certain value, then execute the needed code. Note, that the timer() function can help you to create truly timed executions of code, because it is the system time. The system timer is the main clock that all other hardware timings are based off of.

Example:


The above is very basic, but is the cornerstone of this method. Get away from the wait commands. They usually serve as useless, most of the time.


+NanoBrain+
kRx
20
Years of Service
User Offline
Joined: 2nd Apr 2005
Location: Canterbury, Kent, UK
Posted: 6th Jul 2005 20:01
i hve a timebar that now works bit basic and very codey but good enough for now. attached is a snippet of my problem. alone the "atb()" function works but when its with a matrix or models it stops functioning, the only thing i cn think of is that the program runs the atb function and then laods up everythign else. any ideas if thats the cause?



any thoughts appreciated

thanks
kR

kR
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 23rd Jul 2005 11:14
My first thought is "what on earth are you trying to do??"...

I couldn't figure it out.

First of all functions:

battlecommand()=1

Just doesn't make any sense. The idea of functions is to put some re-usable code into a 'container', pass information to it and if required get info back.

That's what the brackets are for. So, you could use:

A=battlecommand(10) or
battlecommand(10) or
battlecommand()

The first passes 10 to the function and the return value is stored in the variable A.

The second passes 10 to the function but the function returns nothing.

The third neither passes a value nor returns one.

What you have used should error, but it doesn't...

Another thing you should know about functions are that all standard variables (not arrays) - like your variable 'change' are local.

This means that each time your function is called, it is reset to 0 (zero).

What exactly is your code supposed to do? I'm sure it could be re-written in a fraction of the lines and work too!

TDK_Man

Login to post a reply

Server time is: 2025-05-22 23:54:26
Your offset time is: 2025-05-22 23:54:26