Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

How to show item take/drop messages with auto-redescribe on?

A topic by celesti created Feb 26, 2020 Views: 128 Replies: 3
Viewing posts 1 to 4

Defining a "get_message" in the objects{} section doesn't work, auto-redescribe instantly clears it.

Submitted

I do my own auto redescribe for two reasons. Firstly, to avoid press any key. Secondly,  to do what you requested. Can you take a look at my game? If that suits you, I can post some code, but it is advanced stuff. You will have to do a lot of rework and I think it's getting too close to submission time for major rework. I can't post now because I'm on the train heading to work. It would have to wait until tonight.

Host (1 edit) (+1)

Setting auto describe mode on will automatically set the system : get and :drop commands be silent by default. 

To override that, add the following to your on_command {} section:

: match "get _"  {
   : get quiet = "false" ;
}
: match "drop _"  {
   : drop quiet = "false" ;
}
Submitted (1 edit) (+1)

Adventuron's solution prints the get and drop response, but it doesn't seem to refresh the screen - at least not in my game. If you want something a bit more polished, try this:

booleans {
   is_refresh : boolean "false";
}
on_command {
   : match "get -" {
      : print {(camel(original_verb()) + " what?")}
      : done;
   }
   : match "get *" {
      : if (is_beside (s1())) {
         : get quiet = "true";
         : set_string var = "message" text = "Taken.";
         : gosub "refresh";
      }
   }
   : match "drop -" {
      : print {(camel(original_verb()) + " what?")}
      : done;
   }
   : match "drop *" {
      : if (is_carried (s1()) && !is_worn (s1())) {
         : drop quiet = "true";
         : set_string var = "message" text = "Dropped.";
         : gosub "refresh";
      }
   }
}
on_describe {
   : if (is_refresh) {
      : set_false "is_refresh";
      : print {(message)};
   }
}
subroutines {
   refresh : subroutine {
      : set_true "is_refresh";
      : redescribe;
   }
}

The idea is that rather than printing a message, you put the message in a string and call a subroutine. The subroutine sets a flag and does a redescribe. You can't do anything after redescribe, so you test the flag in on_describe. If the flag is set, you clear it (for next time around) and print the string. Works like a charm.