ScriptUO

Official ScriptUO EasyUO Scripts => Script Library => Misc. Scripts => Topic started by: Marlboroman on May 25, 2010, 10:16:56 AM

Title: Marlboroman Scripts
Post by: Marlboroman on May 25, 2010, 10:16:56 AM
Here is a collection of scripts that I have wrote over the years.


my first script was a keg emptier designed to just empty full or partial kegs to bottles.  

I wrote a Script for making Wood Pulp when the new expansion came out kind of useful if you want to make your own scrolls or binders.

A Focus/Meditation/Healing trainer using the cloak of corruption.  Be aware the the cloak of corruption lowers your karma and is a cursed item.

A Chicken Coop Assitant that tends your chicken coops.


A smoke bomb maker. Simply to make smokebombs using alchemy.


Ok I went through with the Syntax checker and cleaned up each of the scripts.



Title: Re: Marlboroman Scripts
Post by: Cerveza on May 25, 2010, 10:21:15 AM
Wow, nice stuff... thanks!
Title: Re: Marlboroman Scripts
Post by: TrailMyx on May 25, 2010, 10:30:28 AM
Hey MM, if you get a chance you might want to run your scripts through the SUO syntax checker.  That might help you out a bit.  It still helps me, and I wrote it!  ;)

Thanks for the goodies, though!
Title: Re: Marlboroman Scripts
Post by: Marlboroman on May 25, 2010, 10:42:38 AM
Sure thing I'll check that out.. I wrote all these scripts using Easy Uo hopefully there wont be any problems with the menu's and so forth.  I don't imagine a problem but I will check that out.
Title: Re: Marlboroman Scripts
Post by: TrailMyx on May 25, 2010, 10:48:24 AM
Ya, I originally wrote ALL my scripts with EasyUO.  Then after I wrote ScriptUO, I was kinda disgusted by all the typos and other strange things that I just learned to live with as the scripts executed.  There's still a few things about the syntax checker that are a bit off, but for the most part it will catch 95% of syntax strangeness.  ;)
Title: Re: Marlboroman Scripts
Post by: Marlboroman on May 25, 2010, 12:18:26 PM
Ok Clean up is complete however the Syntax checker said a few of my subs had no return all though when I scrolled down to the exact line of the sub as it said there was a return in the sub. So I'm not sure if it didn't find it or if it just skipped the return but the Return was there in every sub. I believe out of the 5 scripts only 3 had this occurance don't know what to think of it other then odd. However it made me go back and double check things alot.  Thought I was going crazy no return in a sub scroll down find the return then think what the hell is it talking about.  Needless to say half a pack of cigarettes later the return was there all along and I don't know what it's talking about. 
Title: Re: Marlboroman Scripts
Post by: Cerveza on May 25, 2010, 12:32:23 PM
You have subs embedded within other subs...

The keg emptier script...

Line 131 is "sub menutracker"
Lines 132-176 have no "return"
Line 177 is "sub securesetup"

So the flow would be from one sub directly into another which is incorrect. You probably should have a sub to complete your "menutracker".

*I only looked at this one script, it's probably something similar with the other 2 you found.

******************************

Wood Pulp

Line 301 is "sub startcookin" which doesn't have a return. There's a goto loop in there ( :'( ) and it *should* have a return someplace.

******************************

Chicken Coop

Line 627 has your halt sub "sub Endchicktending"

SUO doesn't see the return (you have the script halting) and that's why it generated the error. It's semantics really, just put a return after the "halt" and SUO will be happy. Of course the return will never be hit.

******************************************

Smoke Bomb

** Error - Line 85: Unknown command Hide
** Error - Line 576: Unknown command to
** Error - Line 579: Unknown command mortars

Actually line 578 should be in there too, looks like free text and line 578 starts with the word "if" which is a valid EUO command :)

*******************************************

Just pointing out that SUO is a great tool to clean up code.

Title: Re: Marlboroman Scripts
Post by: TrailMyx on May 25, 2010, 12:34:08 PM
ScriptUO is literally looking for subroutines to have matching sub/returns, even though you might be halting the sub before you ever get to a return.  Take for example your chicken coup script:

Code: [Select]

sub Endchicktending

gosub putuppet
display out of food restock and restart script please!

halt


This will give the error because there's no matching "return".  Sure, it doesn't need it, but unfortunately the syntax checker can't interpret your intentions within a script, and only reports explicit syntax deviations. 

Make sense?
Title: Re: Marlboroman Scripts
Post by: TrailMyx on May 25, 2010, 12:38:49 PM
You have subs embedded within other subs...

