Author Topic: Hitech's Master Control  (Read 18717 times)

0 Members and 1 Guest are viewing this topic.

Offline HitechsTopic starter

  • Full Member
  • ***
  • Posts: 116
  • Activity:
    0%
  • Reputation Power: 2
  • Hitechs has no influence.
  • Respect: +28
  • Referrals: 1
    • View Profile
Hitech's Master Control
« on: March 05, 2017, 10:20:53 PM »
+2
removed
« Last Edit: April 21, 2017, 10:49:28 AM by Hitechs »

Offline HitechsTopic starter

  • Full Member
  • ***
  • Posts: 116
  • Activity:
    0%
  • Reputation Power: 2
  • Hitechs has no influence.
  • Respect: +28
  • Referrals: 1
    • View Profile
Re: Hitech's Master Control
« Reply #1 on: March 06, 2017, 03:51:04 PM »
+1
was thinking i could do any of the menu button clicks with 1 sub , instead of 100 if's
will have to look at how to pass the button location inside the window to the sub, depending on what button clicked

« Last Edit: March 13, 2017, 08:48:38 PM by Hitechs »

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13301
  • Activity:
    0%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: Hitech's Master Control
« Reply #2 on: March 06, 2017, 04:03:55 PM »
+1
So what you want is for one sub to change the button state for all your buttons with the addition of input arguments?
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline HitechsTopic starter

  • Full Member
  • ***
  • Posts: 116
  • Activity:
    0%
  • Reputation Power: 2
  • Hitechs has no influence.
  • Respect: +28
  • Referrals: 1
    • View Profile
Re: Hitech's Master Control
« Reply #3 on: March 06, 2017, 04:04:57 PM »
+1
ya , sure would make script smaller and adding new buttons easy

Offline valen2.0

  • Full Member
  • ***
  • Posts: 229
  • Activity:
    0%
  • Reputation Power: 3
  • valen2.0 has no influence.
  • Respect: +63
  • Referrals: 0
    • View Profile
Re: Hitech's Master Control
« Reply #4 on: March 06, 2017, 04:06:59 PM »
+1
Hmm has this been tested for OSI?

Offline HitechsTopic starter

  • Full Member
  • ***
  • Posts: 116
  • Activity:
    0%
  • Reputation Power: 2
  • Hitechs has no influence.
  • Respect: +28
  • Referrals: 1
    • View Profile
Re: Hitech's Master Control
« Reply #5 on: March 06, 2017, 04:07:27 PM »
+1
I have all the locations loaded at start to build the menu,
granted a few buttons will need specail treatment, but that should be ok

« Last Edit: March 13, 2017, 08:49:01 PM by Hitechs »

Offline HitechsTopic starter

  • Full Member
  • ***
  • Posts: 116
  • Activity:
    0%
  • Reputation Power: 2
  • Hitechs has no influence.
  • Respect: +28
  • Referrals: 1
    • View Profile
Re: Hitech's Master Control
« Reply #6 on: March 06, 2017, 04:08:32 PM »
+1
its just a menu, you can test it without client open

Offline The Ghost

  • Elite
  • *
  • *
  • Posts: 1917
  • Activity:
    0%
  • Reputation Power: 25
  • The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.
  • Respect: +245
  • Referrals: 0
    • View Profile
Re: Hitech's Master Control
« Reply #7 on: March 06, 2017, 04:09:14 PM »
+1
two line of code to use any button in your script, can't be more simpler.
Code: easyuo
  1. if #menubutton <> n/a
  2.   gosub #menubutton
  3.  

Offline HitechsTopic starter

  • Full Member
  • ***
  • Posts: 116
  • Activity:
    0%
  • Reputation Power: 2
  • Hitechs has no influence.
  • Respect: +28
  • Referrals: 1
    • View Profile
Re: Hitech's Master Control
« Reply #8 on: March 06, 2017, 04:10:11 PM »
+1
@ ghost .... seems pointless
 
that seems pointless

100 if statements  or 100 gosubs ... i see no gain

Offline HitechsTopic starter

  • Full Member
  • ***
  • Posts: 116
  • Activity:
    0%
  • Reputation Power: 2
  • Hitechs has no influence.
  • Respect: +28
  • Referrals: 1
    • View Profile
Re: Hitech's Master Control
« Reply #9 on: March 06, 2017, 04:13:44 PM »
+1
this would do all my buttons with 2 subs


Code: [Select]
sub buttonlocation
blah blah
blah blah

gosub menuButtonClicked x y w h
return


Code: [Select]
sub menuButtonClicked
;----------- menu Button {name} {x} {y} {width} {height} {text}

if #menubutton = #false
          return
