| View previous topic :: View next topic |
| Author |
Message |
Serge Professional Member


Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Tue Mar 18, 2003 2:55 am Post subject: @timer(1,v) |
|
|
hi all,
i wrote a program that uses timers and that makes use of @timer(1,v)
a user has reported a problem with the code that follows on from the return of @timer(1,v) and i was wondering if different o/s report something different when that call is made
i am using win me and my program works fine, he is using w2k and reports a problem
here is the part of the code that causes a problem for him, and it would be the case if @timer(1,v)returns a different string under w2k then it does under win me
| Code: | %%timer = @timer(1,v)
if @equal(@len(%%timer),15)
dialog set, text11, @substr(%%timer,10,13)
%%minutes = @substr(%%timer,9,10)
%%seconds = @substr(%%timer,12,13)
elsif @equal(@len(%%timer),14)
dialog set, text11, @substr(%%timer,8,12)
%%minutes = @substr(%%timer,8,9)
%%seconds = @substr(%%timer,11,12)
end
%%total_time = @fadd(@fmul(%%minutes,60),%%seconds)
%%time_frac = @format(@fmul(@fdiv(%%total_time,@fmul(3,60)),100),2.0)
dialog set, level1, %%time_frac
|
what i am trying to do in the code is extract the amount of minutes and seconds from the return of @timer(1,v) and the update a level bar
thanks for your help in advance
Serge _________________
|
|
| Back to top |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Tue Mar 18, 2003 3:12 am Post subject: |
|
|
In your code you have:
elsif @equal(@len(%%timer),14)
I think that might gave ya some problems  _________________ -Sheep
My pockets hurt... |
|
| Back to top |
|
 |
Serge Professional Member


Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Tue Mar 18, 2003 3:35 am Post subject: |
|
|
thanks snarling sheep but i find that the output of @timer(1,v) is either 14 or 15 characters long (under me) and i need to deal with both possibilities
Serge _________________
|
|
| Back to top |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Tue Mar 18, 2003 3:38 am Post subject: |
|
|
I understood that part, but as far as I know "elsif" is not a part of VDS  _________________ -Sheep
My pockets hurt... |
|
| Back to top |
|
 |
ShinobiSoft Professional Member


Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Tue Mar 18, 2003 3:44 am Post subject: |
|
|
Hey Sheep,
Actually "elsif" is a new command introduced in VDS 4. Or at least VDS 4.5
because it's in my documentation and I also use it.  _________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
| Back to top |
|
 |
