ScriptUO

Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: The Ghost on July 04, 2013, 09:20:07 PM

Title: Help with Menu setup
Post by: The Ghost on July 04, 2013, 09:20:07 PM
I have this on menu to help me clean my backpack after Fishing and  hunting.   My question is there a way to get the menu to return to false after the pack is clean.   I'm trying to clean up a few of my snippet and learning menu at the same time.   


menu check packcheck 10 90 130 15 #false Clean Backpack

Quote
sub updatemenu
        menu get packcheck
        if #menures = #true
        {
           gosub packcheck
        }
return

Thx
Title: Re: Help with Menu setup
Post by: TrailMyx on July 04, 2013, 09:31:23 PM
Something like this?

Code: [Select]
sub updatemenu
        menu get packcheck
        if #menures = #true
        {
           gosub packcheck
           menu set packcheck #FALSE
        }
return
Title: Re: Help with Menu setup
Post by: The Ghost on July 04, 2013, 10:30:51 PM
So simple, it work fine.  thx  I was trying with the button but no joy.  BTW  what are #2 for.  I  have seen 2 and 4 on other ppl build.

Quote
if #menubutton = packcheck 2
    set #menubutton N/A
      gosub findshoes  ; feed them to goat
      gosub cutfish    ; cut into steak
      gosub eatfish    ; eat special fish

Title: Re: Help with Menu setup
Post by: manwinc on July 04, 2013, 10:43:05 PM
if you put a # after an IF statement it tells the Script how many lines to execute if the If statement is true.


if #true = #True 3
do this
do this
do this

Same thing as

if #True = #True
{
do this
do this
do this
}


This function is rather.... obsolete though... Makes debugging very annoying... Parenthesis are much better. In My Opinion anyways.
Title: Re: Help with Menu setup
Post by: TrailMyx on July 04, 2013, 11:09:06 PM
Bad bad manwinc for teaching that horrible technique.....  YUCK!
Title: Re: Help with Menu setup
Post by: manwinc on July 04, 2013, 11:43:58 PM
I didn't teach it!!!!  I stared at the code he posted for like 10 minutes going wtf???

It took me years to break myself of Goto's, now I'm trying to break myself of Multiple Returns out of subs, Indenting, Etc etc etc.
Title: Re: Help with Menu setup
Post by: Bookwyrm on July 05, 2013, 02:08:25 AM
Bad bad manwinc for teaching that horrible technique.....  YUCK!

*Hands TM the Wet Noodle of Death*
Been nice knowin' ya MW :'(
Title: Re: Help with Menu setup
Post by: The Ghost on July 05, 2013, 07:08:44 AM
I didn't teach it!!!!  I stared at the code he posted for like 10 minutes going wtf???

It took me years to break myself of Goto's, now I'm trying to break myself of Multiple Returns out of subs, Indenting, Etc etc etc.

That how I feel most of the time.   You guy are my mentors in here.  So since I use some old MW work he wrote, I must have the same bad habit. :)
Title: Re: Help with Menu setup
Post by: manwinc on July 05, 2013, 10:34:24 AM
I've never used the

if This = That 2
Do this
Do this

Code Structure
Title: Re: Help with Menu setup
Post by: Alpha on July 05, 2013, 12:41:48 PM
Heh.....   I was vaguely aware that you could throw the # on the end of the IF but I've also never used it.   I do the one line execution without parenthesis all the time though, & I cannot make up my mind if that's good practice or not...  Actually anytime I use parenthesis I always type the pair of them and THEN go put stuff between them just so I never forget.


1)

If %Good_day #True
  Msg Hooray

2)

If %Good_day #True
  {
     Msg Hooray
  }
Title: Re: Help with Menu setup
Post by: The Ghost on July 05, 2013, 03:26:42 PM
Trying to make send of all those command. and all those little detail can only be find by asking question and paying close attention how the line cycle.

MW, not said that you do,  I look around and try to figure out how to write properly.
Title: Re: Help with Menu setup
Post by: manwinc on July 05, 2013, 04:43:51 PM
Yeah,

Here are a few Tips.

Take advantage of Subs other People have already written. EndlessNight has a very Comprehensive sub library you can abuse to no end. This will save you a whole lot of time Rebuilding the Wheel. Crafting Subs, Clicking subs, Rail Engines, Recalling, Pixel Scanning, Journal Scanning its all been done by multiple coders here and you can incorporate them into your scripts very Easily. If you are Having a hard time coding something, just ask for help or ask if someone has already coded a specific Piece.

Avoid Goto's at all Cost.

Once you start getting the Hang of EUO's language, introduce yourself to Namespaces. It Basically gives you the ability to code Subs without Having to worry about OverWriting a variable somewhere in the Script. Namespaces are Essential for Universal Subs. You can Also use them To Communicate Between Scripts (My Favorite kind of thing)

I really need to Clean up my Sub Library and Get Some Finished/Polished Products over here available for people to use. Its really quite silly how easy most of this stuff is once you have the Bulk of the Code done.