The keg emptier script...

Line 131 is "sub menutracker"
Lines 132-176 have no "return"
Line 177 is "sub securesetup"

So the flow would be from one sub directly into another which is incorrect. You probably should have a sub to complete your "menutracker".

*I only looked at this one script, it's probably something similar with the other 2 you found.

There are people at EUO that claim it's OK to have nested subroutines.  I never really programmed that way since I always felt that subroutines should be singular.  So if you do have nested subroutines, it'll always throw that error.  Thing is, many people code not intending to have nested routines, but they do.

Sorry, not trying to nitpick your stuff since there's lots of ways to code these things.  And the syntax checker isn't always 100% right, especially if you are really intending to code away from what it expects.  Just use it as a tool, and not a rule.  ;)
Title: Re: Marlboroman Scripts
Post by: onlyindreams on May 25, 2010, 12:46:07 PM
Thanks for sharing!
Title: Re: Marlboroman Scripts
Post by: Cerveza on May 25, 2010, 12:46:23 PM
So how does the script flow with nested subs?

1 - sub this
2 - stuff
3 - sub that
4 - different stuff
5 - return

Does the flow just go 1-5? Then you *could* gosub to either 1 or 3 from elsewhere in the script?

*Actually you would have to either gosub to 1 AND 3, or 3 by itself.

Seems like poor scripting if you ask me.

If you want to do subs 1 and 3 consecutively, then just call them like that from the main loop, or wherever your calling those subs from... but don't run them together.....
Title: Re: Marlboroman Scripts
Post by: Marlboroman on May 25, 2010, 12:51:51 PM
I found the things it is talking about on my chicken tending script found the error and why it is saying it's embedded.

the sub directly above it is as follows
Code: [Select]
sub Endchicktending

gosub putuppet
display out of food restock and restart script please!

halt

;===============================================

because of how the sub is entended to work that particular script is not entended to have a return because it stops the script when you are out of food. there for it says the next script is embeded with this one however it is not entended because of the script does hit the Endchicktending sub it stops the script and does not continue.  I guess I could through a return under the halt just to make it cosher with the syntax error check just to make it happy I suppose it will.  As a result of finding this occurance I went back and checked the other 2 and I did find simular things so I fixed those as well.
Title: Re: Marlboroman Scripts
Post by: Marlboroman on May 25, 2010, 01:09:55 PM
The Subs aren't run together I've finished checking the syntax and no errors reporting now however I don't consider it an error when the scripts halts then there is a different sub under that.  I don't consider that embedding. and for the purposes of the script and how it runs neither does the program because the script HALTS and doesn't move forward.  However I did put a return under the halt even though it will never hit the return. As much it is all fixed  and lovely now so the Syntax Error check doesn't have a problem with it.  As you said TM it is a good tool but just that a tool and it does have parameters that it can not go around. such as a sub that stops the script. All in all good tool. However it doesn't beat good old ole know how.  I've never put a return after a halt before in my life all though now I will probably do so to avoid a checker from saying I have something wrong.
Title: Re: Marlboroman Scripts
Post by: TrailMyx on May 25, 2010, 01:13:18 PM
Yup, I can only teach it so much.  So I taught it how to walk.  It's up to the scripter to run.  And if you can run with scissors, then you get an extra gold star!  ;)
Title: Re: Marlboroman Scripts
Post by: Marlboroman on May 25, 2010, 01:29:00 PM
Well I don't know about scissors sounds kind of dangerous but I can definitly do bubble gum that should be worth something.  Either way I have updated the downloads and all are fixed with the syntax check.. when you get a chance just give them a double check.  Thanks.
Title: Re: Marlboroman Scripts
Post by: TrailMyx on May 25, 2010, 01:40:35 PM
Well I don't know about scissors sounds kind of dangerous but I can definitly do bubble gum that should be worth something.  Either way I have updated the downloads and all are fixed with the syntax check.. when you get a chance just give them a double check.  Thanks.

I'm sure they are fine now.  Probably were fine before.  Most people aren't aware there is a syntax checker, so sometimes it's nice to re-introduce it to the masses.  You were the bubble-gum wielding, running test guinea pig!
Title: Re: Marlboroman Scripts
Post by: TrailMyx on May 01, 2015, 09:12:01 AM
I go back an read some of the scripts from time to time, but the comments in chicken coop attendant are hilarious!
Title: Re: Marlboroman Scripts
Post by: Endless Night on October 17, 2015, 10:07:06 AM
Congratulations your Script has been moved to Script library
(If you feel the script is in the wrong section please send me a pm.)

Thank you for your submission.