Can someone help me using (seed:)

Twine Version: 2.10.0
Harlowe: 3.3.9

I am trying to learn how to use the (seed:) macro but am having troubles putting it into practice and would like someone who knows more could provide some examples of putting it into use and syntax.

The Harlowe manual says " * Seed it based on a player name (inputted via (input-box:) or (prompt:)) to assign a unique challenge to each player that can" — The text does just cut off there, btw

  1. How would actually use a prompt to set a seed? I understand how to use the (prompt:) and (input:) macros, but I’m not sure how to format these with the (seed:) macro.

  2. How would I ‘call’ forth the seed from the beginning? Like, put it into action… if that makes sense.


Additionally, the example usage is (seed:"aeiouy")(random:1,10) (random:1,10) (random:1,10)

  1. How would one actually use these random numbers? is it not better to have something tied to them, such that a variable could call to them and be changed in the actual course of playing the game?

I guess this is mainly where I’m asking for example usages. If someone has something downloadable such as the way the manual has some examples, I would be happy to poke around and learn that way, but any written explanations will also be greatly appreciated!

  1. [editted, removed question because it was so obvious that as soon as I hit post I couldn’t believe what I was asking lol]

  1. If I wanted to set specific values to a seed, would that be possible?

Such as, if I wanted to set the player stats based on the seed from the beginning.

I attempted a few variations of the following, using brackets and without, but it didn’t seem to work, as long as I had a second (seed:) in the passage, it default to the last (set:). (seed: "seed1")(set: $steelyStats to (dm: "name", "Steely", "HP", 80, "poison", 0, "heartbreak", true, "exes", 0)

I also tried to do something like (seed: "seed123")(set: $steelyStats to (dm: "name", "Steely", "HP", (random:10, 100), "poison", 0, "heartbreak", (either: true,false), "exes", (random:1,5))) but if I wanted the (random:) and (either:) to be what’s changed based on the seed, how would I set up the macro for that?

The “random numbers” in most computer applications aren’t true random numbers like rolling a die or flipping a coin: they’re “pseudorandom numbers” – a stream of hard-to-predict values generated from a seed.

So if you set the seed to a particular value, a sequence of (random:) calls following that will always give the same sequence of values.

Usually you just set the seed once for a particular game.

So if I do:

(seed: "Josh")
(random: 1,10)
(random: 1,10)
(random: 1,10)
(random: 1,10)
(random: 1,10)

Then I’ll always get 9, 2, 8, 3, 7 (with my current version of Harlowe). If I change the seed to “Fred” I get 6, 8, 10, 6, 4.

So you could set it from a prompt with something like:

(seed: (prompt: [Your name, please?], "Josh"))

And then any random values after that would be different for different player names.

And yeah, to use the random numbers you’d need to save them in a variable: (set $npcAge to (random: 15, 45)) or whatever. I assume the example documentation is just printing them so you can see the values, instead of doing anything useful with them.

Harlowe internally uses a Pseudorandom Number Generator to determined the “random” outcome of all its “random” related macros and features. Such a generator requires a “seed”, which is used to control the starting point of the random numbers the generator produces.

By default Harlowe automatically determines the “seed” its generator will use during the story format’s runtime engine’s start-up process when the Story HTML file is opened.

The (seed:) macro can be used to replace the above mentioned “seed” with one of the Author’s choosing.

Normally this (seed:) macro would be called within a project’s startup tagged Passage, so the seeding occurs before the 1st Passage is shown to the end-user, but it can be used later in situations like getting the end-user to supply the “seed” value.

An example of using the (prompt:) macro to obtain such a “seed” in your project’s 1st visited Passage might look something like…

(set: _seed to (prompt: [Please supply between 6 and 10 "random" letters of characters], 'wed890ds', 'Done', 'Cancel'))
(seed: _seed)

note: Any “random” features used later in the project will automatically use the above new “seed”.