Incapacitated player

Post a reply


This question is a means of preventing automated form submissions by spambots.
Smilies
:smile: :sad: :eek: :shock: :cool: :-x :razz: :oops: :evil: :twisted: :wink: :idea: :arrow: :neutral: :mrgreen:

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Incapacitated player

Re: Incapacitated player

by Roody_Yogurt » Thu Dec 12, 2019 1:22 pm

Nice going, pinback!

Using routines to return variables can be useful for other situations, too. For a long time, it bugged me that the Hugo standard library didn't support >LISTEN without an object, but trying to add support for room sounds was trickier than one would first imagine because messages would be called multiple times throughout the player/location before/after cycle. For a long while, Roodylib got around this by clearing the verbroutine global so messages wouldn't be called a second time. Eventually, this bugged me, though, since ideally, the game should always know what the last turn was.

Somewhat recently, I decided to go a routine based route:

Code: Select all

routine RoomSounds(obj)
{
	if verbroutine = &DoListen and not object
		return location
	else
		return false
}
where you would put something like this in the rooms which have sounds:

Code: Select all

	before
	{
		RoomSounds(location)
		{
			"No sounds but the wind."
		}
	}

Re: Incapacitated player

by pinback » Thu Dec 12, 2019 1:00 pm

So, a filter that all verbs are sent through that can react to a global variable. Nice going, Pinback!

Re: Incapacitated player

by Roody_Yogurt » Thu Dec 12, 2019 12:11 pm

Nikos has it right. You want AnyVerb. It catches all standard verbs but isn't called by xverbs (SAVE, RESTORE, etc.). You'd want something like this in the applicable room:

Code: Select all

before
{
    AnyVerb(location)
    {
        if player is chained
        {
            select verbroutine
            case &DoLookAround, &DoLook, &DoTalk : return false
            case else :  "You're chained, duh."
            return true
        }
        else
            return false
    }
}

Re: Incapacitated player

by Flack » Thu Dec 12, 2019 10:39 am

I don't know if this is possible, but I was thinking of something along the lines of checking the location and only allowing certain actions, instead of limiting every single verb. Dunno if that is possible or not, just brainstorming.

Code: Select all

if (in dungeon) {
  if (verb -eq look) {
  action
  } elseif {
  if (verb -eq talk) {
  action
  } else {
  "You are incompacitated, chum.
}
Terrible pseudo code, but mabye something along those lines?

Re: Incapacitated player

by RealNC » Thu Dec 12, 2019 10:37 am

Page 92 of The Hugo Book might help.

Re: Incapacitated player

by pinback » Thu Dec 12, 2019 6:51 am

Can all verbs be sent through a filter that can check the state of a global variable? I forget/never knew if that was possible.

Incapacitated player

by Ice Cream Jonsey » Wed Dec 11, 2019 10:05 pm

Question before I try to solve it on my own - let's say I want to chain the player up. While self is incapacitated, verbs like jump and push and take don't work. Some do, though, like look and talk.

Is the only real way to go verb by verb in a particular room and check the incapacitated property?

Top