Scrubbing out the stables

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10099
Joined: Fri Feb 19, 2010 10:17 am

Scrubbing out the stables

Post by richmond62 » Mon Mar 04, 2019 6:58 pm

So here I am trying to do a refactor with the minimal amount of work . . .

AND I have buckets of buttons, each with about 5500 lines of code, of which about 5000 are
identical in all of them . . .

. . . Yup: very, very goofy and inefficient indeed 8)
-
families-hercules-hero-greek_myth-greek_legend-ancient_greece-gshn169_low.jpg
-
So I have "hived" the 5000 lines "off" into a command stored in the cardScript . . .

BUT, I still have to delete those unwanted 5000 lines of script from each button . . .

BUT:
delete lines 250 to 5250 of the script of btn "xyz" of stack "Untitled 1"
gives me this:

Script compile error:
Error description: Commands: missing ','


ANd, frankly, manually deleting all those lines of script is just going to do wonders for
my wrist and shoulder pain.

Klaus
Posts: 14196
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Scrubbing out the stables

Post by Klaus » Mon Mar 04, 2019 7:22 pm

Do like this, Hercules:

Code: Select all

...
put the script of btn XYZ into tScript
delete line 3000 to 50000 of tScript
set the script of btn XYZ to tScript
...
Tested and works!

Obviously we cannot refer to scripts like to the text in "regular" field.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10099
Joined: Fri Feb 19, 2010 10:17 am

Re: Scrubbing out the stables

Post by richmond62 » Mon Mar 04, 2019 7:28 pm

Thanks, Klaus. :D
Obviously we cannot refer to scripts like to the text in "regular" field.
Not obvious at all.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10320
Joined: Wed May 06, 2009 2:28 pm

Re: Scrubbing out the stables

Post by dunbarx » Mon Mar 04, 2019 7:33 pm

Richmond.

Back in the day, I had many discussions where I told HC users that the script of an object is a property of that object; it is not a container of any kind. So what Klaus meant in his post is that you have to read sentence #1 above just one more time. :wink:

Craig
Last edited by dunbarx on Mon Mar 04, 2019 8:05 pm, edited 1 time in total.

Klaus
Posts: 14196
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Scrubbing out the stables

Post by Klaus » Mon Mar 04, 2019 7:36 pm

richmond62 wrote:
Mon Mar 04, 2019 7:28 pm
Thanks, Klaus. :D
Obviously we cannot refer to scripts like to the text in "regular" field.
Not obvious at all.
If you get an error, how more obvious could that be? :shock:

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10099
Joined: Fri Feb 19, 2010 10:17 am

Re: Scrubbing out the stables

Post by richmond62 » Mon Mar 04, 2019 7:46 pm

how more obvious could that be?
Well it might, perhaps be obvious if the error message were not
incredibly opaque:

Error description: Commands: missing ','

seems to mean that I missed a comma; so I wasted about 20 minutes messing
around with those.

Klaus
Posts: 14196
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Scrubbing out the stables

Post by Klaus » Mon Mar 04, 2019 7:51 pm

Don't believe everything you read on the screen! :D

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7392
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Scrubbing out the stables

Post by jacque » Tue Mar 05, 2019 6:01 pm

This is why behaviors were invented.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: Scrubbing out the stables

Post by bogs » Tue Mar 05, 2019 7:08 pm

I think Richmond displays enough behaviors already :P
Image

Post Reply