Time to upgrade my technique...
Eric Chatonet
eric.chatonet at sosmartsoftware.com
Tue Jun 10 11:18:53 EDT 2008
Bonjour Jim,
Le 10 juin 08 à 16:53, Jim Carwardine a écrit :
> Hi Folks... I hope this isn't asking too much. I have found using
> the docs to be less than satisfying when trying an alternative
> coding technique. I guess I fall into the old dog, actually the
> old Hypercard dog, trying to learn the new Rev tricks.
>
> I just wrote a quick and dirty script to parse out an iCal calendar
> saved as a text file to feed my car expense calculator which was
> published a few months ago in a Rev newsletter. The script is very
> slow and I was intrigued to know how to speed it up as I am aware
> that I am using very archaic scripting techniques.
>
> Here is my script. It's relatively short and contains almost all
> of my favourite coding patterns. If anyone has the inclination,
> perhaps you could point out how I might make use of Revs
> improvements over Hypercard...
>
> It has to do with better ways to handle repeating actions and
> better ways to handle lists... Thanks in advance... Jim
Some clues:
1. Put your fields into variables.
2. Use repeat for each form instead of repeat with i = x to y.
3. If conditions are exclusive use a 'if, else if' form or a switch
structure.
4. Use vars instead of calling many times the same thing:
put char 1 to 4 of item 2 of line i of field 1 into
eventYear -- hold event year - yyyymmdd
put char 5 to 6 of item 2 of line i of field 1 into
eventMonth -- hold event month - yyyymmdd
put char 7 to 8 of item 2 of line i of field 1 into
eventDay -- hold event day - yyyymmdd
put char 10 to 13 of item 2 of line i of field 1
into eventTime -- hold event time
put item 2 of line i of <var> in <another var>
put char 1 to 4 of <another var> into eventYear
put char 5 to 6 of <another var> into eventMonth
etc.
Best regards from Paris,
Eric Chatonet.
----------------------------------------------------------------
Plugins and tutorials for Revolution: http://www.sosmartsoftware.com/
Email: eric.chatonet at sosmartsoftware.com/
----------------------------------------------------------------
More information about the use-livecode
mailing list