ShinobiSoft Professional Member


Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Tue Mar 18, 2003 3:49 am Post subject: |
|
|
Hi Serge,
How are you setting the initial value of the timer? I mean what time format
are you using? _________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
| Back to top |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Tue Mar 18, 2003 3:50 am Post subject: |
|
|
Doh, I never noticed it. I even tried it to make sure, it didn't turn bold in the IDE so I figured it didn't exist.
Turns bold now though and works.
So, don't mind me..the length is either 14 or 15 for me on XP Pro here.
Any way to find out what the length actually was on the users system?
Only thing I can think of(now that I've been proven stupid..that was hard huh?) is it could possibly have something to do with regional settings. _________________ -Sheep
My pockets hurt... |
|
| Back to top |
|
 |
ShinobiSoft Professional Member


Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Tue Mar 18, 2003 3:57 am Post subject: |
|
|
lol, I wasn't trying to make ya feel stupid Sheep. Sorry  _________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
| Back to top |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Tue Mar 18, 2003 3:58 am Post subject: |
|
|
LoL, I do a good enough job on my own, trust me  _________________ -Sheep
My pockets hurt... |
|
| Back to top |
|
 |
ShinobiSoft Professional Member


Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Tue Mar 18, 2003 4:00 am Post subject: |
|
|
Sheep, I think you might be onto something with the Regional settings
suggestion. _________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
| Back to top |
|
 |
Serge Professional Member


Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Tue Mar 18, 2003 9:51 am Post subject: |
|
|
thanks for your help guys
i will write a small program that will put into a text file what my user gets when vds runs @timer(1,v)...it'll be interesting to see what the problem might be
as for the regional setting, i would be surprised by that because the user is in australia same as me
would it be possible for me to see what various o/s return when vds issues a @timer(1,v) command, perhaps the structure is different even though the length is the same
could i have, pretty please, the return string of @timer(1,v) for nt, xp, xp pro and w2k...just in case there's something i'm missing
thanks in anticipation
Serge
ps my user ran the program on win95 and has no problems, but he can't run under w2k _________________
|
|
| Back to top |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Tue Mar 18, 2003 5:21 pm Post subject: |
|
|
Give us an example of the timer you are using in your program Serge so we can make sure we test it right.  _________________ -Sheep
My pockets hurt... |
|
| Back to top |
|
 |
Serge Professional Member


Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Wed Mar 19, 2003 7:29 am Post subject: |
|
|
now i am really puzzled
i wrote a test program that records what @timer(1,v) returns and this is what my user obtained
| Code: | 19 - 00:00:58:9
19 - 00:00:57:9
19 - 00:00:56:9
19 - 00:00:55:9
|
if i run the same test program on my computer, i obtain
| Code: | 19 - 00:00:59:0
19 - 00:00:58:0
19 - 00:00:57:0
19 - 00:00:56:0
|
my test program is as follows
| Code: | %%time_separator_1 = @datetime(:)
%%time_separator_2 = @datetime(:)00
timer start, 1, ctdown, @datetime(dd)-00%%time_separator_1"1"%%time_separator_2
%%timer_status = on
list create, 1
%i = 1
repeat
wait 1
list add, 1, @timer(1,v)
%i = @succ(%i)
until @equal(%i,70)
list savefile, 1, @windir()\desktop\timer.txt
list close,1 |
in the test program i used the timer the same way that i do in my actual program as shown below:
| Code: | rem === starts timer ===
%%time_separator_1 = @datetime(:)
%%time_separator_2 = @datetime(:)00
timer start, 1, ctdown, @datetime(dd)-00%%time_separator_1"3"%%time_separator_2
%%timer_status = on
gosub read_registry
:timer
wait event,1
if @equal(%%timer_status,on)
rem === updates timer information ===
%%timer = @timer(1,v)
if @equal(@len(%%timer),15)
dialog set, text11, @substr(%%timer,10,13)
%%minutes = @substr(%%timer,9,10)
%%seconds = @substr(%%timer,12,13)
elsif @equal(@len(%%timer),14)
dialog set, text11, @substr(%%timer,8,12)
%%minutes = @substr(%%timer,8,9)
%%seconds = @substr(%%timer,11,12)
end
%%total_time = @fadd(@fmul(%%minutes,60),%%seconds)
%%time_frac = @format(@fmul(@fdiv(%%total_time,@fmul(3,60)),100),2.0)
dialog set, level1, %%time_frac
if @equal(%%time_frac,0)
goto minimise_bBUTTON
end
end |
my user reports that the program runs well under win 95 (as it does on my me machine) but his xp machine reports an error at the following line
| Code: | | %%total_time = @fadd(@fmul(%%minutes,60),%%seconds) |
the error reported is that the program is trying to do maths with non maths entries!
i am puzzled!!!
Serge _________________
|
|
| Back to top |
|
 |
ShinobiSoft Professional Member


Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Wed Mar 19, 2003 8:01 am Post subject: |
|
|
I have one question for ya Serge. The following code:
| Code: |
@format(@fmul(@fdiv(%%total_time,(@fmul(3,60)),100),2.0)
|
Is it supposed to act similar to a percentage counter? _________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
| Back to top |
|
 |
ShinobiSoft Professional Member


Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Wed Mar 19, 2003 8:35 am Post subject: |
|
|
Please disregard my previous post. I'm running Windows 98SE and I can't
duplicate the problem on my machine.
I do, however, have a couple of suggestions:
1) the %%time_separator_1 and %%time_separator_2 variables are not
necessary. Mainly because they make the code hard to read and they
don't serve any real purpose.
2) You can just as easily set the timer like this:
| Code: |
timer start,1,ctdown,@datetime(dd)-00:03:00
|
But like I said, I can't duplicate the error on my machine, so I'm afraid I'm
not gonna be much help. I gave it a shot, sorry.  _________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|