Howdy, Stranger!

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

(Harlowe)Random Events

Ok so I am fairly far along in my story using Harlowe. So I don't really want to start using another format if I can avoid it.

I want to create a random event. But do I have to have the random number generator in each passage or can I get away with keeping it in, say, startup passage and it is kept running?

If possible I don't want to clog my passages up with too much crud.

Comments

  • When you say a random event do you mean:
    a. The event is randomly chosen from a pool of possible events but it occurs at a fixed point in the story.
    b. The event is fixed but it can occur at a random point in the story.
    c. Some combination of points A and B.

    If A then all you need to do is assign a random value to a variable in your startup tagged passage and then later use (if:) / (elseif:) macros to show what happened:
    <!-- Place the following in your startup tagged passage. -->
    (set: $event to (random: 1, 6))
    
    <!-- Place the following in the passage where the event happens -->
    (if: $event is 1)[The text for event 1]
    (elseif: $event is 2)[The text for event 2]
    (elseif: $event is 3)[The text for event 3]
    (elseif: $event is 4)[The text for event 4]
    (elseif: $event is 5)[The text for event 5]
    (elseif: $event is 6)[The text for event 6]
    

    If B then you can use a header tagged passage to determine if it is time to show the event:
    (set: $percentage to (random: 1, 100))
    (if: $percentage >= 90)[The text for event]
    

    note: You can replace the "The text for event" parts in the above examples with whatever code you like.
  • It's a combination. I want a pool of possible events then at each passage where I want this random even to take place it triggers it.

    So the protagonist will have random thoughts, voices and images pop into his head as he travels around. But then so far through I want it to abruptly stop.
  • OK I have taken a look and think I have this working. I will try it when I get on my break.

    I didn't know these header and footer tags existed. Is there somewhere I can check this out as it seems some of the wiki stuff is outdated.
  • Generally there are two places to look, the Harlowe documentation and the Harlowe project overview, however currently there is also the Harlowe 1.2 beta thread.
Sign In or Register to comment.