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

Create/enable a function in each menu command to execute a block #1038

Open
gws3 opened this issue Oct 25, 2021 · 7 comments
Open

Create/enable a function in each menu command to execute a block #1038

gws3 opened this issue Oct 25, 2021 · 7 comments

Comments

@gws3
Copy link

gws3 commented Oct 25, 2021

There are maybe 10 things I can think of that this would help me do, from quickly setting a variable to a sound effect to splitting the destination of a menu command according to variables. Currently I just create flow-through blocks, but in the end I end up with almost as many of those flow-throughs as I do with blocks with actual gameplay in them.

I assume you could just put it under "Hide this Option" in the Inspector --- ExecuteBlock by String and have it be None for a default.

I tried a few different things, but failed to come up with a better working solution than just creating lots of variable-setting blocks in the middle of conversations.

And it's not a big problem, it would just drastically reduce my Flowchart clutter.

@Arylos07
Copy link
Contributor

I'm afraid I really don't follow.

Menus already call a destination block when selected. Do you mean call an additional block along with the menu? If so, you could use the Call command and tell it to continue. That way the additional block still gets called without interrupting the block you're currently running and can designate a specific command index to call if you are wanting to start at a specific command in your other block.
Screenshot_163

@gws3
Copy link
Author

gws3 commented Oct 26, 2021

No problem, I end up with conversations or narrative where the destination is the same regardless of choice, or I want to quickly assign a variable change depending on an action they take that still has the same result. But I could also use it for sound effects or to invoke an event or change something they see. While using Call would work prior to the Menu choice, I'd like separate results for each of the Menu choices if possible. In this case the second menu choice would fire the block that subtracts XP, but both end up at New Block1, still in the same conversation.

An example of this is I had a character either reply nicely or rudely to a love interest, then later, she either refuses or accepts his offer of a date.
sample

@breadnone
Copy link
Contributor

Call has jump to label and you don't need to make separate block just for this. Tag it with a label command, then put a Stop after the choice OR you can call another block or anything that suits your needs. Adding similar function will just bloat the command

@gws3
Copy link
Author

gws3 commented Oct 27, 2021

Hi, is there a way to do that with a Menu command, (not Call)? I have tried many, many variations of nesting menu commands in 'If then Set Variable' arrangements, running them all through a common StatIncrease (or StatDecrease, with corresponding Set Slider commands) box and back out, but none did anything except increase the steps to take and add 40% more "bloat."

How about just a Set Variable option with each menu command?

An example would be to set a name.

"what is your name?" Mike or Joe or Mary or Lisa (Set String Variable)

... Then the story goes on....

That could be 2 blocks instead of 5.

. Thanks

@breadnone
Copy link
Contributor

breadnone commented Oct 27, 2021

You just need to do it smartly...

  1. Make 1 block and put ALL of your choices!
  2. Label tag them
  3. And thats it!

Same goes to your set variable, you must treat it as a reusable function rather than making it bunch of them.

If you did it this way, you'll be surprised how compact your flowchart will be.

I'm not even joking :) Just give it a try. If thats not your cup of tea, you can do what you want with custom command, which is the preferred way of doing it based on your use cases. And it's quite easy to make

@gws3
Copy link
Author

gws3 commented Oct 27, 2021

Been messing with it for a couple hours, it's such a workaround to what could be a simple thing. But it has given me a couple ideas. The button is a button, so being able to add OnClick events shouldn't be a reach, but absent that, even the ability to have each Menu command send a message might be the angle. Using "Call" is sidestepping what I'd like to do, the labels are somewhat there, but a message might be the simple, less-labor-intensive process while building a story. Thanks.

@TheEmbracedOne
Copy link

TheEmbracedOne commented Jun 27, 2022

Might be worth looking into the Menu and MenuDialog scripts;
MenuDialog adds an onclick event on buttons when it enables the buttons when it receives a call from Menu commands, you could probably extend that call to pass another action or some parametres that gets added to the onclick event. Open the MenuDialog script and search for "onclick", you'll find it easily!

(oops I didnt realise this is a rather old thread! hopefully you've found a solution to this since, and if so, would love to hear it!)

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

4 participants