Author Topic: 'menu get' issue  (Read 3128 times)

0 Members and 1 Guest are viewing this topic.

Offline GuadahTopic starter

  • Full Member
  • ***
  • Posts: 119
  • Activity:
    0%
  • Reputation Power: 3
  • Guadah has no influence.
  • Gender: Male
  • Who farted?!
  • Respect: +29
  • Referrals: 3
    • View Profile
    • L%N Website
'menu get' issue
« on: August 28, 2011, 09:24:38 AM »
0
I vaguely remember running into a similar problem years ago when I did the multi-skill trainer, however I can not find the error.  I've even looked back through the multi-trainer and have re-written the menu for this script, but it is still just cycling through each of the 5 option as if they are selected in the pull down.  The way I read it when I look at it is it will only cycle through the option if the Pull Down is selected to (lets use option 2) Blacksmithy AND the !old_menures is NOT #menuRes, which I have set previously in the code.

This is the area I believe my error is in:
Code: [Select]

menu combo create skill 85 40 120
menu combo add skill Alchemy
menu combo add skill Blacksmithy
menu combo add skill Carpentry
menu combo add skill Tailoring
menu combo add skill Tinkering

set !old_menures #menuRes

repeat
menu get skill
  if #menuRes = 1 && !old_menures <> #menuRes
     {
     set !old_menures #menuRes
     set %skill alch
     set %skill_name Alchemy:
     gosub main_menu
     )
  if #menuRes = 2 && !old_menures <> #menuRes
     {
     set !old_menures #menuRes
     set %skill blac
     set %skill_name Blacksmithy:
     gosub main_menu
     )
  if #menuRes = 3 && !old_menures <> #menuRes
     {
     set !old_menures #menuRes
     set %skill carp
     set %skill_name Carpentry:
     gosub main_menu
     )
  if #menuRes = 4 && !old_menures <> #menuRes
     {
     set !old_menures #menuRes
     set %skill tail
     set %skill_name Tailoring:
     gosub main_menu
     )
  if #menuRes = 5 && !old_menures <> #menuRes
     {
     set !old_menures #menuRes
     set %skill tink
     set %skill_name Tinkering:
     gosub main_menu
     )
until #false

sub main_menu
set %size1 105
set %size1 ( %size1 + 100 )
menu window size 290 %size1
menu shape status_bg 5 105 280 95 3 7 1 Black 7 Gray
menu font align right
menu font color black
menu font size 10
menu text titles 85 115 %skill_name
menu text titles 85 135 Attempts:
menu text titles 85 155 Time:
menu text titles 85 175 Last Gain:
return

And here is the entire script that I've written so far.  I am only on the menu, the actual script to perform (blacksmithing training only at this point) works fine.

Code: [Select]
set %sewing_kit HAG
set %ingot_type ENK
set %cloth_type CUI
set %oil_cloth RTI
set %size1 105
set %timeout #scnt + 5
gosub TM_AddUnderscore #CHARNAME
      set %charname #RESULT
 
; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
; XXXXXXXXXXXXXXX MENU DESIGN XXXXXXXXXXXXXXX
; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
;menu hideeuo
menu window title Guadah's Crafters Trainer
menu window color silver
menu window size 290 %size1
menu font bgcolor gray
menu shape potionbg 5 5 280 65 3 7 1 Black 7 Gray
menu font align right
menu text title 80 12 Resources:
menu text title 80 44 Train Skill:
menu font align left
menu font bgcolor silver
menu font size 10
menu button target_resource_bag 175 10 30 24 Set
menu edit resource_bag 85 10 85 %resource_bag
menu button start 230 10 50 25 Start
menu button quit 230 40 50 25 Quit
; pull down skill selection box
menu combo create skill 85 40 120
menu combo add skill Alchemy
menu combo add skill Blacksmithy
menu combo add skill Carpentry
menu combo add skill Tailoring
menu combo add skill Tinkering
; Status Box
menu shape status_bg 5 75 280 25 3 7 1 Black 7 Gray
menu font bgcolor gray
menu text status_title 10 80 Status:
menu font color maroon
menu font size 9
menu text status 60 80 Please wait, Initializing Script...
menu show

