Changing object.alias, to display in the inventory, differently based on factors.

Hi,

I want to know if it is possible to change the listed name of an object's alias, when you see it in your inventory, on the side of the screen. In my game I can reinforce an item and can enchant an item. I have a way of displaying the information to the player OTHER than the inventory, to correctly show the reinforcement/enchantment level of that item. ie a Print Expression: "You are wielding a Reforged Steel Longsword + 2.

So I want to be able to do the same for the inventory screen on the side of the gameplay window as well. How would I go about doing that if possible, so that that same item example above would stop being listed as just Longsword as its alias, and instead list it as Reforged Steel Longsword +2 as its alias.

Is this possible or no?


Should be...
in the UI,
in code view: on the sword object, on the object tab, that is where you would name the object for how it will be displayed.

<object name="sword">
      <inherit name="editor_object" />
      <take />
      <alias>long sword</alias>
      <look><![CDATA[48 inches long...<br/>]]></look>
      <listalias>reforged steel longsword +2</listalias>
    </object>

It is a longsword in the room, but a "Reforged Steel Longsword + 2" in your inventory and room object list
AND...
Well... I thought there was a way to rename the sword using the listalias entry... But it does nor work for me.


you use concatenation with these type of Functions:

GetDisplayXXX (xxx)

GetDisplayName (NAME_OF_OBJECT) ( http://docs.textadventures.co.uk/quest/functions/corelibrary/getdisplayname.html )
GetDisplayAlias (NAME_OF_OBJECT) ( http://docs.textadventures.co.uk/quest/functions/corelibrary/getdisplayalias.html )
http://docs.textadventures.co.uk/quest/functions/corelibrary/getdisplaynamelink.html
http://docs.textadventures.co.uk/quest/functions/corelibrary/getlistdisplayalias.html
etc etc etc (many many more, look for anything with 'display' in it)


for quick simple incomplete example:

(credit goes to Pixie and/or Chase, as I learned of this answer that I'm now posting to you, from them/their-libraries, lol)

<object name="sword_object">
  <attr name="alias" type="string">sword</attr>
  <attr name="equip" type="script">
    this.default_alias = this.alias // storing/saving it's default alias, which is 'sword', so we can return it's alias to 'sword' upon unequiping it
    this.alias = GetDisplayAlias + " (equipped)" // (using concatenation) // displayment in the right pane during game play: sword (equipped)
    this.parent = player
  </attr>
  <attr name="unequip" type="script">
    this.alias = this.default_alias  // displayment in the right pane during game play: sword
    this.parent = null
  </attr>
</object>

concatenation (sample example of what you want):

<object name="sword_object">
  <attr name="alias" type="string">sword</attr>
  <attr name="enchant_integer_attribute" type="int">0</attr>
  <attr name="enchant" type="script">
    this.enchant_integer_attribute = this.enchant_integer_attribute + 2 // the actual stat change
    // GetDisplayAlias (this) = "sword"
    this.alias = "reforged " + GetDisplayAlias (this) + " +2" // (just the) displayment: reforged sword +2    
  </attr>
</object>

Basically it is the "listalias" attribute you want to set.


Pixie, can the "listalias" be set to a variable?
I figured it out for exit room names, but it did not work for listalias...
I think what OP wants is something more like:
{sword description} longsword {bonus}
so that he can get:
longsword
Sharp longsword +1
reforged longsword +2
enchanted longsword +3
and could add the same for other weapons...


Sure, like this:

longsword.listalias = longsword.descriptor + " longsword +" + longsword.bonus

Too easy... there has to be a harder way!!!
(LOL!)


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

Support

Forums