Picking One Object out of a Randomized List

Sorry I had to jump back into the forums so quickly once more.
Just a quick one, I am currently creating a text adventure that once you enter a room you will find a random object selected out of a list. By this I mean something along the lines of:
Player enters room. Player looks around and finds only one (out of a random list) Object 1, Object 2 or Object 3.

I'm probably mentally wasted right now and there's probably a simple solution that I just could not wrap my head around :l
Anything helps, thank you!


You'll probably do well using a function such as ="PickOneObj(list)" (though might be PickOneObject now, just remember you might want the alias rather than the actual object name


If you already have an objectlist to choose from, PickOneObject is the simplest option. If you don't, it probably makes the code simpler to use object names. Something like:

objectname = PickOneString (Split ("bell;book;candle;spoon"))
MoveObjectHere (GetObject (objectname))

If the objects are stored elsewhere, you can just move the selected one to the room. If they're in the room but invisible, just change the code to make the object visible instead.

Hope that makes sense.


Log in to post a reply.

Support

Forums