Page 1 of 2 12>
Topic Options
#61376 - 2001-12-16 03:36 AM There is no spoon
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611

; KIXTART 4.01


break on cls
color w/n
srnd(@msecs)
$t=5


$greenies = 15
$greenie = marray("$greenies,2")
for $i=0 to $greenies
$greenie[$i][0] = rnd(24)
$greenie[$i][1] = rnd(78)
next


$blankies = 15
$blankie = marray("$blankies,2")
for $i=0 to ubound($blankie)
$blankie[$i][0] = rnd(24)
$blankie[$i][1] = rnd(78)
next


$=setoption("hidecursor","on")


while not kbhit()
for $i = 0 to $greenies
color g/n
$c=rnd(100)+100
if $c=7 or $c=149
$c=150
endif
if $greenie[$i][0]
at($greenie[$i][0],$greenie[$i][1]) chr($c)
endif
if $greenie[$i][0] < 23
$greenie[$i][0] = $greenie[$i][0] + 1
color g+/n
at($greenie[$i][0],$greenie[$i][1]) chr($c)
else
$greenie[$i][0] = rnd(5)
$greenie[$i][1] = rnd(78)
endif
delay($t)
next
for $i = 0 to $blankies
color w/n
at($blankie[$i][0],$blankie[$i][1]) " "
$blankie[$i][0]=$blankie[$i][0]+1
if $blankie[$i][0] = 24
$blankie[$i][0]=0
$blankie[$i][1]=rnd(78)
endif
delay($t)
next
color w/n
delay($t)
loop
get$

cls
exit 1


function delay($n)
$ticks = @ticks +$n
while @ticks < $ticks
loop
endfunction


function marray($ind, optional $ptr)
if ubound($ind)
else
$ind = split($ind,",")
endif
redim $marray[$ind[$ptr]]
if $ptr < ubound($ind)
$marray[0] = marray($ind,$ptr+1)
dim $L
for $l = 1 to ubound($marray)
$marray[$L]=$marray[0]
next
endif
endfunction



; KIXTART 4.01


break on cls


color w/n


srnd(@msecs)


$t=15


while not kbhit()
$row = rnd(23)
$col = rnd(78)
if rnd(4) = 2
for $i = 0 to 24
at($i,$col) " "
delay($t)
next
else
for $i = 0 to $row
$c = rnd(100)+100
if $c<>7 and $c<>149
color g+/n
at($i,$col) chr($c)
if $i
color g/n
at($i-1,$col) chr($c)
endif
color w/n
delay($t)
endif
next
endif
delay($t)
loop
get$

cls
exit 1


function delay($n)
$ticks = @ticks +$n
while @ticks < $ticks
loop
endfunction

[ 17 December 2001: Message edited by: Shawn ]

Top
#61377 - 2001-12-16 04:03 AM Re: There is no spoon
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
VERY COOL SHAWN Shawn is the Ole KING, but even this non Ole is COOL

Just make sure your using a release version of KiXtart v4.01 I was using the RC1 at home still and it did not work.

I vote to give Shawn another vote on this board...

Tried to give you 10 Big Grins, for a job well done, but 8 is the limit for posting.

Top
#61378 - 2001-12-16 05:38 PM Re: There is no spoon
Jochen Administrator Offline
KiX Supporter
*****

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

sometimes I wonder how it comes that there are similar thoughts at the same time ... the following was planned to be posted as an addition to my request for a msec delay/sleep/wait command on monday

I referred to your sample 'spinner' in kixlib32.dll sample code to 'force' Ruud to implement that thing intrinsic, as a udf delay() will grab all processor time it can get !!!

code:

;FUNCTION delay()
;
;AUTHOR Jochen Polster (jochen.polster@gmx.net)
;
;ACTION halts script execution for specified amount of milliseconds
;
;SYNTAX Delay(milliseconds)
;
;PARAMETERS milliseconds (Required)
; - integer amount of milliseconds
;
;REMARKS if passed parameter is divisible by 1000,
; better use sleep instead ...
; Found no way yet to prevent the function being leaky
; regarding CPU time !
;
;RETURNS Nothing
;
;DEPENDENCIES None
;
;EXAMPLES call "path\Delay.udf"
break on
$ = setoption("HideCursor","on")
at(5,10) "Spinner"
at(7,10) "'S' - slow"
at(8,10) "'M' - medium"
at(9,10) "'F' - fast"
at(10,10)"'Q' - quit"
$wait = 100
while $k <> "q"
$c = $c + 1
select case $c = 1 at(5,19)'\'
case $c = 2 at(5,19)'|'
case $c = 3 at(5,19)'/'
case 1 at(5,19)'-' $c = 0
endselect
if kbhit()
get $k
select case $k = 's' $wait = 180
case $k = 'm' $wait = 100
case $k = 'f' $wait = 50
endselect
endif
delay($wait)
loop
;
;SOURCE

