Hello,
I'm new and I'm not a programmer, so sorry if my request is stupid!
I need a macro that allow dice rolls. I've searched around internet and also in this forum but I didn't find anything.
I need something like:
A monster want to kill you.
[[I try to run away]]
MACRO (in case he tries to runaway) If the player rolls 6, 5 or 4 (using 1d6) so go to this paragraph, if he rolls 1, 2 or 3 go to to this other paragraph.
Comments
Anyway. For your stated use case, you could simply use the
either()
function, which randomly returns one of the arguments it's passed. For example: Alternatively, you could use therandom()
function. For example:Thank you very much! I'm running version 1.4.2 sorry!
The function either seems good, is there a way to apply some modifier to the random result? Just to add more probability to one result to
Anyway thank you, you have definitely helped me a lot
That's the Twine version, not the story format. If you've changed nothing, then the story format you should be using is Sugarcane.
Using
either()
, the way would be to add more entries to the list it's picking from. For example: As long as you don't have too many entries, it's not a bad way to handle it.Alternatively, using
random()
might be a tad nicer when you would need lots of entries. For example:Thanks for your answer. I have tried it and it works perfectly.
Last question when i test play I see the sentence: [[I try to run away|either("Place A", "Place B")]] highlighted in red.
Do you know how can I change this in my stylesheet passage?
Ok it was my fault :P
Thank you, everything runs perfectly!
We should create a topic with all the functions available in Twine and how to use it. I think it would be very useful for other noob like me!
Well, for story formats in general there's the Twine wiki. Additionally, SugarCube has its own documentation, as there are parts which differ from the vanilla story formats.