gosub TM_GetPersistantVariable resource_bag
menu set resource_bag #result
menu get resource_bag
if #menures = N/A
   {
   menu set status Please set your Resource Chest
   }
if #menures <> N/A
   {
   set %resource_bag #menures
   set #lobjectid %resource_bag
   event macro 17 0
    wait 10
   contpos 575 400
    wait 10
   }

set !old_menures #menuRes
repeat
if #menuButton = target_resource_bag
   {
   menu set status Please set your Resource Chest
   set #targCurs 1
set_resource_bag:
    if #targCurs = 1
     goto set_resource_bag
   Set %resource_bag #ltargetid
   Set #lobjectid %resource_bag
   Event Macro 17 0
    wait 10
   contpos 610 440
    wait 10
   menu font size 10
   menu set resource_bag %resource_bag
   gosub TM_SetPersistantVariable resource_bag %resource_bag
   set #menubutton N/A
   }
menu set status Please select your skill to train.
if #menubutton = Start
   {
   set #menubutton N/A
   menu delete Start
   menu font bgcolor silver
   menu font size 10
   menu font color black
   menu button Pause 230 10 50 25 Pause
   gosub training
   }
if #menubutton = Quit
   {
   set #menubutton N/A
   display ok Thank you for using my script.$
           +$
           +Script is Halting$
   menu hide
   halt
   }
menu get skill
  if #menuRes = 1 && !old_menures <> #menuRes
     {
     set !old_menures #menuRes
     set %skill alch
     set %skill_name Alchemy:
     gosub main_menu
     )
  if #menuRes = 2 && !old_menures <> #menuRes
     {
     set !old_menures #menuRes
     set %skill blac
     set %skill_name Blacksmithy:
     gosub main_menu
     )
  if #menuRes = 3 && !old_menures <> #menuRes
     {
     set !old_menures #menuRes
     set %skill carp
     set %skill_name Carpentry:
     gosub main_menu
     )
  if #menuRes = 4 && !old_menures <> #menuRes
     {
     set !old_menures #menuRes
     set %skill tail
     set %skill_name Tailoring:
     gosub main_menu
     )
  if #menuRes = 5 && !old_menures <> #menuRes
     {
     set !old_menures #menuRes
     set %skill tink
     set %skill_name Tinkering:
     gosub main_menu
     )
until #false

sub main_menu
set %size1 105
set %size1 ( %size1 + 100 )
menu window size 290 %size1
menu shape status_bg 5 105 280 95 3 7 1 Black 7 Gray
menu font align right
menu font color black
menu font size 10
menu text titles 85 115 %skill_name
menu text titles 85 135 Attempts:
menu text titles 85 155 Time:
menu text titles 85 175 Last Gain:
return

; #################################################
; ########            PAUSE SUB            ########
; #################################################
Sub CheckPause
if #menubutton = pause
   {
   set #menubutton N/A
   menu delete pause
   menu font color maroon
   menu font bgcolor silver
   menu button resume 230 10 50 25 Resume
   menu set status Paused!  Click "Resume" when ready.
   gosub PauseLoop
   }
if #menubutton = quit
   {
   display ok Thank you for using Guadah's Alchemist Assistant.$
          +$
          +Script is Halting$
   menu hide
   halt
   }
return

Sub PauseLoop
Pause_Loop:
If #menubutton = resume
   {
   set #menubutton N/A
   Menu Delete Resume
   Menu Font Color Black
   menu font bgcolor silver
   Menu Button Pause 230 10 50 25 Pause
   Return
   }
if #menuButton = quit
   {
   Display ok Thank you for using Guadah's Alchemist Assistant.$
            +$
            +Script is Halting$
   Menu Hide
   Halt
   }
Goto Pause_Loop
Return
; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
; XXX TRAILMYX'S PERSISTANT VARIABLE SUBS XXX
; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
sub TM_GetPersistantVariable
  set #RESULT %1 , _ , #CHARID
  set #RESULT * . #RESULT
return #RESULT
sub TM_SetPersistantVariable
  set #RESULT %1 , _ , #CHARID
  set * . #RESULT %2
