How to make npc confront you with chioces?

All the resources I've found regarding this type of subject have been complete jargon to me. I've been able to work out most stuff, but this is my roadblock. I just want to be able to put a person in a room that will talk to you when you enter. I want to be able to respond in 2 or maybe 3 ways and have those result in something different. I don't need some elaborate tree of ifs ands or buts. I just want to be able to facilitate very very simple conversations.

I have more experience in RPG Maker. I downloaded Quest to try to simplify things, but its starting to look even harder. Its rather frusterating.


What you're looking to do isn't easy, or for beginners---that might be the reason your having trouble, especially if your experience with coding is limited. I might be able to guide you through it a little bit, but I don't know what variables you want for changing what the NPC says to the player, nor do I know what your experience with coding is. I'll do my best to explain it though or at least how I do things.

You have this option if you want the player to make a choice about how to respond to something.

msg("You approach Hurr-Durr and he speaks to you. What do you say in response?")
menulist = Split("Option 1;Option 2", ";")
ShowMenu ("Question Here.", menulist, true) {
  if (result = "Option 1") {
  }
else if (result = "Option 2) {
}
}

or this one can be used for either responding or what the NPC says which will be controlled at the player's pace.

ShowMenu ("", NPC.menunamehere, true) {
switch (result) {
  case ("Number 1") {
list remove (NPC.menunamehere, "Number 1")   <---- for removing choices for the player to pick from.
OR 
list add (NPC.menunamehere, "Number 2")  <------ for adding choices for the player to pick from.
}
case ("Number 2") {
list remove (NPC.menunamehere, "Number 1")
OR
list add (NPC.menunamehere, "Number 2")
}
}
menunamehere
or
Function here is you are using one of those.

There are MANY different ways to go about this. You could set up a Function which handles all the work if you want, a menu list....there are libraries that set it all up for you etc.

If you're looking to have variables control the conversation like....opening with how strong the player looks and strength is a variable, you could do something like...

if (player.strength>=15) {
msg ("The NPC says ooooooh you're hawt! Blah blah!")
}
else if (player.fat=True) {
msg ("OMG you're enormous! Ew!")
}
else {
msg ("Hey, what's up? You look rather average!")
}

Just be sure to put a "talk" button or something on the NPC so that the player can acknowledge them and initiate the conversation, or you can have it automatically happen when the player enters a room with that NPC. We'll need a lot more information to help you with this though.

Also, my coding experience is limited, I'm sure others like KV, HK, Pixie, Jay, Mr.Angel and so on can help you with really complex stuff ^_^

Anonynn.


I would just use a Show Menu function, and click no on the ignore button. Closing all the panes (using JavaScript) helps too.

Code I have collected to close and open panes.

JS.panesVisible (false)
JS.panesVisible (true)

Code I use using a Show Menu.
Blahh

msg ("See something that catches your eye?")
options = Split("Potion (100);Hyper Potion (200);Ammo (40);Ammo (80)", ";")
ShowMenu ("Shop", options, true) {
  switch (result) {
    case ("Potion (100)") {
      if (game.hard = true) {
        if (player.gold >= 100) {
          player.gold = player.gold - 100
          player.potion = player.potion + 1
          msg ("You bought a Potion.")
        }
        else {
          msg ("You don't have enough gold.")
        }
      }
      else {
        msg ("The person shakes his head. \"Sorry, I can't do that. We're all out.\"")
      }
    }
    case ("Hyper Potion (200)") {
      if (game.hard = true) {
        if (player.gold >= 200) {
          player.gold = player.gold - 200
          player.hyper_potion = player.hyper_potion + 1
          msg ("You bought a Hyper Potion.")
        }
        else {
          msg ("You don't have enough gold.")
        }
      }
      else {
        msg ("The person shakes his head. \"Sorry, I can't do that. We're all out.\"")
      }
    }
    case ("Ammo (40)") {
      if (player.gold >= 40) {
        player.gold = player.gold - 40
        player.ammo = player.ammo + 20
      }
      else {
        msg ("You don't have enough gold.")
      }
    }
    case ("Ammo (80)") {
      if (player.gold >= 80) {
        player.gold = player.gold - 80
        player.ammo = player.ammo + 40
      }
      else {
        msg ("You don't have enough gold.")
      }
    }
  }
}

You used RPG maker, eh? What kind of games do you make? Or did you just try and give up? Also, is there a way to use RPG maker for free? I've only found versions you pay for.


Thanks for the responses jmnevil54 and Anonynn . I read both posts many times and I have no idea where to begin to even understand what either of you are trying to tell me though. I don't see a console to plug in any of that code to see what pops out.

I couldn't find anything called "Show Menu Function" and I tried to add a function called "Show Menu" and I put in that wall of text, but that didn't seem to do anything.

I believe a library would put this stuff into the GUI right? Where could I find a library that does this?

Sorry for my tone in my OP. I'm more of a writer/artist and I have zero understanding of code whatsoever. I had already spent the bulk of a few days drawing characters to use for images and story outlining. I had only actually played with the Quest software for a few hours and assumed it would be pretty easy. I built most of my world and whatnot and was saving this sort of thing for last. I had no idea it would be so confusing for me.

As for rpgmaker, I've bought most of the versions. It was hard to learn without being able to personally code anything, but I found a way to work around anything I needed using other people's scripts in the script console. My hang up with rpg maker is that tinkering with combat and building a world tile by tile is extremely time consuming and not really compelling for me. I decided to try my hand at text based to eliminate that tedium. I don't have any finished projects because I was never happy enough with them halfway though to continue so I've scrapped a few. I've already gotten so much more done in the text based medium than I could do in rpgmaker in a similar amount of time. I just need to get around this roadblock.


If you're on the offline version, there is a way to paste in code. It's a little paper icon. You can find it by clicking on where you want the code to go, and then pressing all the icons until you find it. Then paste/copy the code in.

Or you can wait until tomorrow, when I can use a computer (on my Kindle now), and take a screenshot.

Also, see above about the questions for RPG maker.


Okay. I've tried entering all the suggested walls of code into the code view in a number of different places asking for scripts (verb, room, object). Everyone of them makes my game unable to load so I can't see what they were supposed to do. I guess I'm still not putting them in the right place or am doing something wrong.

Edit:

I may have found a solution that really is less than ideal, but maybe good enough... I can just make all the dialogue into objects with an "Execute" verb and it can play out based on what object you "Executed". I guess I can also try doing the same, but with verbs.

Edit2:

Damn! It isn't letting me do it with some things. When I type anything like (Tell him to "Give me your word")as an object or verb , it just gives me an "invalid attribute" or "invalid element" error... I delete all the "tell" commands and verbs hoping that would make the errors go away, but that didn't work. I guess I'm going to have to be really weird with my wording to avoid words it doesn't like.


Don't give up until "we" give up...
You are just in the beginner's learner curve...
(That place where no help is helpful)
But, once past that, a whole new world will open up...
each section has it's own code view...
AND, there is a code view for everything...
That is where you need to past the code...
BUT...
You need to past it in the right area...
I don't see a full code block that will create a game in what is posted yet... so...
Just adding this to a blank "game" will not do anything... yet...


Download a few games and check out the code...
Unfortunally... when the games are published, all your code has the code from your local
copy of Quest added so that there is no base code problems...
AND, unfortunally, that disables the UI view of the code... but you can see the full code in the code view,
BUT, you see a lot that Quest adds and it makes it hard to separate the 2...


Hm. I'm trying to think of a helpful way of explaining it since I'm pretty noobish myself. Here...going with the Show Menu I'll walk you through it.

Look at your "Tree of Stuff" on the left (that's what we all refer to as the connected dotted Objects/Rooms). When you click on that NPC, on the right side a group of Tabs will appear. Among these is "Attributes". Click that Tab. You'll see two sections. Inherited Types and Attributes. On the Attributes Section, click Add. In the box that pops up write something like mikesmenu (whatever the name the NPC has and then select OKAY.
For example;
Poop
POOP
pOOp
poop
^--- are all DIFFERENT. If you write the NPCs name like Colonel PoopFace <--- then his menu has to appear like this...

Colonel PoopFace.menu

If you write it like..

colonel pOOpface.menu <---- this will throw an error. It has to appear exactly as the "Tree of Stuff" for it appears.

Anyway, next, you'll see it appear at the very bottom of the Attribute List and just below that will be something called "String". Click on the box and it'll bring up a list. Search for String List and select it. Afterward, you'll see a Static Box appear with "Add" "Edit" and "Delete". Select Add and write whatever the Conversation Topics are. Try to keep it simple ((because remember in code however you write something as an object, room or attribute has to be referred back to the exact way you write it)).

Once you get this far, lemme know ^_^


@ Gadaeus:

here's a step by step (along with explanation) guide of the basics of everything you need / are asking help for/on

first (most of my post) I get into: quest, quest's structure, quest's code structure

then, I get into basic coding: scripting: Attributes and the 'if' Script, briefly... ( see this link for much more detailed help/info: https://textadventures.co.uk/forum/samples/topic/5559/attributes-and-if-script-guide-by-hk )

lastly, at the bottom, I get into dialogue/conversation, via a simple menu design


dialogue/conversation is very complex, even for/with doing the simplest method for it


while you can use the GUI/Editor to do anything/everything (as quest is very powerful), with no coding knowledge, you can only make the most rudimentary of games, even with using the GUI/Editor. You need to know the basics of coding (scripting: Attributes and the 'if' Script usage), even if you're only working with the GUI/Editor (no code) as you still got to understand the concept and logic involved for/in doing what you want, as this opens up 90% of everything you want to do in your game, a huge bang for the buck. Whereas, after learning basic coding (scripting: Attributes and the 'if' Script usage), learning even more coding stuff has very diminishing returns (as remember you're already at 90% just from basic coding: scripting: Attributes and the 'if' Script).


I'll walk you through the simplest way to do it, using the GUI/Editor (but along with coding too):

create a new game, click on the 'create a Text Adventure' circle button, to create a Text Adventure game, name it whatever you want (quest will automatically add on its extension to it: YOUR_NAME_OF_FILE.aslx) and save it to the desktop (so you can find it easily).

in the GUI/Editor, on the left side of the screen, is the "tree of stuff", which looks like this for a new game:

Objects
-> game
->-> verbs
->-> Commands
-> room
->-> player
Functions
Timers
Walkthrough
Advanced
-> Included Libraries
->-> English.aslx
->-> Core.aslx
-> Templates
-> Dynamic Templates
-> Object Types
-> JavaScript

this "tree of stuff" are all of the "physical things" (and in code: they're the tag blocks/lines) in/of your game: http://docs.textadventures.co.uk/quest/elements/

click on something in the "tree of stuff", so it is highlighted, and then on the right side, you'll see more options/controls/details for that thing that you've got highlighted.

for example, click on 'game' in the" tree of stuff" so it is highlighted, and now on the right side, you got Tabs at the top:

Setup, Features, Display, Interface, Script, Room Descriptions, Player, Attributes

click on these Tabs, and see what various options/controls/details they provide you with


now, let's delve into the code: your entire game code

at the very top of the screen in the menu bar, between the 'play' and '? (help)' buttons, is a notepaper-like button, which is a toggle to switch between the GUI/Editor mode and the Code View mode (this is your entire game code), so click on it, to see your entire game code, which for a new game, looks like this roughly (I'm not using the most current quest version, so there might be some differences):

(to see/get-at your entire game code, you can always simply right-click on your game file itself, in this example, saved on your desktop, and open it up with a text editor software: notepad, wordpad, Apple: text editor, notepad++, etc)

<asl version="550">

  <include ref="English.aslx" />
  <include ref="Core.aslx" />

  <game name="example_new_game">

    <gameid>SOME_RANDOMLY_GENERATED_HASH_STRING</gameid>
    <version>1.0</version>
    <firstpublished>2017</firstpublished>

  </game>

  <object name="room">

    <inherit name="editor_room" />

    <object name="player">

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

    </object>

  </object>

</asl>

// start (starting code line) of the 'asl' tag block: (see line below)
<asl version="XXX">
  // mass of code (your entire game's contents)
</asl>
// end (ending code line) of the 'asl' tag block: (see line above)

this is the 'asl' tag block, which IS your game, the 'asl' tag block IS YOUR GAME OBJECT, so everything must be within this 'asl' tag block!

the starting line of a tag block (or a single tag line) is known as the 'signature/header', which has special parameters in it, such as with the 'asl' tag block's: version="XXX"

this (version="XXX") MUST MATCH UP with the quest engine (quest download) version you're using:

in the GUI/Editor, at the top of the screen, in the menu bar at the top (File, Edit, Tools, Help), click on 'Help -> About', to see the quest engine version you're using (have installed), which for me, looks partially like this:

Quest: 5.6
Build: 5.6.5514.32136

only the first two digits matter for the: version="XXX", the third digit is always a zero, so for me, I have to have this:

<asl version="560">
</asl>

you'll probably have '560' or '570' or '580', whatever the current version of quest is...

if you've got/see: version="550", even though you're using the most current version of quest (v560, v570, v580, whatever), don't worry, as this just means that the current version of quest, still uses the v550 engine.

I lied up above (as I didn't want to initially confuse you), as it shows this for me: version="550", as this still works with the v560 engine I'm using.


<asl version="550">

  <include ref="English.aslx" />
  <include ref="Core.aslx" />

</asl>

these are the default libraries (for english language downloads), which actually contain the quest engine coding itself... yes, if you're good at coding and know quest, you can create your own unique quest engine!

'libraries' are just 'library files', which merely contain code, that can be used by your game file.

here's how to create a library file:

create a new notepad doc for example, and write this into it:

<library>
  // mass of code
</library>

and simply save it (and to the desktop, so you can find it easily) with the same extension of: NAME_OF_LIBRARY_FILE.aslx

(make sure the extension is 'XXX.aslx', if it's 'XXX.txt', just change it to 'XXX.aslx')

a library file can be as simple as a single Object for your game, for example, a 'dragon' Object:

<library>

  <object name="dragon">
  </object>

</library>

or an entire engine... or a different human language (english, spanish, russian, chinese, german, etc)...


your game is "built-up" (initialized), first from the library files (so their heirarchy of, top:first to bottom:last, matters!), and then lastly from your game file's own code/content

for example, if you had this (switching the default libraries ordering, see below), you'll probably get an error:

<asl version="550">

  <include ref="Core.aslx" />
  <include ref="English.aslx" />

</asl>

anyways...

to add a library file to our game (if you've not connected it already):

  1. the library file itself must be in the same folder/location as your game file, so that the game file can find (and thus use) it
  2. you must add it via code within your game file (see below)

let's say we created a 'dragon.aslx' library file:

<library>

  <object name="dragon">
  </object>

</library>

and to add it into our 'example_game.aslx' game file via code:

<asl version="550">

  <include ref="English.aslx" />
  <include ref="Core.aslx" />

  <include ref="dragon.aslx" />

  <game name="example_game">
  </game>

</asl>

which, is the exact same thing as if we just did this:

'example_game.aslx' game file:

<asl version="550">

  <include ref="English.aslx" />
  <include ref="Core.aslx" />

  <game name="example_game">
  </game>

  <object name="dragon">
  </object>

</asl>

so, you don't have to use library files, but they can be greatly helpful, just for organization of code alone.


the game file has some required code stuff in order for it to work as a game file, but otherwise, there's no difference between a library file and a game file, both just hold code.


anyways... onwards...

<asl version="550">

  <include ref="English.aslx" />
  <include ref="Core.aslx" />

  <game name="example_game">
  </game>

</asl>

the 'game' tag block is what you see as the 'game' in the "tree of stuff" in the GUI/Editor, they're the same thing

this is a special (and required) Object, which has various controls/toggles/options/attributes for game-wide settings and also has outside of game (publishing) info for people looking in whether to play your game or not (author, description, version: version/update history, first published, category, etc etc etc), and some other special game stuff ('pov', the 'start' script, etc)

you can see this for yourself, go back into GUI/Editor mode, and name/re-name your game, then go into Code View (entire game code: remember at the top of the screen, in the menu bar, click on the notepaper like button), and see the change to the special 'game' Game Settings Object:

<asl version="550">

  <include ref="English.aslx" />
  <include ref="Core.aslx" />

  <game name="THE_NAME/RE-NAME_OCCURS_HERE">
  </game>

</asl>

now, try "coding" (writing) in a different name into the code (see above), and then go back into the GUI/Editor mode, and look at see what it says is the game name.

see/test the same thing (Code View vs GUI/Editor) with the other options/controls/attributes:

<asl version="550">

  <include ref="English.aslx" />
  <include ref="Core.aslx" />

  <game name="THE_NAME/RE-NAME_OCCURS_HERE">

    <gameid>SOME_RANDOMLY_GENERATED_HASH_STRING</gameid>
    <version>1.0</version>
    <firstpublished>2017</firstpublished>

    <author>HegemonKhan</author>
    <category>RPG</category>
    <subtitle>THIS_IS_MY_SUBTITLE_FOR_MY_GAME</subtitle>
    <description>This is my example game</description>

    // etc etc etc Attributes/options/controls

  </game>

</asl>

on wards...

<asl version="550">

  <include ref="English.aslx" />
  <include ref="Core.aslx" />

  <game name="example_game">
    // blah Attributes
  </game>

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

</asl>

the 'room' Room Object is the default Room Object, containing the default 'player' Player Object (not shown above)


and lastly...

<asl version="550">

  <include ref="English.aslx" />
  <include ref="Core.aslx" />

  <game name="example_game">
    // blah Attributes
  </game>

  <object name="room">

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

  </object>

</asl>

this is the default 'player' Player Object, contained ("nested/indented") within the default 'room' Room Object

the built-in 'parent' Object (reference/pointer) Attribute is what actually determines containment, so the below, is the same as the above:

<asl version="550">

  <include ref="English.aslx" />
  <include ref="Core.aslx" />

  <game name="example_game">
    // blah Attributes
  </game>

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

  <object name="player">

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

  </object>

</asl>

anyways...

the containment/parent-child heirarchy is the same as if they were folders:

'asl' (the GAME OBJECT) "folder/block"
-> 'include ref' (libraries) "line"
-> 'delegate name' (delegates) "line"
-> 'game' (the special GAME SETTINGS Object) "folder/block"
-> etc stuff (Objects, Exits, Functions, Commands, Verbs, Timers, Turnscripts, Object Types, etc) "folder/block/line"

so, the vertical placement doesn't matter, after (below) the special 'game' Game Settings Object ("folder"/block)

however, horizontal placement (indenting/"nesting") matters BIG TIME!


anyways... onto...

basic coding: scripting: Attributes and the 'if' Script

Attributes ('Attribute' VARIABLES):

in the GUI/Editor: 'WHATEVER' Object -> 'Attributes' Tab -> Attributes -> Add (repeat as needed) -> (set it/them up: name of attribute, type, value)

in code, an example:

<asl version="550">

  <include ref="English.aslx" />
  <include ref="Core.aslx" />

  <game name="example_game">
    // blah Attributes
  </game>

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

  <object name="player">

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

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

    <attr name="strength" type="int">100</attr>

    <attr name="flying" type="boolean">false</attr>

    <attr name="weapon" type="object">katana</attr>

  </object>

  <object name="katana">

    <attr name="damage" type="double">67.345</attr>

  </object>

</asl>

we take this stuff for granted/naturally/instinctively, but in programming, it must be expressed/used/handled, unfortunately:

Data (Data/Attribute/Variable/Value) Types: http://docs.textadventures.co.uk/quest/types/

(Attribute/Variable Type and Value Type, must match up!)

this is for when you're doing any scripting (if done with the GUI/Editor, it handles this stuff for you) :

int (integers): a non-decimal number: -999, -3, 0, 7, 647

example: player.strength = 100

doubles (floats / floating-points): decimal numbers: -999.9, -3.12345, 0.0, 1.99, 777.4

example: player.damage = 47.3

booleans (only two special value choices/states, NO double quotes!): false, true

example: orc.dead = false

string values ("text": alphabet characters/symbols, numbers/"numeric" characters/symbols, and some other symbols/characters): "a", "abc", "1", "123", "abc123", "hi", "strength", "dead", "abc_123_abc_123", "Welcome to my game, I hope you enjoy it, muwhaha!", "true", "false", "player", "room", "HK", "orc", "dragon", etc etc etc. Note the double quotes, they're required!

example: player.alias = "HK"

object (reference/pointer) values (these must be actually existing/created Objects, do NOT have double quotes!): player, room, HK, orc, dragon, etc etc etc. EXCEPT (as these are reserved/special for a boolean's values): true, false

example:

create ("katana") // just to show/have an actually existing/created 'katana', as this is required for an Object (reference/pointer) Attribute
player.weapon = katana

lists, dictionaries... we'll get into lists slightly... in a bit (involved with menus)... but lists and dictionaries are more advanced stuff, so won't get into them within this post (aside from basic usage of lists for menus)


anyways... I'm getting tired... so let me wrap this up...

simple dialogue/conversation example:

via (in) the GUI/Editor:

'Objects' ("tree of stuff") -> 'Objects' Tab -> Add -> Name: npc_1

using the built-in 'speak/talk' Verb:

'npc_1' ("tree of stuff") -> 'Attributes' Tab -> Attributes (the box at bottom, NOT the 'Inherited Types' box at the top) -> Add -> (see below)

Attribute Name: topics_list

in the 'Attributes' box, make sure you got the 'topics_list' highlighted (click on it if it's not highlighted), then continue setting it up (see below)

[String List] // this is the "Attribute Type" selection

Add (this is adding values, known as "items", to your string list. The values/"items" are string values/"items", as we made this as a String List Attribute Type, and thus it needs to have double quotes if done in code, but the GUI/Editor handles it, so do NOT type in the double quotes when you're adding/naming the value/item to your list) -> princess

Add (this is adding values, known as "items", to your string list. The values/"items" are string values/"items", as we made this as a String List Attribute Type, and thus it needs to have double quotes if done in code, but the GUI/Editor handles it, so do NOT type in the double quotes when you're adding/naming the value/item to your list) -> dragon

Add (this is adding values, known as "items", to your string list. The values/"items" are string values/"items", as we made this as a String List Attribute Type, and thus it needs to have double quotes if done in code, but the GUI/Editor handles it, so do NOT type in the double quotes when you're adding/naming the value/item to your list) -> sword

Add (this is adding values, known as "items", to your string list. The values/"items" are string values/"items", as we made this as a String List Attribute Type, and thus it needs to have double quotes if done in code, but the GUI/Editor handles it, so do NOT type in the double quotes when you're adding/naming the value/item to your list) -> wizard

'npc_1' ("tree of stuff") -> 'Verbs' Tab -> Add -> (choose the 'speak-to/speak/talk-to/talk' built-in verb via the drop down box, by clicking on the down arrow/triange button on the right side of the 'verb name' text box) -> then, below, change the '[print a message]' box to '[run a script]' box -> (see below)

add new script -> 'output' section/category -> 'show a menu' Script -> (see below)

Show menu with caption [text]: What do you want me to talk about?
Options from list/dictionary: npc_1.topics_list
Allow player to ignore the menu: [no]
After choosing, run script: (see below)

(the 'if' Script and the 'switch' Script are identical functionally, but you may like one better than the other, as they have different looks/styles to them. Sometimes I like using the 'if' Script and sometimes I like using the 'switch'Script, it depends on the situation and/or which I prefer using more)

(the 'show a menu, get input, ask, etc?' Scripts, automatically, hidden from you, stores your selected/inputted choice into the built-in 'result' Variable VARIABLE: result = YOUR_SELECTED/INPUTTED_CHOICE)

using the 'if' Script:

add new script -> 'scripts' section/category -> 'if' Script -> (see below)

if [expression] result = "princess"

-> then -> add new script -> 'output' section/category -> 'print a message' Script -> print [message] The princess has been kidnapped by the dragon!

add else if -> else if [expression] result = "dragon"

-> then -> add new script -> 'output' section/category -> 'print a message' Script -> print [message] The dragon can only be killed by the legendary dragon slayer sword!

add else if -> else if [expression] result = "sword"

-> then -> add new script -> 'output' section/category -> 'print a message' Script -> print [message] The legendary dragon slayer sword is in the possession of the evil wizard!

add else if -> else if [expression] result = "wizard"

-> then -> add new script -> 'output' section/category -> 'print a message' Script -> print [message] The evil wizard can be found in his dark spire...


how the 'if' script works: string matching

let's say you selected 'dragon' as your choice from the list, so:

result = "dragon"

// in code example/explanation:
if (result = "princess") { /* scripting / }
// if ("dragon" = "princess")
// if ("d" = "p") ---> FALSE
// if ("dragon" = "princess") ---> FALSE
// thus since 'FALSE', move to the next 'if/else-if/else' condition/test/check, which is: else if (result = "dragon), see below:
else if (result = "dragon") { /
scripting */ }
// if ("dragon" = "dragon")
// if ("d" = "d") ---> TRUE
// if ("r" = "r") ----> TRUE
// if ("a" = "a") ----> TRUE
// if ("g" = "g") ----> TRUE
// if ("o" = "o") ----> TRUE
// if ("n" = "n") ----> TRUE
// if ("dragon" = "dragon") ----> TRUE
// so do its scripting: outputs: The dragon can only be killed by the legendary dragon slayer sword!


using the 'switch' Script:

(actually, I'm getting too tired/exhausted... lots of typing already...)

see if you can figure out the 'switch' on your own...


here's how the scripting looks in-code for both the 'if' Script and the 'switch' Script:

as nearly full game code:

using the 'if' Script:

<asl version="550">

  <include ref="English.aslx" />
  <include ref="Core.aslx" />

  <game name="example_game">
  </game>

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

  <object name="player">

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

  </object>

  <object name="npc_1">

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

    <attr name="topics_list" type="stringlist">
      <value>princess</value>
      <value>dragon</value>
      <value>sword</value>
      <value>wizard</value>
    </attr>

    <attr name="speak" type="script">
      show menu ("What do you want me to talk about?", npc_1.topics_list, false) {
        if (result = "princess") {
          msg ("The princess has been kidnapped by the dragon!")
        }
        else if (result = "dragon") {
          msg ("The dragon can only be killed by the legendary dragon slayer sword!")
        }
        else if (result = "sword") {
          msg ("The legendary dragon slayer sword is in the possession of the evil wizard!")
        }
        else if (result = "wizard") {
          msg ("The evil wizard can be found in his dark spire...")
        }
      }
    </attr>

  </object>

</asl>

using the 'switch' Script:

<asl version="550">

  <include ref="English.aslx" />
  <include ref="Core.aslx" />

  <game name="example_game">
  </game>

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

  <object name="player">

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

  </object>

  <object name="npc_1">

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

    <attr name="topics_list" type="stringlist">
      <value>princess</value>
      <value>dragon</value>
      <value>sword</value>
      <value>wizard</value>
    </attr>

    <attr name="speak" type="script">
      show menu ("What do you want me to talk about?", npc_1.topics_list, false) {
        switch (result) {
          case ("princess") {
            msg ("The princess has been kidnapped by the dragon!")
          }
          case ("dragon") {
            msg ("The dragon can only be killed by the legendary dragon slayer sword!")
          }
          case ("sword") {
            msg ("The legendary dragon slayer sword is in the possession of the evil wizard!")
          }
          case ("wizard") {
            msg ("The evil wizard can be found in his dark spire...")
          }
        }
      }
    </attr>

  </object>

</asl>

I have added a tutorial to the Quest docs that hopefully explains it without you needing to worry about code at all (it does show you the code, but only after you have done it all).

http://docs.textadventures.co.uk/quest/ask_simple_question.html


The Pixie's tutorials are usually good.

Okay, we might have a problem. You do realize you can enter multiple "tell him" code things, all right? That might be simpler. That also seems to be what you want to do.

With the way I was doing it, you would only need one verb or command. You can use multiple commands, but you appear to be confused. DarkaLizerd's code could be better done with what you are doing.

Anyway, just wait for me to get that screenshot...


I would recommend anything from Pixie's tutorials :) He does a great job walking you through everything. HK's explanations are good as well. Jmnevil I don't know well enough yet xD !

Anonynn.


Here.

https://i.imgur.com/Qt5DJ1D.png
https://i.imgur.com/E4p9Lao.png
https://i.imgur.com/O5vxjnR.png
https://i.imgur.com/3mK7PC3.png
https://i.imgur.com/RcQaUVC.png

I probably only should have shown you the code view, but I might as well show you the whole thing.

P.S. "Also, is there a way to use RPG maker for free? I've only found versions you pay for."


RPG Maker/Vx isn't free, unfortunately. You can play their games for free, but to make your own games, you got to pay for it.


@The Pixie

Thank you very much. You have a gift for instruction. Your instruction assumed no previous knowledge and every time I started getting confused you clarified and I could continue. I wish you were my math prof in college. I'll likely use this method.

@jmnevil54

Yours was the second most helpful. I could probably make that solution work for me as well, and may try it as an alternative at some point if I hit any snags. RPG maker is free if you pirate it... but I just bought them. MV is the current and best/most supported version imo and it is 75% off on steam currently.

@hegemonkhan

Wow! That was really detailed. I couldn't understand it enough to fix my problem, but I actually learned a little bit about coding.


I think RPG maker is "free" for 30 days, then you must pay for it to create your own games, but, you can still play other people's games for free...
It is very good for simple graphic games... Even some very good ones...
Legend of Queen Opala is a very good, and detailed game (adult oriented)
She has 3 games out in that series...
Cursed Armor, and Didnapper are another good pair... (both adult...) Didnapper has no "dirty" pictures...
Very good for detailed story telling, just like Quest... Except, you don't need to describe the rooms...


@The Pixie

The choices are being presented in game, but choosing them gives me this error

Error running script: Error compiling expression 'red roses': SyntaxError: Unexpected character: 'Line: 1, Column: 64

I feel like I followed the guide perfectly, but the result part looked a little bit different when I added a switch...

Here is a pic of what it looked like in mine. I made mine a script on the room for first time after you enter a room.

https://imgur.com/a/4blwZ


Gadaeus1 you have a typo.


@jmnevil54

I reviewed it a few times, and I can pretty confidently say that I don't.


code requires you to be a 100% spelling/grammer/typo-free/mistake-free nazi... coders become very good at proof-reading, as if it's not 100% error/typo/spelling/grammer free, code doesn't work.

if you add "rose" as an item to your String List Attribute, but in the 'if/switch', you have: if (result = "Rose") / case ("Rose"), it's not a match (as quest IS case sensitive: "rose" is NOT equal to "Rose"), and thus an error.

when code doesn't work, 90% of the time, it's merely because of some stupid small typo or missing/extra character/symbol...

so, don't worry if your game doesn't load up into the GUI/Editor or nor doesn't play, as all it means is that you got an error in your code, and we just need to find it (hardest part, lol... especially an accidental space/whitespace from/in copying too far/much... lol, probably the hardest "error" to find!!!), so we can then fix it up.


if you can post your entire game code here (hopefully it's not very big, and/or you don't mind making it public... if you want to keep it private, than you can pm it to one of us --- we're all trustworthy) in a post, so we can see/find what's wrong, fix it for you, and explain it as well.

right click on your game file itself, choose to open it with a text editor software (notepad, wordpad, Apple: text editor, etc), highlight all of it, copy it, and then paste it here, within a post, like this (as using the post's code box, preserves its formatting, which helps a lot, with helping you, as it's a pain having to re-format it, so we can read the code correctly):

m```
(paste your entire game code here)
m```

those 3 weird characters/symbols, is the keyboard key in the upper left corner of the keyboard, above the left 'TAB' key and to the left of the '1'key of the horizontal row of number keys. If you were to hold shift and press this key, you get the tilde (~) character/symbol instead.

but without the m's in front, which will produce this:

(paste your entire game code here)

unfortunately... quest's error messages are often pretty ambigious...

but when you get one that tells you the 'line' and character position ('column'), you're very lucky...

literally go to 'Line: 1, Column: 64', in your code (I think the GUI/Editor has the line and position/column for your cursor's location at the bottom... if you can't get into the GUI/Editor due to the error, then you're going to have to use a software that has the line and position/column tracking... I really recommend you download and install this really useful/powerful free text editor: https://notepad-plus-plus.org ), and see if you can figure out the error... otherwise... just post/pm us your entire game code, and we'll find and fix the issue for you. Do note though that you might have more errors too, and the error message's given line and column/position might not be actually where the error actually is as well... too hard to explain right now... too much work, lol...


Sorry, my bad. I thought I was checking as I went along, but apparently not!

You need double quotes before and after the text in the case bit, so it would be:

"red rose"

Not

red rose

It needs the capitialisation to be right too, but perhaps you have it all in lower case in the options.
I have updated the tutorial.


@The Pixie

That did it. I can make full dialogues now. Thanks again!


Fine.


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

Support

Forums