Renaming the 'Give' Command?

nellanutella
27 Jul 2016, 16:21

Is there a way to rename the 'give' command? The way the 'Ask about' command functions doesn't work for the gameplay i'm looking for, so I thought that using 'give' instead of 'ask' and making topics of conversation objects that could be collected in the inventory would be ideal.

I'm very new to this, so I'm not totally sure if this is possible. Any help would be much appreciated. Thanks in advance!


XanMag
27 Jul 2016, 18:58

I'm not sure I entirely understand your goal. You want the player to type 'give sword to fred' and that start a conversation or illicit a response with Fred?

If so, you can run any script you want when you try to give objects to any NPC. Clarify for me and I'd be glad to help further.


nellanutella
28 Jul 2016, 00:19

What I wanted to do was to make the results of talking to someone change based on what the player has already done or discovered. I'm making a mystery game, so I wanted to make sure characters couldn't get tests done on evidence they haven't collected or ask about the death of characters that haven't died yet.

My plan was to make a lot of objects, and when the player 'gives' an item to a character, they would respond with a conversation. So if i make an object named 'Footprints' and 'Give footprints to Officer Jack' He would tell the player about the footprints. The reason I want to rename 'give' is so the player will be able to review what they know so they don't forget to ask about any pieces of evidence they find, and also so talking about concepts instead of objects makes more sense, for instance 'Give motive to David' versus 'Ask David about motive'


hegemonkhan
28 Jul 2016, 05:22

There's many ways of doing dialogue/conversion, from very simple design to very advanced design. I'd recommend taking a look at the libraries by Pixie and Jay, and see if you like any of them and/or just study them, to examine how conversation/dialogue can be done, from simple design to advacned design, to get an idea of what you want for your game. Jay has a really advanced dialogue / conversion game, along with his game/source code publically available, called 'Spondre' (its name is a re-arranging of the letters in 'respond'), that you can play and/or study. It's a really awesome/interesting game, btw. Pixie also has some really good libraries and/or games on conversation/dialogue that you want to look at as well.

Dialogue/Conversion is not easy to implement, as it is very complex with lots of topics and in trying to handle them, unless you keep it extremely simple. If you're not a good coder, it can get very messy, if you try to do advanced conversion/dialogue, as you need to be able to use List/Dictionary Attributes, and, Functions+Parameters or Objects+Delegates, to handle and work with, the topics, adding/removing them, based upon what's already been asked about or not asked about and etc, to keep the code from being a horrible mess.

However, I'm too lazy to dig through my posts for some examples of how to do simple (but bad/poor/inefficient) designs using String/Integer Attributes as indicators/flags for determining the responses.

the basic idea is this (using Integer Attributes for this example):

<object name="room">
</object>

<object name="player">
  <attr name="gold" type="int">0</attr>
   <attr name="parent" type="object">room</attr>
</object>

<object name="npc1">
  <attr name="dialogue" type="int">0</attr>
  <attr name="alias" type="string">john</attr>
  <attr name="parent" type="object">room</attr>
  <attr name="dialogue" type="script">
    // (see below)
  </attr>
  <attr name="displayverbs"type="simplestringlist">dialogue</attr>
</object>

<object name="npc2">
  <attr name="dialogue" type="int">0</attr>
  <attr name="alias" type="string">jeff</attr>
  <attr name="parent" type="object">room</attr>
  <attr name="dialogue" type="script">
    // (see below)
  </attr>
  <attr name="displayverbs"type="simplestringlist">dialogue</attr>
</object>

<command name="dialogue_command">
  <pattern>dialogue #object#</pattern>
  <script>
    // excluding a few changes needed, see below 
  </script>
</command>

<verb>
  <property>dialogue</property>
  <pattern>dialogue</property>
  <defaultexpression>You can't have a dialogue with that!</defaultexpression>
</verb>

'npc1' Object's 'dialogue' Verb/Command:

if (npc1.dialogue = 0) {
  msg ("Hi, I'm " + npc1.alias + ". What's you name?")
  npc1.dialogue = 1
} else if (npc1.dialogue = 1) {
  if (npc2.dialogue = 0) {
    msg ("If you first go talk to npc1, and then come back, I've got a request for you to do.")
  } else if (npc2.dialogue = 1) {
    msg ("Ah, so you've talked to " + npc2.alias + ". Would you go ask for some water from " + npc2.gender + " for me?")
  } else if (npc2.dialogue = 2) {
    player.gold = player.gold + 100
    msg ("Thank you for the getting the water, here's your reward: 100 gold")
    npc1.dialogue = 2
  }
} else if (npc1.dialogue = 2) {
  // blah blah blah
}

'npc2' Object's 'dialogue' Verb/Command:

// etc etc etc .... hopefully you get the idea...

see, this is very messy/cumbersome... using Lists/Dictionaries and Functions+Parameters/Objects+Delegates will make this much more clean/concise and just better in code design, but you got to be a good coder to do/use this of stuff well.


The Pixie
28 Jul 2016, 07:11

Yes, you can do this, if you are using the off-line editor.

At the bottom left of the screen in a "Filter" button, click it and select "Show library elements". The list of stuff on the right will suddenly get much bigger. Select the GIVE command, and click the "copy" button, top right.

You can then rename it, edit the pattern and change the script as you like.

Have you thought about how you will handle DROP FOOTPRINTS or PUT FOOTPRINTS IN BAG?


nellanutella
28 Jul 2016, 21:42

Thanks for the leads hegemonkhan! I am not very much of a coder, but i'm trying to be, so studying other code is really helpful.

I assumed that the offline editor was the same as the online one! Thanks for telling me otherwise, it's a big help! Reviewing my problem again, I found out that the 'ask about' feature has an 'if' script for whether or not an object is in the inventory. That fixes my problems with 'give' but unfortunately i still have issues with the 'inv' command. Can you edit what the 'inv' command is called with the offline editor too?
As for dropping and bagging items, since there's no in-game reason to drop evidence, i'm making the evidence undroppable to keep the player from losing anything. Concepts (like motive or time of death) I'm going to have automatically added to the inventory using scripts so the player doesn't need to 'take' them. Oversized or normally unmovable things like a car or footprints are going to be marked as impossible to pick up (so nobody puts a truck in a bag), they'll get added as a topic of conversation instead. I'm debating whether or not to alert the player that they can ask about a new topic. I'm afraid it would be to obnoxious to be told so frequently, but at the same time without notifications topics might go unnoticed and new players might not figure out the main mechanic is speech rather than pure evidence collecting.


hegemonkhan
29 Jul 2016, 01:36

if you're interested in learning to code, I can with experience say that quest is an absolutely magnificient way to learn to code, as I myself found quest 4 years ago, having ZERO knowledge in programming, and now I'm taking programming classes in college for my major, and I've been shocked at how well quest has prepared me for them!

if you want to see my struggles as I quickly jumped into trying to learn to code 4 years ago when I first stumbled upon quest:

http://textadventures.co.uk/forum/quest/topic/3348/noobie-hks-help-me-thread

it's a good laugh, looking back on it.


XanMag
29 Jul 2016, 02:40

Just a related aside, you could fairly easily incorporate a notebook in the player inventory that could be read. Then they could read the notebook to
Remember their clues. Just a thought.