Page 1 of 1

Scrubbing out the stables

Posted: Mon Mar 04, 2019 6:58 pm
by richmond62
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.

Re: Scrubbing out the stables

Posted: Mon Mar 04, 2019 7:22 pm
by Klaus
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.

Re: Scrubbing out the stables

Posted: Mon Mar 04, 2019 7:28 pm
by richmond62
Thanks, Klaus. :D
Obviously we cannot refer to scripts like to the text in "regular" field.
Not obvious at all.

Re: Scrubbing out the stables

Posted: Mon Mar 04, 2019 7:33 pm
by dunbarx
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

Re: Scrubbing out the stables

Posted: Mon Mar 04, 2019 7:36 pm
by Klaus
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:

Re: Scrubbing out the stables

Posted: Mon Mar 04, 2019 7:46 pm
by richmond62
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.

Re: Scrubbing out the stables

Posted: Mon Mar 04, 2019 7:51 pm
by Klaus
Don't believe everything you read on the screen! :D

Re: Scrubbing out the stables

Posted: Tue Mar 05, 2019 6:01 pm
by jacque
This is why behaviors were invented.

Re: Scrubbing out the stables

Posted: Tue Mar 05, 2019 7:08 pm
by bogs
I think Richmond displays enough behaviors already :P