fungus icon indicating copy to clipboard operation
fungus copied to clipboard

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

Open gws3 opened this issue 2 years ago • 7 comments

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.

gws3 avatar Oct 25 '21 14:10 gws3

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

Arylos07 avatar Oct 26 '21 21:10 Arylos07

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

gws3 avatar Oct 26 '21 22:10 gws3

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

breadnone avatar Oct 27 '21 10:10 breadnone

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

gws3 avatar Oct 27 '21 10:10 gws3

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

breadnone avatar Oct 27 '21 10:10 breadnone

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.

gws3 avatar Oct 27 '21 13:10 gws3

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!)

TheEmbracedOne avatar Jun 27 '22 19:06 TheEmbracedOne