Having an object function like scenery inside your inventory

J_J
21 Jan 2018, 07:38

If you had a book, but a scenery item called book's cover, which let's you look specifically at the cover... Is there a way to have both in your inventory but have the cover not visible. For instance if the book was functionally a shelf, so that it's cover goes where ever it goes, but without showing up as a separate item in your inventory?


hegemonkhan
21 Jan 2018, 14:11

let me know if the 'scenery' and/or 'visible' doesn't work within the inventory (inventory === the 'player' Player Object)

<object name="room">

  <inherit name="editor_room" />

</object>

<object name="player">

  <inherit name="editor_object" />
  <inherit name="editor_player" />

  <attr name="parent" type="object">room</attr>

</object>

<object name="book">

  <inherit name="editor_object" />
  <inherit name="contained_closed" />

  <attr name="parent" type="object">room</attr>

  <attr name="changedparent" type="script">
    cover.parent = book.parent
  </attr>

</object>

<object name="cover">

  <inherit name="editor_object" />

  <attr name="scenery" type="boolean">true</attr>

  <!--
  or instead of the 'scenery' Boolean Attribute:
  <attr name="visible" type="boolean">false</attr>  
  -->

  <attr name="parent" type="object">room</attr>

</object>

K.V.
21 Jan 2018, 17:31

I've never been able to make something in the inventory (or even something in something that's in the inventory) 'invisible'.

(When you make something invisible in Quest, you are essentially removing it from play. I know what you mean by invisible in this post, though. Just for the record.)

One way to handle it is to create a turn script which makes sure the cover is always in the same room as the book. (Also, if the book is in inventory, the script puts the cover in the location of the player. This way, it is always there if the book is there, but never in the inventory.)