function delay($ms)
if vartype($ms) = 3
dim $t
$t = @ticks + $ms
do
;whatever to prevent grabbing 99% of proc time !!!
until $t <= @ticks
endif
endfunction


If anybody, I bet you are the one able to tell if there is any way around this problematic (at least you have the delay implemented non-leaky in your dll's ..)
I deny posting this on the library side unless there's a solution for it ... I mean that is not what one would expect if one tries to send his script to sleep

J.

_________________________



Top
#61379 - 2001-12-16 05:45 PM Re: There is no spoon
Jochen Administrator Offline
KiX Supporter
*****

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

Matrix Code in KiX !

(only 3 points because of being CPU intensive )

J.

_________________________



Top
#61380 - 2001-12-16 06:08 PM Re: There is no spoon
Anonymous
Unregistered


Where can I find more info about the "setoption" function?
I can find nothing about it in the manuel...
And what about kbhit???
Do I look wrong in the manuel or are there hidden functions?

[ 16 December 2001: Message edited by: awinkel ]

Top
#61381 - 2001-12-16 06:37 PM Re: There is no spoon
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
J

Start MSN ?

I would post your delay() function if I were you ... there's no way I can think of to yield the CPU other than shelling out to sleep.exe or something like that ... an msec delay() function in the next release would be very cool ... or an msec sleep() - but I guess its probably too late for that (for compatibilty reasons) ... unless Ruud adds a new setoption("sleep","msec") or the like.

I'll take three stars on that.

p.s.

If you do post delay() - watch-out for that negative @ticks thingy (after 25 days of uptime) ... make sure the udf works with a negative msec's

--Shawn

[ 16 December 2001: Message edited by: Shawn ]

Top
#61382 - 2001-12-16 06:52 PM Re: There is no spoon
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
awinkel,
There are a lot of references to SetOption( ) both in the latest KiX2001.doc and in ScriptLogic's KiXtart.chm document. Perhaps you're behind a few versions.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#61383 - 2001-12-16 07:53 PM Re: There is no spoon
Anonymous
Unregistered


I will be very happy if you can let me know where I can find it in the .chm file.
I have download the latest version from the download section of this site but can't find anything about it.

Top
#61384 - 2001-12-16 08:31 PM Re: There is no spoon
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Unfortunately, the one on kixtart.org is not the latest. Try the one from ScriptLogic.
http://www.scriptlogic.com/downloads/kix/KiXHelp2001.zip

The Word doc that ships with KiXtart 4 final (build 62 or 64) does make reference to SetOption( ).

_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#61385 - 2001-12-16 10:35 PM Re: There is no spoon
DrillSergeant Offline
MM club member
*****

Registered: 2004-07-09
Posts: 1164
Loc: Eijsden, the Netherlands
You get used to it after a while. I don't see the code any more, I just see blondes, brunettes, redheads...

_________________________
The Code is out there

Top
#61386 - 2001-12-16 10:40 PM Re: There is no spoon
Anonymous
Unregistered


Thankyou LLigetfa, I thought I became crazy but I have found it yet.
Ofcourse I have to use it in my next script.

[ 16 December 2001: Message edited by: awinkel ]

Top
#61387 - 2001-12-16 10:45 PM Re: There is no spoon
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Sander,

Your not going crazy, you were just too busy looking at the woman in the red dress

Hows it going Rogier ?

-Shawn

Oh yeah, and you got to watch out for those Microsoft Agents ... I think Radimus was the only one that ever stood their ground against one - and lived !

[ 16 December 2001: Message edited by: Shawn ]

Top
#61388 - 2001-12-17 12:45 AM Re: There is no spoon
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
A small variation of the above ...


"Unfortunately no one can be told what the matrix is, you have to see it for yourself."
-Morpheus



; KIXTART 4.01


break on cls
color w/n
srnd(@msecs)
$t=5


$greenies = 15
$greenie = marray("$greenies,2")
for $i=0 to $greenies
$greenie[$i][0] = rnd(24)
$greenie[$i][1] = rnd(78)
next


$blankies = 15
$blankie = marray("$blankies,2")
for $i=0 to ubound($blankie)
$blankie[$i][0] = rnd(24)
$blankie[$i][1] = rnd(78)
next


$=setoption("hidecursor","on")


while not kbhit()
for $i = 0 to $greenies
color g/n
$c=rnd(100)+100
if $c=7 or $c=149
$c=150
endif
if $greenie[$i][0]
at($greenie[$i][0],$greenie[$i][1]) chr($c)
endif
if $greenie[$i][0] < 23
$greenie[$i][0] = $greenie[$i][0] + 1
color g+/n
at($greenie[$i][0],$greenie[$i][1]) chr($c)
else
$greenie[$i][0] = rnd(5)
$greenie[$i][1] = rnd(78)
endif
delay($t)
next
for $i = 0 to $blankies
color w/n
at($blankie[$i][0],$blankie[$i][1]) " "
$blankie[$i][0]=$blankie[$i][0]+1
if $blankie[$i][0] = 24
$blankie[$i][0]=0
$blankie[$i][1]=rnd(78)
endif
delay($t)
next
color w/n
delay($t)
loop
get$

cls
exit 1


function delay($n)
$ticks = @ticks +$n
while @ticks < $ticks
loop
endfunction


function marray($ind, optional $ptr)
if ubound($ind)
else
$ind = split($ind,",")
endif
redim $marray[$ind[$ptr]]
if $ptr < ubound($ind)
$marray[0] = marray($ind,$ptr+1)
dim $L
for $l = 1 to ubound($marray)
$marray[$L]=$marray[0]
next
endif
endfunction


Top
#61389 - 2001-12-17 02:01 AM Re: There is no spoon
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
Jochen,

3 out of 10 ? Boy your a tough judge..

I just think the idea of recreating that in KiXtart is cool. As far as CPU intensive, yes, but when I start other programs... it relenquishes cpu cycles to the other program. It still remains the top cpu user, but not 99% on my Windows 2000 system as it does when it is the only active process.

Oh!, and since this is my 7-11 post Free coffee for everyone.

[ 17 December 2001: Message edited by: NTDOC ]

Top
#61390 - 2001-12-17 03:59 AM Re: There is no spoon
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Jochen is a tough cookie ... I was hoping to get a couple of extra smilies from the German judge with the revised matrix script ...

-Shawn

[or maybe Jochen just expects 'more' from the BBS old timers ... you know, tougher standards and all that, eh j ?]

[ 17 December 2001: Message edited by: Shawn ]

Top
#61391 - 2001-12-17 09:32 AM Re: There is no spoon
cj Offline
MM club member
*****

Registered: 2000-04-06
Posts: 1102
Loc: Brisbane, Australia
Very nice!

Even works on a winterm

cj

Top
#61392 - 2001-12-17 01:29 PM Re: There is no spoon
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
Microsoft Agents are one thing... but their lawyers are a lot toughter
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#61393 - 2001-12-17 03:18 PM Re: There is no spoon
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
hmmm ... i wrote this on my wintendo box at home. Noticed this morning that on my 2k box at work, the normal GREEN doesn't show-up too well against the black DOS console (no contrast). Remember noticing the same effect in KiXpoker ... wonder why that is ... are there color palette settings for the DOS console ?

-Shawn

Rad, that lawyer, was his name Mr. Peedy by any chance ?

[ 17 December 2001: Message edited by: Shawn ]

Top
#61394 - 2001-12-17 04:22 PM Re: There is no spoon
Jochen Administrator Offline
KiX Supporter
*****

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

here comes the german jugde (w/o voting the delay() leak )


back to @ticks ... You say that it gets negative values after 25 days of uptime ? Hmmm ... have to consider , but to be honest have you ever seen an M$ based computer being longer up than ....

c y'all on wednesday !
(tommorrow i have to upgrade my Must Consult Someone Else cert [70-240] )

J.

_________________________



Top
#61395 - 2002-08-06 02:13 PM Re: There is no spoon
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
Shawn...

Your code gives me an error with KiX v4.10a

code:
Script error: expected ']'!
redim $marray[$ind[$ptr]]

I'll try to check it myself if I get a chance... but since you wrote it, maybe you can see right off the bat what may be different since v4.01 of KiX.

Top
Page 1 of 2 12>


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

Who's Online
0 registered and 987 anonymous users online.
Newest Members
StuTheCoder, M_Moore, BeeEm, min_seow, Audio
17884 Registered Users

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

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