For sake of example let's say there's a ghost in the basement and the
player's lantern goes on and off randomly because of it. That would be
annoying in a real game, but a decent example.
Every turn:
[Do one of the following randomly:]
Now the lamp is lit;
Now the lamp is not lit;
Say "The lamp is pushed by an unseen force but the flame is
not affected.";
Now, it seems like the code to perform that shouldn't be just one line
at the top like that, but I think it's the gist of what I'm asking
here.
How about this?
Every turn when the player is in the basement (this is the ghost lamp rule):
if a random chance of 1 in 2 succeeds:
if the lamp is lit:
now the lamp is not lit;
say "The ghost turns off your lamp!";
otherwise:
now the lamp is lit;
say "The ghost turns on your lamp!"
otherwise:
say "The lamp is pushed by an unseen force but the flame is not affected."
Regards,
Victor
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAkrN5/kACgkQoiOrMwvIZLxIfQCfUDQnfKaEbjak+/n4VP4/NIUG
e9MAniB0vIdbhP7HgMX+7zvnNMiEyIry
=z4Wx
-----END PGP SIGNATURE-----
For more than two alternatives, you'd do:
if a random number from 1 to 3 is:
-- 1: [...]
-- 2: [...]
-- 3: [...]
--Z
--
"And Aholibamah bare Jeush, and Jaalam, and Korah: these were the borogoves..."
*
Thanks for the help guys. Both are similar to what I was using,
Andrew's being closer but slightly more pleasant-looking than mine.
Guess I wasn't working around anything after all if an official
version doesn't exist, heh.
Really screwed up way to do it:
(Not tested, it probably won't work, and even if it does, somebody will
post in a day or two why it's a really terrible idea)
To say rand thing a: now the lamp is lit.
To say rand thing b: now the lamp is not lit.
To say rand thing c: Say "The lamp is pushed by an unseen force but the flame is
> not affected.".
Every turn:
say "[one of][rand thing a][or][rand thing b][or][rand thing c]
[purely at random]".
------
Do all the [one of] / [or] / [purely at random] have to be in the same string?
If not, it might be possible to do it with a single:
Every turn:
say "[one of]";
now the lamp is lit;
say "[or]";
now the lamp is not lit;
say "[or]The lamp is pushed by an unseen force but the flame is
not affected.[purely at random]".
Okay, that's got to violate something.
They do all have to be in the same string, so this won't work.
vw