<!--Saved by Quest 5.7.6595.20017_KVMod-->
<asl version="550">
  <include ref="English.aslx" />
  <include ref="Core.aslx" />
  <game name="A Book with a Cover">
    <gameid>3176e0e2-bccf-41a6-9e59-f2dc233f6c07</gameid>
    <version>1.0</version>
    <firstpublished>2018</firstpublished>
    <feature_advancedscripts />
    <scopebackdrop type="script">
    </scopebackdrop>
    <author>KV</author>
    <subtitle>(An Example Game)</subtitle>
  </game>
  <object name="room">
    <inherit name="editor_room" />
    <object name="player">
      <inherit name="editor_object" />
      <inherit name="editor_player" />
    </object>
    <object name="book">
      <inherit name="editor_object" />
      <inherit name="openable" />
      <take />
      <feature_container />
      <read>{either book.isopen:You read a few pages, but the book sucks, so you stop.|It isn't open.}</read>
      <look><![CDATA[It's <b>The Importance of Being K.V.</b>.]]></look>
      <inventoryverbs type="stringlist">
        <value>Look at</value>
        <value>Drop</value>
        <value>Open</value>
        <value>Close</value>
      </inventoryverbs>
    </object>
    <object name="cover">
      <inherit name="editor_object" />
      <scenery />
      <look>{either not book.isopen:It's made of leather.|The inside of the cover has no markings whatsoever.}</look>
      <alt type="stringlist">
        <value>book cover</value>
      </alt>
    </object>
    <exit alias="north" to="another room">
      <inherit name="northdirection" />
    </exit>
  </object>
  <object name="another room">
    <inherit name="editor_room" />
    <exit alias="south" to="room">
      <inherit name="southdirection" />
    </exit>
  </object>
  <turnscript name="cover_turnscript">
    <enabled />
    <script>
      if (book.parent = game.pov) {
        cover.parent = book.parent.parent
      }
      else {
        cover.parent = book.parent
      }
    </script>
  </turnscript>
</asl>

K.V.
21 Jan 2018, 19:37

Here's a totally different approach.

This time, I made the book a closed container, set it to transparent, and put the cover inside of the book. (The cover is scenery.)

Then, I modified the ScopeInventory() function to exclude an object with the attribute scenerywhenheld set to true.

<!--Saved by Quest 5.7.6595.21257_KVMod-->
<asl version="550">
  <include ref="English.aslx" />
  <include ref="Core.aslx" />
  <game name="A Book with a Cover">
    <gameid>3176e0e2-bccf-41a6-9e59-f2dc233f6c07</gameid>
    <version>2.0</version>
    <firstpublished>2018</firstpublished>
    <feature_advancedscripts />
    <author>KV</author>
    <subtitle>(An Example Game)</subtitle>
    <scopebackdrop type="script">
    </scopebackdrop>
  </game>
  <object name="room">
    <inherit name="editor_room" />
    <object name="player">
      <inherit name="editor_object" />
      <inherit name="editor_player" />
    </object>
    <object name="book">
      <inherit name="editor_object" />
      <inherit name="container_closed" />
      <take />
      <feature_container />
      <read>{either book.isopen:You read a few pages, but the book sucks, so you stop.|It isn't open.}</read>
      <look><![CDATA[It's <b>The Importance of Being K.V.</b>.]]></look>
      <inventoryverbs type="stringlist">
        <value>Look at</value>
        <value>Drop</value>
        <value>Open</value>
        <value>Close</value>
      </inventoryverbs>
      <transparent />
      <object name="cover">
        <inherit name="editor_object" />
        <scenery />
        <look>{either not book.isopen:It's made of leather.|The inside of the cover has no markings whatsoever.}</look>
        <alt type="stringlist">
          <value>book cover</value>
        </alt>
        <scenerywhenheld />
      </object>
    </object>
    <exit alias="north" to="another room">
      <inherit name="northdirection" />
    </exit>
  </object>
  <object name="another room">
    <inherit name="editor_room" />
    <exit alias="south" to="room">
      <inherit name="southdirection" />
    </exit>
  </object>
  <function name="ScopeInventory" type="objectlist">
    result = NewObjectList()
    exclude = FilterByAttribute(GetAllChildObjects(game.pov),"scenerywhenheld",true)
    foreach (obj, ListExclude(GetAllChildObjects(game.pov),exclude)) {
      if (ContainsVisible(game.pov, obj)) {
        list add (result, obj)
      }
    }
    return (result)
  </function>
</asl>

Curt A. P.
22 Jan 2018, 18:41

Hi,
I'm a beginner at programming, but maby it's a help.
If you use the standard inventory, I would place a menu at the book's "look at" verb.

>look at book

This is the book's description.

Look at the book's cover?

  1. Yes
  2. No

Or a different menu. Something like:

>look at book

This is the book's description.

  1. Look at the book's cover.
  2. Read the book
  3. Look at the Book's back.

Sorry, isn't what you asked for but maby it helps.


hegemonkhan
22 Jan 2018, 19:05

ya, probably better to just not use a second Object for a 'book' Object's cover (easier ways to get/do the same effect, such as Curt already pointed out, just using the 'look' Verb/Script_attribute for the cover's description), but maybe the OP'er has a reason for doing so... meh.

I'm not that familiar with all of quest's built-in stuff, so didn't know and don't know how to get around the inventory problem with 'hiding/invisibilty/scenery' of displayment of Objects, as seen in my above post.


when I started playing around with quest for my first time... I wanted a 'bed' Object (that you could sleep on) and also an 'under the bed' Object (for being a container: "hiding/putting/finding/storing stuff under the bed")... but I didn't know of other ways (and don't currently, though I think I could maybe come up with how to do so and with probably needing some research into quest's built-in stuff, lol) that this effect could be done back then, hence using two Objects.


K.V.
22 Jan 2018, 19:50

Yes, but you can just look at the book, look at the cover, or read the book my way.

(This is a text adventure and not a gamebook; correct?)


I'm not that familiar with all of quest's built-in stuff, so didn't know and don't know how to get around the inventory problem with 'hiding/invisibilty/scenery' of displayment of Objects

didn't know and don't know how

Did you not try this?

This totally does it.

You simply set a Boolean attribute named "scenerywhenheld" on your object to true, and put this for ScopeInventory():

  <function name="ScopeInventory" type="objectlist">
    result = NewObjectList()
    exclude = FilterByAttribute(GetAllChildObjects(game.pov),"scenerywhenheld",true)
    foreach (obj, ListExclude(GetAllChildObjects(game.pov),exclude)) {
      if (ContainsVisible(game.pov, obj)) {
        list add (result, obj)
      }
    }
    return (result)
  </function>

a 'bed' Object (that you could sleep on) and also an 'under the bed' Object (for being a container: "hiding/putting/finding/storing stuff under the bed")

Hey!

I just did that in a game!

I thought adding this take script was a good idea, too:

if (StartsWith(LCase(player.currentcommand),"get")) {
  msg ("You can't fit under it.")
}
else {
  msg ("How in the world could you do that?")
}

Curt A. P.
22 Jan 2018, 20:11

Yes, I gave up on the build in inventory since I found out how hard it is to make item stacks with it. For now my player's inventory need only...
...a backpack (containing loot and more)
...a journal (collecting everything with a wiki-like menu, npcs, story, places, quests, achievements, stats and skills)
...and a weapon.
My goal is to keep the inventory poorly filled and don't stack my stuff as statusattribute. Still working on it.

Edit: My first game and room had a bed, too, but I just hid a dagger under the scenery pillow and a storage box under the bed. lol


hegemonkhan
23 Jan 2018, 02:28

you can stack with 'statusattributes', you just need to use String Attributes for them, here's an example (not of stacking, but you can use it to do stacking):

<object name="player">

  <attr name="life" type="string">999/999</attr>

  <attr name="maximum_life" type="int">999</attr>

  <attr name="current_life" type="int">999</attr>

  <attr name="changedcurrent_life" type="script">
    this.life = this.current_life + "/" + this.maximum_life
  </attr>

  <attr name="changedmaximum_life" type="script">
    this.life = this.current_life + "/" + this.maximum_life
  </attr>

  <statusattributes type="stringdictionary">

    <item>
      <key>life</key>
      <value>Life: !</value>
    </item>

  </statusattributes>

</object>

// initial output/displayment in the status pane during game play:

Life: 999/999

as current and/or maximum life changes, it'll be updated/displayed correctly, for example if you lose 500 life:

Life: 499/999


you should be able to apply this for stacking too, but if need help let me know


hegemonkhan
23 Jan 2018, 02:49

oh... my bad... didn't read your post closely... you do NOT want to have a long 'statusattributes' displayment (aka, many items being displayed)....

well, you can always create your own 'storage' system, and 'info menus' system

won't get into a storage system here...

but for a 'info menu' system, here's some methods:

<object name="player">
</object>

<object name="info_button">

  <attr name="parent" type="object">player</attr>

  <attr name="alias" type="string">info</attr>

  <attr name="stats" type="script">
    // blah scripting (see the 'stats_command' Command's scripting)
  </attr>

  <attr name="gear" type="script">
    // blah scripting
  </attr>

  <attr name="spells" type="script">
    // blah scripting
  </attr>

  <attr name="items" type="script">
    // blah scripting
  </attr>

</object>

<object name="actions_button">

  <attr name="parent" type="object">player</attr>

  <attr name="alias" type="string">actions</attr>

  <attr name="talk" type="script">
    // blah scripting
  </attr>

  <attr name="search" type="script">
    // blah scripting
  </attr>

  <attr name="fight" type="script">
    // blah scripting
  </attr>

  <attr name="magic" type="script">
    // blah scripting
  </attr>

  <attr name="equip" type="script">
    // blah scripting
  </attr>

</object>

<verb>
  <property>talk</property>
  <pattern>talk</pattern>
  <defaultexpression>You can't talk right now!</defaultexpression>
</verb>

<verb>
  <property>search</property>
  <pattern>search</pattern>
  <defaultexpression>You can't search that!</defaultexpression>
</verb>

<verb>
  <property>fight</property>
  <pattern>fight</pattern>
  <defaultexpression>You can't fight that!</defaultexpression>
</verb>

<verb>
  <property>magic</property>
  <pattern>magic</pattern>
  <defaultexpression>You can't use magic right now!</defaultexpression>
</verb>

<verb>
  <property>item</property>
  <pattern>item</pattern>
  <defaultexpression>You can't use items right now!</defaultexpression>
</verb>

<verb>
  <property>equip</property>
  <pattern>equip</pattern>
  <defaultexpression>You can't equip that!</defaultexpression>
</verb>

<verb>
  <property>stats</property>
  <pattern>stats</pattern>
  <defaultexpression>You can't view your stats right now!</defaultexpression>
</verb>

<verb>
  <property>gear</property>
  <pattern>gear</pattern>
  <defaultexpression>You can't view your gear right now!</defaultexpression>
</verb>

<verb>
  <property>spells</property>
  <pattern>spells</pattern>
  <defaultexpression>You can't view your spells right now!</defaultexpression>
</verb>

<verb>
  <property>items</property>
  <pattern>items</pattern>
  <defaultexpression>You can't view your items right now!</defaultexpression>
</verb>

<command name="stats_command">

  <pattern>stats</pattern>

  <script>
    ClearScreen
    msg ("Character Screen")
    msg ("")
    msg ("Level: " + player.level)
    msg ("Experience: " + player.experience)
    msg ("Currency: " + player.currency)
    msg ("Strength: " + player.strength)
    // etc character stats
    wait {
      ClearScreen
    }
  </script>

</command>

J_J
27 Jan 2018, 03:33

I realized I asked this days ago...but I've finally been able to try it out. Thank you for all the suggestions you guys. I ended up just having the object transport room to room. Is working awesome, but it is really helpful to see all the different ideas for this!

I'm a bit curious about the suggestion of using a menu. I'm not using any menus for my game. Is that the standard now in Parcer fiction? My game is more old school, and give you verb hints in the descriptions when you look at objects. I really like this style of game... but is it going to turn off players?


K.V.
27 Jan 2018, 04:06

My game is more old school, and give you verb hints in the descriptions when you look at objects. I really like this style of game...

Same here, but I think we are the minority.