return

I've left out the crafting & training subs, since the script doesn't even get to that part... there was no need to bog down extra code.

If any of you see what I've missed, I'd love a pointer on what I did wrong.  I've tried to walk away and come back with fresh eyes, but still don't see the issue.

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • 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: 'menu get' issue
« Reply #1 on: August 28, 2011, 09:51:02 AM »
0
In each of your "IF" statements, try setting the "#menures" to N/A after you are done.

You can even get rid of the !old_menures then:

Code: [Select]
 
if #menuRes = 1
     {
     set #menuRes N/A
     set %skill alch
     set %skill_name Alchemy:
     gosub main_menu
     )
...
« Last Edit: August 28, 2011, 09:56:06 AM by TrailMyx »
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline GuadahTopic starter

  • Full Member
  • ***
  • Posts: 119
  • Activity:
    0%
  • Reputation Power: 3
  • Guadah has no influence.
  • Gender: Male
  • Who farted?!
  • Respect: +29
  • Referrals: 3
    • View Profile
    • L%N Website
Re: 'menu get' issue
« Reply #2 on: August 28, 2011, 03:20:21 PM »
0
Still doing the same thing.  The 'gosub main_menu' section adds onto the menu, increases the size and adds in information etc.  It's just cycling through each of the 'if #menuRes = X' commands and then goes through like they are correct.

I did the changes you recommended TM, but have the same issues still.

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • 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: 'menu get' issue
« Reply #3 on: August 28, 2011, 07:33:17 PM »
0
Ah you know after I typed that I kinda got sidetracked into thinking you were doing #MENUBUTTON.  Sorry for the brain fart, I was in a hurry this morning.

You might be getting bitten by the parser error in EUO.  Try parenthesis in your IF statements like this:

