Hello Guest it is April 19, 2024, 07:00:24 PM

Author Topic: Execute Button Script - how do you use it?  (Read 20262 times)

0 Members and 1 Guest are viewing this topic.

Offline Rademacher

*
  •  25 25
  • Give it a try! How hard can it be?
    • View Profile
Execute Button Script - how do you use it?
« on: November 24, 2010, 07:24:45 PM »
I have been attempting to write a brain that will trigger my auto Z script when a Pokey55 button is pushed.  Can't seem to find a way to make scripts run from brains. 

Does any one know how to implement the Execute Button Script?  I am thinking this maybe the solution to my problem.

thanks,
Wayne

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Execute Button Script - how do you use it?
« Reply #1 on: November 24, 2010, 07:58:31 PM »
Set Trigger Macro using “Push User Button” in Brians:

First, you dont put the code in a button, you put it in a macro file. For
example file: m600.m1s
SetMessage( "This is a macro call..")

Then , you have to set that macro to be the default macro call with a call to
SetTriggerMacro( 600 ) at some point in the program, an init string could do
that if the SetTriggerMacro call were in another macro file that is called on
startup.  Then the brain will execute m600 whenever that brain termination code is
called.
fun times

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Execute Button Script - how do you use it?
« Reply #2 on: November 24, 2010, 08:40:08 PM »
HIYA SCOT, I must have fallen off the pumpkin wagon and bumped my head. Could you explain that again???

(;-) TP

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Execute Button Script - how do you use it?
« Reply #3 on: November 25, 2010, 10:23:11 AM »
Sure....
Quote
Set Trigger Macro using “Push User Button” in Brians:
First, you dont put the code in a button, you put it in a macro file. For
example file: m600.m1s
SetMessage( "This is a macro call..")
Then , you have to set that macro to be the default macro call with a call to
SetTriggerMacro( 600 ) at some point in the program, an init string could do
that if the SetTriggerMacro call were in another macro file that is called on
startup.  Then the brain will execute m600 whenever that brain termination code is
called.

hehehehe.......... sorry couldn't resist...

Ok Make the "Macro" that you want to be triggered, for instance M600 as above this macro does what ever....
then if you want it to auto trigger you have to set it using the set macro call. this will be a SEPERATE macro call.

So under General cfg, in the Init Put your set trigger macro in the init line, call it M1000.m1s
in that macro put the set trigger macro call:

'M1000.m1s (in the init line)
SetTriggerMacro( 600 )

//////////////////////////

When Mach starts up, it runs the "Init" line, which in turn runs the SetTriggerMacro call and sets which macro number will trigger
i.e. M600.m1s

So, in Brains.....  you have your even that triggers your "Trigger Macro button" termination.......
for aurguments sake, lets say you use ULED 2000 to trigger that function.

so your rung would look like: NOTE!! You may, or may not have to make an invert OP call after the ULED
depending on where it is coming from.

ULED 2000->Invert OP->Trigger Macro Button

so when ULED 2000 turns on, it will run the function that runs the macro you have set in the trigger.....

see!!!! Simple as PIE!!!!!!!!  hehehhehehehe  (  NOT!!!!! )

scott
fun times

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Execute Button Script - how do you use it?
« Reply #4 on: November 25, 2010, 11:04:19 AM »
oK so it was NOT the bump on the head, maybe just blind but I don't see ANY button push in Brians that will terminate with a macro call. Can you give me the button number(;-)

Up to now I had to set a user led and then monitor the led from the macropump to make it work(Not a good way as it eats up resources)

(;-) TP

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Execute Button Script - how do you use it?
« Reply #5 on: November 25, 2010, 07:28:34 PM »
???? in brains 1034

s.
fun times

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Execute Button Script - how do you use it?
« Reply #6 on: November 25, 2010, 09:51:05 PM »
BOY someone needs to rename that button(;-)

So  does that mean you can only have one button and call one macro??

(;-) TP



Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Execute Button Script - how do you use it?
« Reply #7 on: November 25, 2010, 10:09:24 PM »
yeap
fun times

Offline Greolt

*
  •  956 956
    • View Profile
Re: Execute Button Script - how do you use it?
« Reply #8 on: November 26, 2010, 01:13:31 AM »
Thanks for that info Scott

I presume that button press is   "1034 - Execute Button Script"

Greg

Offline Rademacher

*
  •  25 25
  • Give it a try! How hard can it be?
    • View Profile
Re: Execute Button Script - how do you use it?
« Reply #9 on: November 26, 2010, 09:16:16 AM »
Wow, so intuitive....can't believe I missed it;)

Seriously, really appreciate the help, I was really stuck.

Wayne