Hello Guest it is May 11, 2021, 06:18:59 PM

Author Topic: Message Box with Cancel?  (Read 4094 times)

0 Members and 1 Guest are viewing this topic.

Re: Message Box with Cancel?
« Reply #30 on: February 10, 2018, 01:40:07 PM »
Daz,
Here is my entire macro.  The repeat command works, to test this I kept hitting cancel and it pops back up as expected. 

However, when I input a number, it acknowledges that number until it reads the "until" line, then the variable "ActualTool1" returns an ERROR instead of #.

--What is the actual tool?
function m110()
local inst = mc.mcGetInstance()

repeat
     local ActualTool1 = wx.wxGetNumberFromUser("What tool is in the turret?", "Tool # ","Current Tool", 1, 1, 6) -- Default, Min, Max.
until (ActualTool1 ~= -1)

mc.mcToolSetCurrent(inst, ActualTool1)

end --m110

if (mc.mcInEditor() == 1) then
 m110()
end
Chad Byrd

Offline DazTheGas

*
  •  753 753
  • DazTheGas
    • View Profile
Re: Message Box with Cancel?
« Reply #31 on: February 10, 2018, 02:01:59 PM »
Oh I see now, der me....   you cannot run any of the getnumberfromuser or textfromuser from a macro. just remembered I tried to use this a while back. the lua stack is a cutdown version and wont allow dialogs like this.

DazTheGas
Theres always time for a choccy biccy
Re: Message Box with Cancel?
« Reply #32 on: February 10, 2018, 02:33:07 PM »
 This was allowing me to get text and numbers and use them.   Just not inside the repeat command.

 
Chad Byrd

Offline Chaoticone

*
  • *
  •  5,626 5,626
  • Precision Chaos
    • View Profile
Re: Message Box with Cancel?
« Reply #33 on: February 10, 2018, 02:53:36 PM »
You might try this.... instead of doing the repeat loop in the macro, have a separate function to check the number entered and another function to pop up the message box if needed.
;D If you could see the things I have in my head, you would be laughing too. ;D

My guard dog is not what you need to worry about!

Offline DazTheGas

*
  •  753 753
  • DazTheGas
    • View Profile
Re: Message Box with Cancel?
« Reply #34 on: February 10, 2018, 03:19:09 PM »
Here you go http://www.dazthegas.co.uk/forumanswers/m110.mp4 perhaps this will explain the error i was on about.

DazTheGas
Theres always time for a choccy biccy
Re: Message Box with Cancel?
« Reply #35 on: February 10, 2018, 05:10:27 PM »
Daz,
Thanks for the video.   I had that error pop up yesterday, didn't know what it was.   I'm guessing once you close it out the first time, you're good to go until Mach gets shutdown and turned back on again?
Chad Byrd