[comp.sys.mac.hypercard] Weirdness in OFFSET

tom@wcc.oz (Tom Evans) (06/07/90)

HyperCard 1.2.5, System 6.0.4, Mac SE, IIcx and Portable.

Here's a sample button script:

	on mouseup
	  if offset("A",it) then
	    beep
	  end if
	end mouseup

That was the good one. Now if I try a quoted space:
	
	on mouseup
	  if offset(" ",it) then
	  beep
	  end if
	  end mouseup

The interpreter doesn't like it and won't "tabulate" anything
thereafter. A very weird "cure" is:

	on mouseup
	  if offset( " ",it) then
	    beep
	  end if
	end mouseup

Yes, a leading space before the first quote. The problem seems to be
the space before the second quote - using '" a"' is OK, but '" a "'
isn't.  Using '"abc"' as the second parameter (instead of 'it') works,
but '"abc "' doesn't.

Maybe I should be using the keyword 'space' instead of '" "', but 
I'm trying to save space in my scripts :-).

It took me a long time (in a huge script) to track this one down.

========================
Tom Evans  tom@wcc.oz.au  
Webster Computer Corp P/L, 1270 Ferntree Gully Rd Scoresby, Melbourne 3179
Victoria, Australia 61-3-764-1100  FAX ...764-1179

wcc@cup.portal.com
2109 O'Toole Avenue, Suite J SAN JOSE CA 95131 - 1303 CALIFORNIA
1-408-954-8054  FAX 1-408-954-1832

Unit 7, Weltech Centre Ridgeway, Welwyn Garden City Herfordshire AL7 2AA
LONDON UK. Ph  44-707-336969  Mobile 44-836-725849  FAX 44-707-373378