Re: Offset with 'charstoskip' doesn't work? [was RunRev vsRealBasic (Richard Gaskin)]

2005-01-21 Thread Alex Tweedly
Michael D Mays wrote:
I thought I would see if I could solve the RB/Rev/SC challenge and 
tried this as a first attempt:

on mouseUp
  put fld 1 into sFld
  put fld 2 into tFld
  put  into fld 3
  -- put 0 into it --*1
  put zero into t --*2
  repeat with i= 1 to the number of lines in tFld
repeat
  -- get offset(line i of tFld,sfld,it) --*1
  get offset(line i of tFld,sfld,t) --*2
  put it into t --*2
  if it is zero then exit repeat
  put line i of tFldiitreturn after fld 3
end repeat
  end repeat
end mouseUp
but what happens is along the way it finds a search string in question 
at char 246674 and then finds it again at 250675 and then finds it 
again at 246674 then at 250675 then at 246674 then at 250675 ...

Is offset not working or am I not?
It's you :-)
When you do the second search, t already contains an 'skip' value; the 
result from the offset search is relative to that.
So instead of
 put it into t
you should do
 add it to t

-- Alex.

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.7.1 - Release Date: 19/01/2005
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Offset with 'charstoskip' doesn't work? [was RunRev vsRealBasic (Richard Gaskin)]

2005-01-21 Thread Michael D Mays
On Jan 21, 2005, at 10:05 AM, Alex Tweedly wrote:
Michael D Mays wrote:
I thought I would see if I could solve the RB/Rev/SC challenge and 
tried this as a first attempt:

on mouseUp
  put fld 1 into sFld
  put fld 2 into tFld
  put  into fld 3
  -- put 0 into it --*1
  put zero into t --*2
  repeat with i= 1 to the number of lines in tFld
repeat
  -- get offset(line i of tFld,sfld,it) --*1
  get offset(line i of tFld,sfld,t) --*2
  put it into t --*2
  if it is zero then exit repeat
  put line i of tFldiitreturn after fld 3
end repeat
  end repeat
end mouseUp
but what happens is along the way it finds a search string in 
question at char 246674 and then finds it again at 250675 and then 
finds it again at 246674 then at 250675 then at 246674 then at 250675 
...

Is offset not working or am I not?
It's you :-)
When you do the second search, t already contains an 'skip' value; the 
result from the offset search is relative to that.
So instead of
 put it into t
you should do
 add it to t

-- Alex.
Someday I will read the complete description in the documentation all 
by myself.:)
Thanks.

But what is the advantage of returning the offset from the last offset 
rather than the offset from beginning?

I think I do need to insert
  put zero into t
after the first repeat and before the second repeat.
Michael
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Offset with 'charstoskip' doesn't work? [was RunRev vsRealBasic (Richard Gaskin)]

2005-01-21 Thread Alex Tweedly
Michael D Mays wrote:
But what is the advantage of returning the offset from the last offset 
rather than the offset from beginning?
Don't know; I'd agree there are probably more cases where an overall 
answer would be more convenient, but I don't see that it makes any great 
difference. I can't think of any significant case where the relative 
result is easier to use.

I think I do need to insert
  put zero into t
after the first repeat and before the second repeat.
Or just move the existing
  put zero into t
from before the first repeat to immediately after it (before the second 
repeat)

-- Alex.
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.7.1 - Release Date: 19/01/2005
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Offset with 'charstoskip' doesn't work? [was RunRev vsRealBasic (Richard Gaskin)]

2005-01-21 Thread Richard Gaskin
Michael D Mays wrote:
Someday I will read the complete description in the documentation all by 
myself.:)
Thanks.

But what is the advantage of returning the offset from the last offset 
rather than the offset from beginning?

I think I do need to insert
  put zero into t
after the first repeat and before the second repeat.
Sometimes I parse by removing things from the front, other times I leave 
things in place.  The current scheme lets me do both as I choose.

--
 Richard Gaskin
 Fourth World Media Corporation
 __
 Rev tools and more: http://www.fourthworld.com/rev
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution