RandomEventList : RandomFiringScript, EventList | [Previous] [Main] [Next]

A RandomEventList is an EventList that randomly selects one of its items each turn its doScript method is run. In practice, the ShuffledEventList, which inherits from RandomEventList, may be more useful, since it ensures that the same event will not be chosen twice in succession. The typical use of a RandomEventList might be in the atmosphereList of a Room or combined with a TopicEntry to provide a series of random conversational responses.
RandomEventList defines, (and hence ShufffledEventList inherits) three useful properties to control the frequency with which random messages are displayed (or random events occur). This is principally designed for use in a Room's atmosphereList (or perhaps an Actor's 'fidget list'), where once players have seen all the messages once or twice, they've got the general idea and may start to find them unduly repetitious.
You can set the eventPercent property (an integer between 0 and 100) to define the proportion of turns in which you want one of the events (normally just displaying a string) to occur (for example, setting eventPercent = 75 would cause a random event to be selected on average in three turns out of every four). By default, eventPercent is 100. Additionally, if you wish, you can have this percentage fall (or even rise!) to a new value, eventReduceTo after eventReduceAfter turns. If eventReduceAfter is nil (as it is by default) then the eventPercent never changes. This behaviour is in fact provided by RandomFiringScript.