Howdy, Stranger!

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

How I can make to integrate a random event into a history ?

edited April 2016 in Help! with 2.0
Hello everybody! I would like to add a random event to my story but all the formulae which I found do not work. Then I question you: how can it be done?
My event includes 2 possibility : if you are lucky, you go to the good way
if you aren't lucky, you fall and die
Please, help me :/

PS : I'm french and my english is sad. I'm sorry if you see a lots of fault :/ but you can ask me :)

Comments

  • If you're using Harlowe then you can use the (random:) macro! If you set a variable (let's call it $randomvar) to (random: 1,2) then you can say
    (if: $randomvar is 1)[You go the correct way!](else: )[You die!]
    
  • edited April 2016
    I've test this macro but it isn't work. I have write
    (if: $randomvar is 1)[Chance](else: )[Pas de chance]
    
    but the link between this passage and the following one (according to the variable) is not made.
    Fortunately I think of having found another solution : the thrown of dice :) but if you've got another solution, I'll take it ^^
  • Your example does not include any links, not does it direct the web-browser to show a different passage.

    Try something like the following if you want to show links:
    (set: $randomvar to (random: 1, 2))
    
    (if: $randomvar is 1)[ [[Chance]]](else:)[ [[Pas de chance]]]
    

    Try something like the following if you want to automatically send the Reader to another passage:
    (set: $randomvar to (random: 1, 2))
    
    (if: $randomvar is 1)[(go-to: "Chance")](else:)[(go-to: "Pas de chance")]
    

  • Thanks a lot ! It's work :D
  • edited April 2016
    Salut, compatriote !
    If you want links driven by random, you can test that chunk of code :
    (if: (either: 0, 1) is 0)[Une ombre grise apparaît. Le Petit Chaperon Rouge [[jette un coup d'œil furtif|Madame Loup]] ]
    (else:)[Soudain, un chasseur sort du bois. Le Petit Chaperon Rouge hurle <i> [[Au secours !!! À l'aide !!!|chasseur]] </i>]
    

    You can see the "in progress" story here.
Sign In or Register to comment.