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.

Newcomers DBPro Corner / Help needed with this code ! Trying to create a time offset variable

Author
Message
Newbie5UK
20
Years of Service
User Offline
Joined: 13th Nov 2004
Location:
Posted: 28th Mar 2006 17:14 Edited at: 28th Mar 2006 17:22
I am trying to create a time offset variable whivh is really the cycle time.

However if you see the code the TimeInt variable appears and then I divide by 100000 to creat the TimeOffset with a limited number of ecimal points.

For some reason if I declare the Variable at the begining of the code my code runs but this code is ignored (placed within main loop)

So in summary the variable I create is ignored by calculations in the main loop, unless I define it at the beginning and do not chnage it.
BTW I do declare is as a Global Varibale with
DIM TimeOffset#(1) which I believe is right.

Please try my code and let me know firstly why TimeOffset is zero and secondly any idea why my cariabel is beign ignored... thx


Basically more concerned about variable being ignored rather than the procedure to creat offset...

If I try this line TimeOffset#=(1199/100000)
TimeOffset# also = zero ????????
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 28th Mar 2006 19:03 Edited at: 28th Mar 2006 19:05
you do realize by using the keyword DIM you are creating an array, not just a variable?

Just use Global YourVarName#

i see in your code that you make no reference to an index with the var so I am assuming you didnt mean to make an array, and thats why its broken altogether

Automatic file updates for your distributed Games
Flashing Blade
22
Years of Service
User Offline
Joined: 19th Oct 2002
Location: United Kingdom
Posted: 29th Mar 2006 13:26
Quote: "If I try this line TimeOffset#=(1199/100000)
TimeOffset# also = zero ???????? "


Thats because you are dividing two integers. Make one a float and you'll get a float result:
TimeOffset#=(1199/100000.0)


The word "Gullible" cannot be found in any English Dictionary.
Newbie5UK
20
Years of Service
User Offline
Joined: 13th Nov 2004
Location:
Posted: 29th Mar 2006 13:38 Edited at: 29th Mar 2006 13:42
Thx that is part of it but not really the route problem... the variable TimeOffset# is declared as a Float at the start of the code. Typically this value is between 0.019 and 0.012 depending on loop time. However in calculation where I use this variable the value is ignored. However if I put a statment at the beginning of the code like. TimeOffset#=0.019 it works..

Besides declaring as a Float, what more do I need to make this work... been doing my head in.....

Seems if the variable is FIXED it works... make it changable in the loop and it gets ignored...... HELP pls

In Summary
--------------------------------------------------
Global TimeOffset# as Float

Do
Result#=Somevariable#*TimeOffset# - This does not work...

TimeOffset#= ...... as per code at begining..
Loop
--------------------------------------------------
Global TimeOffset# as Float
TimeOffset#=0.019

Do
Result#=Somevariable#*TimeOffset# - This works. .????
Loop
Flashing Blade
22
Years of Service
User Offline
Joined: 19th Oct 2002
Location: United Kingdom
Posted: 29th Mar 2006 16:42
Quote: "However in calculation where I use this variable the value is ignored"


Could you post an example.


The word "Gullible" cannot be found in any English Dictionary.
Newbie5UK
20
Years of Service
User Offline
Joined: 13th Nov 2004
Location:
Posted: 29th Mar 2006 20:19 Edited at: 29th Mar 2006 20:30
ignore i posted wrong code..... will re-post !

Login to post a reply

Server time is: 2024-11-27 01:32:22
Your offset time is: 2024-11-27 01:32:22