Page 1 of 1 1
Topic Options
#80228 - 2001-06-24 12:41 AM Let SLEEP sleep in milliseconds !
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Ruud,

i think with todays systems speed a second is like an Eternity to the CPU ...

Could we have this changed ?

It's no problem for me but could be one for all who can't (or don't want to) use 3rd Party dll's . (or should i say Shawn Party dll's ? )

Hmm ... , or for compatibility reasons add a WAIT or DELAY function

regards

Jochen

_________________________



Top
#80229 - 2001-06-24 12:55 AM Re: Let SLEEP sleep in milliseconds !
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Hear, hear !

And a KBHIT() or INKEY() function would be nice too ...

-Shawn

Top
#80230 - 2001-06-26 01:15 PM Re: Let SLEEP sleep in milliseconds !
Anonymous
Unregistered


To Shawn !

Kix has some commands to parralel the kbhit() funcrtion

GET
Action: Accepts a single character from the keyboard and stores the character in a variable.

Syntax
GET $x

Remarks
The character is stored in the specified script variable. If a function key, such as F1, is pressed, GET returns 0, and @ERROR returns the key code of the function key.

GETS
Action
Reads a line of characters from the keyboard until the <ENTER> key is pressed, and stores the result in a variable.

Syntax
GETS $x

Thomas

Top
#80231 - 2001-06-26 01:22 PM Re: Let SLEEP sleep in milliseconds !
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Thomas ,

but a kbhit() function won't, unlike get or gets, stop the Script Execution ...

sample of how to FlushKB with Shawns Kixlib32.dll :

code:

$kixlib = createobject("kixlib32.library")
while $kixlib.kbhit
get $k
loop

You won't be able to do this with pure Kix !

Jochen


btw. : Welcome 'on board'

[This message has been edited by jpols (edited 26 June 2001).]

_________________________



Top
#80232 - 2001-06-30 12:41 AM Re: Let SLEEP sleep in milliseconds !
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I'm on the side of delay.
it's not bad to have both (sleep&delay). many languages do have them. it's nicer to control what is shown to user with sleep 500
and then controlling the programs with 100 ms delay.
it don't have to be command either. maybe function like delay(amount,ms/s/m/y)

------------------
Lonkero

The weardest there is!

_________________________
!

download KiXnet

Top
#80233 - 2001-06-30 01:28 AM Re: Let SLEEP sleep in milliseconds !
cj Offline
MM club member
*****

Registered: 2000-04-06
Posts: 1102
Loc: Brisbane, Australia
Lonkero,

One of the most useful reasons for milliseconds is for timing things. I wouldn't want to pause a script for 10ms, but I would like to know the milliseconds now, then after an operation.

Sort of like this:

$start=@milliseconds ;new imaginary KiX macro that returns the milliseconds part of the current time

; my command here

"My command took " @milliseconds-$start "ms" ?


So, rather than the milliseconds of the current time, I would like to have the CPU ticks. That is, the milliseconds since last power on.

cj

Top
#80234 - 2001-07-02 07:58 PM Re: Let SLEEP sleep in milliseconds !
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
... i meant a new delay() function to be useful in CPU - stressing loops :
to prevent Kix32.exe grabbing all available Processor time just add $ = delay(1).

AND it could be useful for Animation purposes ... see this topic

Jochen

_________________________



Top
#80235 - 2001-07-03 08:00 AM Re: Let SLEEP sleep in milliseconds !
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
cj, ok that's right, but how well our OS is supporting that?
when I do a unix script and use milliseconds I have to calculate myself them out of array 143239073493254.
'cause the system time is given in that way. not like in m$ widows.

and jpols is right in that way that I use sleep because of that - I don't want to hang the workstations OS because of harmless admin script is working in the background.

_________________________
!

download KiXnet

Top
#80236 - 2001-07-15 07:09 AM Re: Let SLEEP sleep in milliseconds !
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
Dear,

We agree with CJ. The macro @milliseconds would be nice.
Changes to the command SLEEP isn't so necessary to us.
We aren't using it for timing problems during the execution of
our scripts, but for showing the user some information for a
period of time. Mostly this period is 1 or 2 seconds long.
Greetings.

_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
#80237 - 2001-07-18 02:32 PM Re: Let SLEEP sleep in milliseconds !
Anonymous
Unregistered


@MSECS will be included in the final build.

Ruud

Top
#80238 - 2001-07-19 04:19 AM Re: Let SLEEP sleep in milliseconds !
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
Dear,

Ruud has add @msecs to the new private release.
We will published new versions of kixref.exe and
kixstrip.exe to recognize this macro.
Greetings.

btw: thanks Ruud

_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
#80239 - 2001-07-19 09:50 AM Re: Let SLEEP sleep in milliseconds !
cj Offline
MM club member
*****

Registered: 2000-04-06
Posts: 1102
Loc: Brisbane, Australia
But @MSECS is the milliseconds of the current time, I would like system tick, which is the number of milliseconds since the machine has been turned on. @MSECS is not much use unless it is added to the current seconds, minutes and hours to form a number that can be used for timing purposes.

Do you understand?

cj

Top
#80240 - 2001-07-19 11:11 AM Re: Let SLEEP sleep in milliseconds !
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
cj,
well I got your point anyway.
When time calculation is needed it's easier (and a lot faster) to do it from one long integer than calculate and substract and .... from between human readable times.
even thou they might be in msecs.

hmmm... when now coming to think about it, I'm not sure anymore did I understand you:
I would more like to get macros like @ydayno.
I mean some macro that returns days since 1.1.2000
and minutes since 00:00
but since I got the change to do it with udf, I will get it faster by doing my own code.

BTW, I don't think the ticks are so usefull as macro.
couldn't it be better to have function to which you say:
$ = tick(1) ;starts
and
$ticks = tick(0) ;stops

and it returns cycles, msecs secs or whatever in the between?

_________________________
!

download KiXnet

Top
#80241 - 2001-07-19 02:06 PM Re: Let SLEEP sleep in milliseconds !
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
hrmmmpff !!!

And what about my delay() suggestion ???

I find this very useful !!

_________________________



Top
#80242 - 2001-07-19 02:42 PM Re: Let SLEEP sleep in milliseconds !
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
jpols,
I find delay() nice thought and I think it might be usefull on outputting data... but,
since console mode is the "good but old one" and kix still has poor window support (no nice m$ style window that says what is happening. nor even novell style.) why should you output anything to screen? uttleast in logon scripts it's for nothing. but on your own stuff (more complex scripts that have none to do with login) it would be nice.
well, I do not want to write any novel (nor even novelL ), so... so long!
_________________________
!

download KiXnet

Top
#80243 - 2001-07-19 02:56 PM Re: Let SLEEP sleep in milliseconds !
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Lonkero,

thats a good point ... here's a sample of why I want to have it (I can't , therefore I have to use Shawn's kixlib32.dll) : Connect 4

Cj also has a similar case (his TetrisAdaption)

And it'll be also useful for 'cooling' down CPU Intensive loops .


Jochen

_________________________



Top
#80244 - 2001-07-19 03:32 PM Re: Let SLEEP sleep in milliseconds !
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
weird!
man, I red every post on there but the code was too much!
You certainly have something that many of ppl race do not have: rocking brains!
_________________________
!

download KiXnet

Top
#80245 - 2001-07-19 03:59 PM Re: Let SLEEP sleep in milliseconds !
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Rocking Brains,

that's a good comparison
Mine hurt for 3 days after writing the CPU routines in Connect 4.

J.

_________________________



Top
#80246 - 2001-07-20 02:53 AM Re: Let SLEEP sleep in milliseconds !
cj Offline
MM club member
*****

Registered: 2000-04-06
Posts: 1102
Loc: Brisbane, Australia
I know the feeling.

Let me summarise then. I would like to see a new command and a new macro:

DELAY(iMS) - delay in milliseconds
@TICKS - number of system ticks since last poweron

I have (and I'm sure Jochen has) some/many scripts that are waiting for these functions.

What we have:

SLEEP(iS) - delay in seconds
@MSECS - number of milliseconds of current time.

We can use UDFs and WSH calls to get by in the meantime.

cj

Top
Page 1 of 1 1


Moderator:  Lonkero, ShaneEP, Jochen, Radimus, Glenn Barnas, Allen, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 699 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.072 seconds in which 0.026 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org