offset broken?

Richmond richmondmathewson at gmail.com
Sat Feb 22 14:35:25 EST 2014


Sorry: Neanderthal question time:

I cannot see anything about charsToSkip in the inbuilt (i.e. in the IDE) 
documentation (6.6. dp1).

Went round in circles on the website.

---------------------

Anyway:

I set up a boring little stack with a fld "fORIGIN" conatinong "The 
quick brown fox jumps over the lazy dog"

and that was jolly nice,

then I set up another fld called "fREZ"

and a button with this script:

on mouseUp
    put empty into fld "fREZ"
    put fld "fORIGIN" into ORIGIN
    put offset("o",ORIGIN) & ", " after fld "fREZ"
    put offset("o",ORIGIN) & ", " after fld "fREZ"
    put offset("o",ORIGIN) & ", " after fld "fREZ"
end mouseUp


in the hope I would get something like "13, 18, 27," in fld "fREZ"

but all I got was "13, 13, 13"

so I really cannot see what the utility of 'offset' is at all.

---------------------------------

I made another button with this script:

on mouseUp
    put empty into fld "fREZ"
    put 1 into INDEKS
    repeat until char INDEKS of fld "fORIGIN" is empty
    if char INDEKS of fld "fORIGIN" is "o" then
      put INDEKS & ", " after fld "fREZ"
   elseon mouseUp
    put empty into fld "fREZ"
    put 1 into INDEKS
    repeat until char INDEKS of fld "fORIGIN" is empty
    if char INDEKS of fld "fORIGIN" is "o" then
      put INDEKS & ", " after fld "fREZ"
   else
      --do nix
   end if
   put (INDEKS + 1) into INDEKS
   end repeat
end mouseUp
      --do nix
   end if
   put (INDEKS + 1) into INDEKS
   end repeat
end mouseUp

and that returned "13, 18, 27, 42"

a whole lot more useful.

-----------------------------------

Richmond.




More information about the use-livecode mailing list