Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to call sub-routines? #46

Closed
scruffyfox opened this issue Jul 25, 2022 · 2 comments
Closed

Is it possible to call sub-routines? #46

scruffyfox opened this issue Jul 25, 2022 · 2 comments

Comments

@scruffyfox
Copy link

Basically the title.

I have a couple scripts that are quite complex and lengthy, but I would like them to trigger also from another trigger, is this possible?

This is my use-case: channel point redemption for "randomise vfx", which executes a long script to generate and send some API values, but at the end, I want to also Chat Send the result of the randomisation which is another long script triggered with !chain. I could Chat Send '!chain' which would trigger the command via chat, but was wondering if there's a nicer way of doing that from within the script.

I read about the Action section but didnt really understand how it's used or if it would help in my use-case.

Cheers!

@Kruiser8
Copy link
Owner

Kruiser8 commented Jul 27, 2022

Hey @scruffyfox, when you say "a couple scripts" are you referencing Kruiz Control events? Making sure you don't mean Javascript scripts.

The OnAction section would fit your use case. OnAction takes the event code and injects it into another event.

OnCommand b 0 !chain
Chat Send "Pre-Chain stuff..."
DoTheThing
Chat Send "Chained stuff..."

OnChannelPoint "Randomize VFX"
Chat Send "Randomizing stuff..."
DoTheThing

OnAction DoTheThing
Chat Send "Hey, we're doing the thing!"

is equivalent to

OnCommand b 0 !chain
Chat Send "Pre-Chain stuff..."
Chat Send "Hey, we're doing the thing!"
Chat Send "Chained stuff..."

OnChannelPoint "Randomize VFX"
Chat Send "Randomizing stuff..."
Chat Send "Hey, we're doing the thing!"

@scruffyfox
Copy link
Author

@Kruiser8 this is perfect! I had a feeling OnAction would be what I needed but I couldn't make full sense of the documentation. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants