Make the alias of an exit the player's name

Jamie Furlong
26 Aug 2018, 07:01

How do I set the alias of an exit to player.alias? Actually, in my example, I've created something called 'player.boat', so in the Attributes section of the exit I've set alias assignment to Script, and then

msg (+ player.boat)

... but this doesn't work.

No doubt this is really simple. Any suggestions?


mrangel
26 Aug 2018, 08:28

Is the player's boat attribute a string?

If so, it's relatively simple. You need to give the exit a name so that you can refer to it in the code. By default, exits are named things like exit197, but you should give it its own name so that you can refer to it in code. I'm guessing that the exit is leading onto the player's boat, so you could give it a name like exit_onto_boat.

Then after whatever script sets player.boat to something meaningful, you would put:

exit_onto_boat.alias = player.boat

(or if the player can change the name of their boat in multiple places, you could put this script in the "before enter" script for the room that contains the exit. That way, the exit's alias will be changed right before it is displayed in the room description.


Jamie Furlong
26 Aug 2018, 09:16

Hi - no, it's not an exit to the boat. It's a question where the player's boat name could be one of the answers. By clicking it it takes them to the next room so it's just an exit. The exit's name is 'eus', so I was using the text processor {exit:eus} and then trying to change the alias of the exit under the attributes. The player's boat name is captured at the beginning of the game with

 get input {
  player.boat = result
  }

... and I use

+ player.boat

to reference the boat name throughout the story.

I'm assuming, therefore, that I have to change the alias of the exit in order for it to be the player's boat name as a link to the exit.


mrangel
26 Aug 2018, 13:36

You could modify that input:

get input {
  player.boat = result
  eus.alias = result
}

Or you could put eus.alias = player.boat in a script that will run before the {exit:eus} is displayed (like the room's before enter script for that question).


jmnevil54
29 Aug 2018, 03:29

exit.alias = player.alias
Or....
this.alias = player.alias

insertyourroomnamehere.alias = player.alias

room.alias = player.alias


hegemonkhan
29 Aug 2018, 04:27

there's also the 'GetDisplayname' and 'GetDisplayAlias' Functions too:

http://docs.textadventures.co.uk/quest/functions/corelibrary/getdisplayalias.html
http://docs.textadventures.co.uk/quest/functions/corelibrary/getdisplayname.html

(using an example from old Chase's 'wearables' library --- part of Chase's 'wearables' library was used by Pixie for the current 'equipment/wearables' system in quest version)

// create ("unarmed")
// unarmed.alias = unarmed.name

// create ("katana")
// katana.alias = katana.name

// 'equip' Verb:

player.weapon = this
player.weapon.alias_old = player.weapon.alias
player.weapon.alias = GetDisplayAlias (player.weapon) + " (equipped)"

// 'unequip' Verb:

player.weapon.alias = player.weapon.alias_old
player.weapon = unarmed
player.weapon.alias = GetDisplayAlias (player.weapon) + " (equipped)"


Jamie Furlong
30 Aug 2018, 07:35

Thanks for the replies. mrangel's solution was the easiest to implement so I went with that. Cheers.