It is currently Sun Jun 07, 2026 11:51 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Adding 2 scripts together
PostPosted: Sat Mar 31, 2012 11:09 pm  (#1) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4826
Location: Bendigo Vic. Australia
I created 2 scripts. the 1'st calls the 2'nd, but I did not wan't the 1'st to have a dependancy on the 2'nd so I pasted the 2'nd after the 1'st and removed the registry path from the 2'nd. Have I 'fau paad' :oops: in any way as the 2'nd still loads and functions OK. Just for your info the 2'nd is a highlights and shadows script. I hope I have not Erred in any way.

_________________
Image
No matter how much you push the envelope, it'll still be stationery.


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: Adding 2 scripts together
PostPosted: Sun Apr 01, 2012 10:21 am  (#2) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
When you say the 2nd still loads and functions OK, do you mean that you've still got a menu entry for the 2nd? Because that's what the script-fu-register and script-fu-menu-register do. Without them your script is still functional and could be called manually in the script-fu console, you just don't get the menu entry.

If you do mean that you've still got a menu entry, then you've either not removed the script-fu-register or you've got a duplicate with the same name.

Kevin


Top
 Post subject: Re: Adding 2 scripts together
PostPosted: Sun Apr 01, 2012 11:55 am  (#3) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
While there is nothing about what you did that would cause problems with your scripts for the present, it does introduce the potential for confusion in the future. For example, if the original highlights script gets updated and yours does not (or if the user fails to upgrade to your updated script) then it is indeterminate which version will be loaded.

If this script is going to be around for a while, you can save yourself some grief down the road by, at least, changing the name of the copied highlights procedure in your .scm file so there is no conflict with the original.

Better still would be to extract from the original highlights script just the functionality that you need. Over three quarters of most scripts are just boilerplate configuration, information gathering, and sanity checks; and you may find -- after you've removed all that extra code -- that you only need a few lines of code to accomplish what you need. (This is also good way to improve your scripting skills, by rewriting code that was written by others.)

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: Adding 2 scripts together
PostPosted: Sun Apr 01, 2012 6:27 pm  (#4) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4826
Location: Bendigo Vic. Australia
Ifound that there is no PDB entry for the added highlights script unless I load the highlights script seperately then both the main script and highlights script function OK, but I will change the added highlights scripts name to 'the-(main scripts name)-highlights' to to be sure to be sure.

_________________
Image
No matter how much you push the envelope, it'll still be stationery.


Top
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]



* Login  



Powered by phpBB3 © phpBB Group