wordOffset, repeat loop, speed?
Ken Ray
kray at sonsothunder.com
Sun Jan 5 16:34:01 EST 2003
Hey Mark,
I've worked a long time in Director, so I know what you mean. You can get
"the ticks", but Rev works better in milliseconds. I like to use custom
properties instead of global variables sometimes to hold temporary values,
so try this if you need to maintain the timer between handlers:
on startTimer
set the timer of this stack to (the milliseconds)
end startTimer
on endTimer
set the timer of this stack to (the milliseconds - the timer of this
stack)
end endTimer
This way, you can do things like this:
on mouseUp
startTimer
-- do a whole bunch of stuff
endTimer
put the timer of this stack into elapsedMS
end mouseUp
If, on the other hand, you need to just time things in a single handler, you
can do this:
on mouseUp
put the milliseconds into tStartTime
-- do a whole bunch of stuff
put (the milliseconds - tStartTime) into elapsedMS
end mouseUp
Unfortunately Rev is so new there aren't any 3rd party books. Hopefully
there will be soon, but in the meantime there's a great list here, and you
can get a bunch of scripting tips and downloads at my site:
http://www.sonsothunder.com/devres/revolution/revolution.htm
Hope this helps,
Ken Ray
Sons of Thunder Software
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/
----- Original Message -----
From: "Mark Brownell" <gizmotron at earthlink.net>
To: <use-revolution at lists.runrev.com>
Sent: Sunday, January 05, 2003 3:18 PM
Subject: Re: wordOffset, repeat loop, speed?
> Ken,
>
> Wow!
>
> That is funny. This code you wrote is so close to Lingo that it would
almost
> execute properly as it is in Director. I'll bet you hear this all the time
> here.
>
> All I need is a timer message for start of loop and end of loop to do
timing
> comparisons. I don't suppose it's "put the ticks" or "startTimer" & "put
the
> timer" ? This is so amazing. I get to learn a new language that seems
almost
> the same as one that I already know. What about books? I was looking at
> Amazon.com for anything and I found nothing. I did discover several of the
> websites that support RR. They are loaded with goodies and quite helpful.
>
> Thank you,
> Mark
>
>
> on 1/5/03 3:32 PM, Ken Ray at kray at sonsothunder.com wrote:
>
> > Mark,
> >
> > Yes, I would say so. Rev is very fast, so if you did something like:
> >
> > -- gWordArray is the array that will be produced after the words are
found
> > -- gData is the "whole chunk of text" you referred to as the main
container
> >
> > global gWordArray, gData
> >
> > on mouseUp
> > ask "What word do you want to find?"
> > if it <> "" then
> > FindWord it,gData
> > -- you now have an array where each element is the numeric offset to the
> > -- word to be found in gData
> > end if
> > end mouseUp
> >
> > on FindWord pWord,pData
> > set the wholeMatches to true
> > put 0 into tStart
> > put 1 into tElementNum
> > repeat forever
> > put wordOffset(pWord,pData,tStart) into tNum
> > if tNum = 0 then exit repeat
> > put tNum into gWordArray[tElementNum]
> > add 1 to tElementNum
> > end repeat
> > end FindWord
> >
> > Hope this helps,
> >
> > Ken Ray
> > Sons of Thunder Software
> > Email: kray at sonsothunder.com
> > Web Site: http://www.sonsothunder.com/
> >
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
More information about the use-livecode
mailing list