Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Execute/run functions after a press on the same page?

edited July 2015 in Help! with 2.0
If I modify some variables on one page with a <<click>> and then want to run yet another function on the same page, is it even possible?

Like for example: I want to make rng roll for a player (after he clicks the button) then, based on the result, print some text and present a couple of options he can choose from to proceed on the same page.

EDIT: Ok, after thinking a bit, I get it its a bad example, mainly cause its easily done with click and replace. So another one:

I have 7 buttons, any one of them removes all buttons and outputs some text and modifies one variable. I can do it with replace as well.
But then, I need to use the aforementioned variable to create another button which would have 7 variants depending on which button was pressed at the beginning. I can still do it with replace, but its gonna be a nightmare maze of <<replace>> and <<if>> marcos, so I was just wondering if there is a macro/script or whatever that launches(triggers) on the same page after a variable gets modified.

Sorry if am just saying a ton of non-sense am a total noob to twine and programming..

Comments

  • Just put the secondary group of seven buttons/links in a different passage and use <<display>> with <<replace>>. For example:
    <<replace "#whatever">><<display "Some Choice Group 2">><</replace>>
    
  • not quite what I am asking. I its essentially the same as using replace macro. Now what if I need to add another set of buttons after the second set? and then more chain buttons like that? I would just flood my project with choice passages just to make one page work. That essentially nullifies the idea of using buttons, might as well use passages instead.
  • You never specified that you were planning on doing that ad nauseam. I assumed that you would be doing it a limited number of times.

    If you're attempting to, essentially, recreate Jonah within SugarCube (i.e. make everything happen on one screen/page), then that is indeed a bad idea and you should simply use passages.
Sign In or Register to comment.