menu delete button #menubutton

        if ! . #menubutton = #false
           {
            set ! . #menubutton #true
            menu font BGcolor red
            menu font color white
           menu Button #menubutton 120 105 30 23 #menubutton ;----- hmm location of each button ???
           ;--menu Button #menubutton %1 %2 %3 %4 #menubutton ;--- maybe pass the location with gosub
             }
        else
            {
            set ! . #menubutton #false
            menu font BGcolor blue
            menu font color white
            menu Button #menubutton 120 105 30 23 #menubutton
            ;--menu Button #menubutton %1 %2 %3 %4 #menubutton ;--- maybe pass the location with gosub
             }
       set #menubutton #false
        }
       
return

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13301
  • Activity:
    0%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: Hitech's Master Control
« Reply #10 on: March 06, 2017, 04:14:50 PM »
+2
Then I think what you are talking about would work great. 

Another thing you can try when you actually call function for your subs, you can also name your subroutine the button name, so instead of having to parse lots of "IF" statements, you can just see that #MENUBUTTON has changed and then "gosub #MENUBUTTON".  There's lots of little sneaky ways to make EUO work for you.  I personally DON'T do that because the code isn't as clear, but that's me.

Code: easyuo
  1. gosub showEUOMenu1
  2.  
  3. repeat
  4.   if #MENUBUTTON <> N/A
  5.     gosub sub_ , #MENUBUTTON
  6. until #FALSE
  7.  
  8. sub sub_test1
  9.   display ok test1 pressed
  10.   set #MENUBUTTON N/A
  11. return
  12.  
  13. sub sub_test2
  14.   display ok test2 pressed
  15.   set #MENUBUTTON N/A
  16. return
  17.  
  18.  
  19.  
  20. ;--------- EasyUO Menu Designer Code Begin ---------
  21. sub showEUOMenu1
  22.         menu Clear
  23.         menu Window Title Test Window
  24.         menu Window Color BtnFace
  25.         menu Window Size 467 523
  26.         menu Font Transparent #true
  27.         menu Font Align Right
  28.   menu Button test1 120 105 75 23 testbutton1
  29.   menu Button test2 120 135 75 23 testbutton2
  30.         menu Show 421 270
  31. return
  32. ;--------- EasyUO Menu Designer Code End ---------
  33.  
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline The Ghost

  • Elite
  • *
  • *
  • Posts: 1917
  • Activity:
    0%
  • Reputation Power: 25
  • The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.
  • Respect: +245
  • Referrals: 0
    • View Profile
Re: Hitech's Master Control
« Reply #11 on: March 06, 2017, 04:15:23 PM »
+1
you don't scan for any if statement. 
 the button is your action,  the sub and button have the same name.   

Offline HitechsTopic starter

  • Full Member
  • ***
  • Posts: 116
  • Activity:
    0%
  • Reputation Power: 2
  • Hitechs has no influence.
  • Respect: +28
  • Referrals: 1
    • View Profile
Re: Hitech's Master Control
« Reply #12 on: March 06, 2017, 04:19:07 PM »
+1
im still not following, let me recap

currently

Code: [Select]
if #menubutton = thing
{
do stuff
}
else
{
do other stuff
}

100 times

the gosub way

Code: [Select]
if #menubutton <> #false
       gosub #menubutton

sub thing
return

sub thing2
return

100 times

or do u mean something else?

Offline HitechsTopic starter

  • Full Member
  • ***
  • Posts: 116
  • Activity:
    0%
  • Reputation Power: 2
  • Hitechs has no influence.
  • Respect: +28
  • Referrals: 1
    • View Profile
Re: Hitech's Master Control
« Reply #13 on: March 06, 2017, 04:22:20 PM »
+1
I dont feel i need a gosub for every button.....

no matter what button i click the code does the same thing, except each button has a diffrent location so 1 sub should be fine

Offline The Ghost

  • Elite
  • *
  • *
  • Posts: 1917
  • Activity:
    0%
  • Reputation Power: 25
  • The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.
  • Respect: +245
  • Referrals: 0
    • View Profile
Re: Hitech's Master Control
« Reply #14 on: March 06, 2017, 04:29:59 PM »
+1
until a button is push it will loop until those two line of code.  when u push button it will just to the sub and perform the subroutine.    The way you do it Htiech is fine, it just required more line.  This cut down the IF statement.   

I started last years to use this method instead of your. 



This was my first attempt of making a G-Bot.   it was simple. 
Code: [Select]
loop:
if #menubutton <> #false
       gosub #menubutton
togo loop:




sub heal
 enter your action
return

sub cure
 enter your action
return


There are 1 attachment(s) in this post. You must register and post an acceptable introduction to download
Gbot main.JPG

Tags: