Multiple dialogue pieces appearing

I want to do something where when the player clicks "talk to" to a specific character then each time it's clicked it can scroll through a series of three phrase. So like the first time you click "talk to" it says something, the second time you click it, it says something else, the third time you click it says another thing, and when you click it for the fourth time it goes back to the first piece of dialogue. I want to know how I can make it change the dialogue with each click.

I'd make the "talk to" verb a script something like this:

firsttime {
  this.times_talked_to = 0
this.times_talked_to = this.times_talked_to + 1

switch (this.times_talked_to % 3) {
  case (1) {
    msg ("Here's the first thing")
  case (2) {
    msg ("Here's the second thing")
  case (0) {
    msg ("And the third")

The first just counts how many times you've talked to this guy. The times_talked_to attribute increases by 1 every time.
Then we select a statement based on this.times_talked_to % 3 - the remainder when the number of times you've talked to him is divided by 3. This number will go 1, 2, 0, 1, 2, 0, 1, 2, 0… and so on forever.

This topic is now closed. Topics are closed after 60 days of inactivity.