Code: [Select]
  if ( ( #menuRes = 1 ) && ( !old_menures <> #menuRes ) )
     {
     set !old_menures #menuRes
     set %skill alch
     set %skill_name Alchemy:
     gosub main_menu
     )
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline GuadahTopic starter

  • Full Member
  • ***
  • Posts: 119
  • Activity:
    0%
  • Reputation Power: 3
  • Guadah has no influence.
  • Gender: Male
  • Who farted?!
  • Respect: +29
  • Referrals: 3
    • View Profile
    • L%N Website
Re: 'menu get' issue
« Reply #4 on: August 29, 2011, 12:21:36 AM »
0
Still the same issue.  I'm dumbfounded at this point.  I've gone line by line from the Multi-skill trainer to see how it was done there, and I have it practically copied, yet getting two different reactions.

Here's what I changed (Taking your advice)

Code: [Select]
menu get skill
  if ( ( #menuRes = 1 ) && ( !old_menures <> #menuRes ) )
     {
     set !old_menures #menuRes
     set %skill alch
     set %skill_name Alchemy:
     gosub main_menu
     )
  if ( ( #menuRes = 2 ) && ( !old_menures <> #menuRes ) )
     {
     set !old_menures #menuRes
     set %skill blac
     set %skill_name Blacksmithy:
     gosub main_menu
     )
  if ( ( #menuRes = 3 ) && ( !old_menures <> #menuRes ) )
     {
     set !old_menures #menuRes
     set %skill carp
     set %skill_name Carpentry:
     gosub main_menu
     )
  if ( ( #menuRes = 4 ) && ( !old_menures <> #menuRes ) )
     {
     set !old_menures #menuRes
     set %skill tail
     set %skill_name Tailoring:
     gosub main_menu
     )
  if ( ( #menuRes = 5 ) && ( !old_menures <> #menuRes ) )
     {
     set !old_menures #menuRes
     set %skill tink
     set %skill_name Tinkering:
     gosub main_menu
     )
until #false

Maybe I'll just scrap it and start over from scratch.  Starting to get frustrated.

Offline 12TimesOver

  • Another Day, Another Vendetta
  • Global Moderator
  • *
  • *
  • Posts: 3694
  • Activity:
    0%
  • Reputation Power: 41
  • 12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.
  • Gender: Male
  • Respect: +321
  • Referrals: 2
    • View Profile
Re: 'menu get' issue
« Reply #5 on: August 29, 2011, 02:31:47 AM »
0
Probably a dumb question, but why are you checking against the !old_menures at all? Is that to make sure that someone has actually seletected an option to begin with? If so, it may be easier to skip that and then just check the value of %skill at the end of the menu check - if it's N/A then it was never set, for example.
When they come for me I'll be sitting at my desk
     with a gun in my hand wearing a bulletproof vest
My, my, my how the time does fly
     when you know you're gonna die by the end of the night

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • 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: 'menu get' issue
« Reply #6 on: August 29, 2011, 07:25:15 AM »
0
You'll kick yourself when you see what your problem was.  FYI, ScriptUO (the program and the syntax checker is your friend).... :)

This test version works the way you were anticipating with my little tweak....  See if you can see the difference in my code to yours before you click the spoiler button....

Spoiler: show
Pay close attention to your "braces".....


Code: [Select]
gosub showEUOMenu1

menu combo add newskill Alchemy
menu combo add newskill Blacksmithy
menu combo add newskill Carpentry
menu combo add newskill Tailoring
menu combo add newskill Tinkering
menu get newskill
set !old_menures #menuRes

repeat
menu get newskill
  if ( ( #menuRes = 1 ) && ( !old_menures <> #menuRes ) )
     {
     set !old_menures #menuRes
     set %skill alch
     set %skill_name Alchemy:
     gosub main_menu
     }
  if ( ( #menuRes = 2 ) && ( !old_menures <> #menuRes ) )
     {
     set !old_menures #menuRes
     set %skill blac
     set %skill_name Blacksmithy:
     gosub main_menu
     }
  if ( ( #menuRes = 3 ) && ( !old_menures <> #menuRes ) )
     {
     set !old_menures #menuRes
     set %skill carp
     set %skill_name Carpentry:
     gosub main_menu
     }
  if ( ( #menuRes = 4 ) && ( !old_menures <> #menuRes ) )
     {
     set !old_menures #menuRes
     set %skill tail
     set %skill_name Tailoring:
     gosub main_menu
     }
  if ( ( #menuRes = 5 ) && ( !old_menures <> #menuRes ) )
     {
     set !old_menures #menuRes
     set %skill tink
     set %skill_name Tinkering:
     gosub main_menu
     }
until #false

sub main_menu
  menu set EUOEdit1 %skill_name
return

;--------- EasyUO Menu Designer Code Begin ---------
sub showEUOMenu1
menu Clear
menu Window Title EUOMenu1
menu Window Color BtnFace
menu Window Size 340 254
menu Font Transparent #true
menu Font Align Right
menu Font Name MS Sans Serif
menu Font Size 8
menu Font Style
menu Font Color WindowText
menu Font BGColor Window
menu combo Create newskill 32 24 121 97
menu Font Name MS Sans Serif
menu Font Size 8
menu Font Style
menu Font Color WindowText
menu Edit EUOEdit1 32 136 121 EUOEdit1
menu Show 421 270
return
;--------- EasyUO Menu Designer Code End ---------
« Last Edit: August 29, 2011, 07:32:40 AM by TrailMyx »
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline GuadahTopic starter

  • Full Member
  • ***
  • Posts: 119
  • Activity:
    0%
  • Reputation Power: 3
  • Guadah has no influence.
  • Gender: Male
  • Who farted?!
  • Respect: +29
  • Referrals: 3
    • View Profile
    • L%N Website
Re: 'menu get' issue
« Reply #7 on: August 29, 2011, 08:00:51 AM »
0
oh good lord.
All of my closing brackets were )'s... not }... the actual closing brackets.

If you need me, I'll be in the corner in the fetal position... crying.

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • 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: 'menu get' issue
« Reply #8 on: August 29, 2011, 08:02:25 AM »
0
If you need me, I'll be in the corner in the fetal position... crying.

Lol, I hear ya.  It was doing the same to me.  Generally when a script is acting that wonky, it's good to put it through the ScriptUO checker and "BAM" there she was.
Please read the ScriptUO site RULES
Come play RIFT with me!

Tags: