Two Inputs to do same thing

Hi all,

In Inform 7:

I would very much like to make TELL NPC TO JUMP and ASK NPC TO JUMP do the same thing as NPC, JUMP.

I've been searching through everything that I can find regarding this subject for three days, but to no avail.

If I could only find the correct terminology...

If I knew how to refer to 'asking it to try', I'm pretty sure that would be all I need.

Right now, I have:

'Understand "ask [something] to [text]" as answering it that.

Instead of answering something that something when player's command includes "to" and player's command includes "jump": try the noun jumping.'

(I've got a 'rule succeeds' thrown in there, too, of course.)

That would work as long as I wrote a line for each action, but that sounds tiring. It also sounds like a very dirty hack.

Anyone dealt with this before or have any ideas?

Thanks in advance!


I usually use a command for something like this although there is a do (this) option which I always had a tough time with.

You can snoop around here and see if this helps: https://textadventures.co.uk/forum/quest/topic/e4afspjcd0c4-kre_w-soq/proper-syntax-for-dothis-script


is this specifically for inform7, or are you using quest/squiffy?

(we do have people here, who can probably help you with inform7 and of course quest and squiffy too, but I personally only know quest)

in quest, for Verbs, you can use the semicolon to give it more parsing patterns in its GUI/Editor's 'pattern' box:

(you must go from the most complex/longest to the simpliest/shortest, to avoid parsing conflicts)

pattern box: tell npc to jump;ask npc to jump

I believe (I could be wrong), that underneath, the GUI/Editor is creating a Command of the Verb (if one doesn't already exist), as with Commands, it uses a 'pattern', as it takes in typed-in input, and thus needs something to parse your input to:

<command name="npc_jump_command">
  <pattern>tell npc to jump;ask npc to jump</pattern>
  <script>
    // blah scripting
  </script>
</command>

also, do note that you can be dynamic (using any input) too via using the 'textXXX' and 'objectXXX' Parameters too:

<command name="action_command">
  <pattern>tell #object_parameter# to #text_parameter#;ask #object_parameter# to #text_parameter#</pattern>
  <script>
    if (text_parameter = "jump") {
      msg ("You command the " + object_parameter.alias + " to jump")
    } else if (text_parameter = "squat") {
      msg ("You command the " + object_parameter.alias + " to squat")
    }
  </script>
</command>

there's lots of complex expressions/patterns and scripting that you can do, the above is just one such simple example


You will be better asking at IntFiction:
http://www.intfiction.org/forum/viewforum.php?f=7

However, you have me thinking about whether that can be easily added to Quest...

ETA: In fact it is remarkably easy to add to Quest, so will be on the Ask/Tell tab when Quest 5.7 gets released.


Hello,

I'm so sorry! I don't know how I missed these replies!

The Pixie,
I posted the question here and at IntFiction simultaneously, and I got the answer at IntFiction. (I read that they were more into Inform, but this site was more friendly and responsive, so I decided to just try both.)

hegemonkhan and XanMag,
The reason I came back to this page is: I am now (trying to) make this game in Quest, so I was looking around for this answer again and ... long story short: I'm about to see if I can get this working in Quest. (This is the first real game I've attempted in Quest, and I'm having troubles adapting, so I'm probably going to try hegemonkhan's way first. It looks easier.)

Sorry again for my lack of manners!

I'll add another reply with the solution I used for Inform 7 as well as the one I use in Quest.

Thanks again, everyone!


This is what I'm using right now:

if (text_parameter = "jump") {
msg ("" + object_parameter.name + " jumps in place.")
}
else {
msg ("" + object_parameter.name + " " + text_parameter + "s.")
}

It works, but I'd have to write a line for each possible action that the NPC could perform. . .

I'm currently searching for the correct terminology to pull off something like:

if (text_parameter = " ANY_COMMAND ") {
command (object_parameter.name [performs the action]);
msg ("" + object_parameter.name + " " + text_parameter + "s.")
}

NOTE: I know line 2 is complete rubbish. Just an example of what I wish to do.

(NOTE 2: I'm not much of a programmer, if you can't tell, but I'm trying to learn.)

The code to make this work in Inform 7 is in my other computer, and I will post it once I'm back in the vicinity of that machine.

Thanks again, everyone!


Your command pattern will be:

#object#, #text#;tell #object# to #text#;ask #object# to #text#

What happens in the code depends on how you want to handle this. I think I would do it by having a script on each NPC to handle each command (you need to be using the desktop version). Like this, which first checks if it is an NPC, then if the NPC has a script of that name runs it, if she has a string of that name prints it.

scriptname = LCase(text)
if (not DoesInherit(object, "female") and not DoesInherit(object, "male")) {
  msg("Nothing happened")
}
else if (HasScript(object, scriptname)) {
  do (object, scriptname)
}
else if (HasString(object, scriptname)) {
  msg (GetString(object, scriptname))
}
else {
  msg(CapFirst(object.gender) + "ignores you.")
}

On the attributes tab of the NPC, add a "jump" (all lower case) attribute, either a string or script.


Here's the code for Inform 7 (just in case anyone else lands on this page who needs it):

Persuasion rule for asking Ralph to try doing something:
	persuasion succeeds.

After reading a command (this is the phrasing commands properly rule): 
	let N be "[the player's command]"; 
	replace the regular expression "^(ask|tell|order) (.+?) to (.+)" in N with "\2, \3"; 
	change the text of the player's command to N.

(Now I'm off to try to wrap my mind around that code The Pixie just dropped on here. (Worry not, dear readers. I shall one day be one with the computer! (Or at least get it to do this one thing.)))

My problem is that I'm attempting to pull things such as this off without understanding variables, attributes, expressions, and the like. (I learn to swim in the deep end.)

I shall return to report success, though.

Thanks for all the help!

Best wishes!


Your command pattern will be:

#object#, #text#;tell #object# to #text#;ask #object# to #text#
What happens in the code depends on how you want to handle this. I think I would do it by having a script on each NPC to handle each command (you need to be using the desktop version). Like this, which first checks if it is an NPC, then if the NPC has a script of that name runs it, if she has a string of that name prints it.

scriptname = LCase(text)
if (not DoesInherit(object, "female") and not DoesInherit(object, "male")) {
msg("Nothing happened")
}
else if (HasScript(object, scriptname)) {
do (object, scriptname)
}
else if (HasString(object, scriptname)) {
msg (GetString(object, scriptname))
}
else {
msg(CapFirst(object.gender) + "ignores you.")
}
On the attributes tab of the NPC, add a "jump" (all lower case) attribute, either a string or script.

This works quite well.

Could I replace '(object, scriptname)' with '(object, COMMAND)' for instances where the player asks the NPC to perform mundane actions, such as opening doors and taking objects?
(Alternatively, which programming language should I learn to improve my Quest game-writing skills?)

(The reason I'm trying to do this: I'm cooking up a game where the player must die before the game actually begins. The player is then a ghost and needs help from NPCs to interact with solid objects (unless the player enters CONCENTRATE or FOCUS before attempting to interact with a solid object).)

All the help is MUCH appreciated!

(In fact, everyone has gone above and beyond already. Feel free to direct me towards 'programming elementary school' when I'm asking how to do things which are obviously beyond my understanding. It won't hurt my feeling.)


Okay, I'm learning. . .

scriptname = LCase(text)

This declares 'scriptname' as a variable(?), holding whatever lower case text is included in the #text# part of the command. (So my inquiry about replacing (object, scriptname) with (object, command) didn't make very much sense.)

The script then checks to see if the #object# in the command is an NPC by checking whether or not the object is listed as male or female with: if (not DoesInherit(object, "female") and not DoesInherit(object, "male")) {
msg("Nothing happened")
}
and the message NOTHING HAPPENED is displayed if the object is not male or female.

So. . .
Presumably, I could write a variation of this with #object#, attack #object#, using the same script, only slightly altered and with a different name, and create a script for each NPC with a lower case script name which would match the second #object#?

Or would I need to use #object_1#, attack #object_2#?
(I'd like it to be an object so the parser would throw an error message if the second object is not in the location. I could probably come up with a code if this isn't feasible. Such as:
else if (not ListContains(ScopeReachable(), object_2) and not ListContains(ScopeVisible(), object_2)) {
msg ("You can't see that.")
}
)

Back to the learning:

These two functions check to see whether there is a string or a script listed for the specified object, and, if there is a script or a string, it implements it:

else if (HasScript(object, scriptname)) {
do (object, scriptname)
}
else if (HasString(object, scriptname)) {
msg (GetString(object, scriptname))
}

(So, if I added an attribute named "protag" to an NPC, I'm thinking I could use something like this:
if (HasAttribute(object, "protag")) {
msg ("" + object + " is a good guy.")
}
else {
msg ("" + object + " is a bad guy.")
}
)

And I am thinking this one prints this message when the object is an NPC but no string or script is listed in the object's attributes:

msg(CapFirst(object.gender) + "ignores you.")
}

E.g, "He/She ignores you."

Am I getting it, or am I way off?

If I'm way off, I'm prepared to go learn any relevant programming languages. I'd consider asking for any further help without having at least learned the necessary basics impolite, so, again, feel free to direct me to any relevant, basic tutorials instead of going through all the trouble of explaining things anyone trying to do what I'm attempting should already know.


NOTE: I thought Inform 7 was superior to Quest after the initial comparison I made, but now I'm thinking I had it backwards. I think more can be accomplished using Quest. I just need to learn some programming basics first.
Big thanks for all the help so far, everyone!

for the links: remove the dot/peroid in: ht.tps, for it to work in the url


and there's the free codecademy site (have to register/make user account, though) to learn to code (lots of languages):

ht.tps://www.codecademy.com/

and a really good text editor (lots of languages and color coding, line and position count, and tons of editing features that I need to learn, lol):

ht.tps://notepad-plus-plus.org/

actual testing/running of code requires the SDKs/IDEs and/or the programming language software installed (Java from oracle and Python for example, can't remember if C++ has software needed to be installed or not):

ht.tps://en.wikipedia.org/wiki/Software_development_kit
ht.tps://en.wikipedia.org/wiki/Integrated_development_environment


quest's custom 'aslx' language uses similarities to a few different language types:

quest uses the same 'tag' block/line design (as well as able to directly use many of their tags/commands) as html/xml: ht.tps://www.w3schools.com/default.asp

example, a default new game's code (using the english language download of quest):

(this is the actual "physical" / existing/created stuff, in your game / game code / GUI-Editor)

(I'm using an older version of quest still: version="550", so yours will be: version="560", or: version="570")

<asl version="550">

  <include ref="English.aslx" />
  <include ref="Core.aslx" />
  
  <game name="NAME_OF_YOUR_GAME">
    
<gameid>SOME_RANDOM_GENERATED_HASH_STRING_(FOR_MAINLY_SERVERS/ONLINE)_BUT_STILL_REQUIRED_ALSO_FOR_OFFLINE_I_THINK</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>

but quest's scripting syntax is similar to C++ ( ht.tp://www.cplusplus.com/ and ht.tps://www.tutorialspoint.com/cplusplus/) /Java ( ht.tps://docs.oracle.com/javase/tutorial/ ), with the use of braces/brackets/parenthesis, an example:

if (test.score > 89) {
  test.grade = "A"
} else if (test.score > 79) {
  test.grade = "B"
} else if (test.score > 69) {
  test.grade = "C"
} else if (test.score > 59) {
  test.grade = "D"
} else {
  test.grade = "F"
}

also, quest uses some data structures (lists, dictionaries) from Python ( ht.tps://www.python.org/ )

whereas, C++/Java uses 'arrays' (which are close somewhat in similarity to lists)

(C++/Java is more popular in the US, Python is more popular in Europe)


and here's a guide to learn more of quest's code and of its Attributes and the 'if' Script, the 'bread and butter' of coding/programming, letting you do 90% of everything you want to do in/for your game:

http://textadventures.co.uk/forum/samples/topic/5559/attributes-and-if-script-guide-by-hk


but first, if you need to, you got to learn the basics of using quest and it's GUI/Editor, before and should you, decide to jump into learning its code, via going through the tutorial:

http://docs.textadventures.co.uk/quest/tutorial/

and here's the quest doc site's main page:

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

(tons of resources, but you got to understand all of this stuff first... got to learn to code first to understand all of this stuff)


lastly, if you want to see my own struggles when I was trying to learn quest 5 years ago (and coding, as I found quest with ZERO coding/programming ability and knowledge, and used it to learn to program, and am now taking college programming classes):

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

I was so confused by all of the terms and their application, once I got done with the 'holding hand' tutorial's use of specific step by step examples, and tried to do stuff on my own in my game... I was totaly lost, as I didn't really understand the concepts of what I was doing in the tutorial enough to be able to do stuff on my own.

I wanted to learn to code, and finally I found quest, enabling me to do so (I didn't know about codecademy site at this time), and like you... jumped right into it... the deep end of the pool... right into trying to learn coding... hehe, the best way to learn :D


Presumably, I could write a variation of this with #object#, attack #object#, using the same script, only slightly altered and with a different name, and create a script for each NPC with a lower case script name which would match the second #object#?

Or would I need to use #object_1#, attack #object_2#?

The latter. You need to give them different names (and both names must begin "object". The standard Quest way would be #object1#, attack #object2#, then you have two variables, object1 and object2.

As these start with object, Quest will match both to objects in the room or inventory, so when you write the script for your command, you know for sure that both are present (Quest will print the "unresolved object text" if it fails to find matching objects).

And just so you know, you can also use names that start "text" to match any text at all or "exit" to match an exit.

Besides that, you pretty much have it. Quest uses its own unique language, though it is similar to C and its derivatives. There are a lot of help files available:

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

I would suggest the important ones are in the sections "Commands (and Verbs)" and "Guides to Coding With Quest", as well as "Important attributes".

NOTE: I thought Inform 7 was superior to Quest after the initial comparison I made, but now I'm thinking I had it backwards. I think more can be accomplished using Quest. I just need to learn some programming basics first.

I have been doing this for years and have yet to find anything we cannot do in Quest. The only limitation is that inherent in using a text parser, which will be true of any system.


(keeping this simple...)
Quest has 3 types of VARIABLES:

VARIABLES:

  1. Attributes
  2. Variables
  3. Parameters and their Arguments (inputs/values/data to be stored into the Parameter/s)

for the most part, you want to use Attributes, as they're global (you can use/refrence them any-where/where-ever/when-ever within your game) and permanent (so long as the object containing them, exists / still exists, of course)

in code scripting, Attributes look like this:

NAME_OF_OBJECT.NAME_OF_ATTRIBUTE = VALUE_OR_EXPRESSION

examples:

(quest can determine the Attribute Type via its Value Type)

(if you create Attributes through the GUI/editor, you're able to set/determine the Attribute type as its options/drop-downs, so if you do any code scripting, make sure your Value's Type matches up with its Attribute's Type)

player.strength = 100 // Integer Attribute
player.alias = "HK" // String Attribute
orc.dead = false // Boolean Attribute
player.right_hand = sword // Object (reference/pointer) Attribute, and there must actually be a 'sword' Object, else an ERROR!

<game name="example_game"> // this is the special 'game' Settings Object (it's the same as, aka: it is, the 'game' Object in the GUI/Editor, actually it's the reverse, the 'game' Object in the GUI/Editor is this in code, this is what the 'game' Object in the GUI/Editor actually is/looks-like in code)
  // this special built-in 'start' Script Attribute (as a code creation tag block) (below) is 'contained within' this/the special 'game' Game Settings Object
  <attr name="start" type="script">
    msg ("Your name is: " + player.alias)
    // outputs/displays at the start of the game: Your name is: HK
    // NO error as Attributes are global
  </attr>
</game>

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

<object name="player">
  // these (built-in) Attributes (the 'parent' Object reference/pointer Attribute and the 'alias' String Attribute) are 'contained within' the default/built-in 'player' Player Object:
  <attr name="parent" type="object">room</attr>
  <attr name="alias" type="string">HK</attr>
</object>

Variables:

(these are not too often used in quest, especially by those who don't know any coding/programming, as you got to understand about them, to use them correctly and not have ERRORs)

these are local (they are temproary as they're DESTROYED once its parent scripting finishes, they can't/don't exist outside of its parent scripting, and thus they're NOT global: they are local)

in code:

NAME_OF_Variable = VALUE_OR_EXPRESSION

notice that there's no: NAME_OF_OBJECT[DOT/PERIOD]xxx = xxx

a Variable is not 'attached (the 'dot/period' part of the code)' (technically though it's doing/saying this: contained within) to an Object, whereas an Attribute is.

examples:

strength = 100 // Integer Variable
first_name = "HK" // String Variable // I used 'first_name' instead of 'alias', as this might cause an over-writing of the built-tin 'alias' String Attribute functionality of quest, and thus cause lots of issues/errors.
dead = false // Boolean Variable
handled = false // Boolean Variable
right_hand = sword // Object (reference/pointer) Variable, again the 'sword' has to be an actually existing Object, else an ERROR

<game name="example_game">
  <attr name="start" type="script">
    hi_function // this 'calls' (does/uses/runs) the 'hi_function', outputting/displaying during game play: hi, and there's NO error here
    msg (string_variable) // this 'msg' line however, CAUSES AN ERROR!!!!!!! as the 'string_variable' String Variable does NOT exist (as this is outside of its parent scripting: the 'hi_function' where the 'string_variable' String Variable does exist)  
  </attr>
</game>

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

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

<function name="hi_function">
  string_variable = "hi"
  msg (string_variable)
</function>

lastly, about Parameters (and their Arguments):

these are for Functions and Commands (and Script Attributes + Delegates, and maybe more stuff use Parameters as well, meh), but for now, let's talk about Commands, as their Parameter usage is a bit more complicated than a Function's Parameter usage:

<command name="simplest_command">
  <pattern>stats</pattern>
  <script>
    ClearScreen
    msg ("Name: " + player.alias) // example display: Name: HK
    msg ("Age: " + player.age_integer + " (" + player.age_string + ")") // example display: Age: 18 (adult)
    msg ("Sex: " + player.sex) // example display: Sex: male
    msg ("Strength: " + player.strength) // example display: Strength: 100
    // etc etc etc character information/appearance/stats
    wait {
      ClearScreen
    }
  </script>
</command>

this is the most simple Command, as you just type it's single 'activator' word: stats, during game play (in the input/command bar and hit enter), and it runs its scripts, NO Arguments (inputs) used and thus no Parameter usage


for all Commands' patterns, they MUST have unique activator word/s (first word/s), as this is how quest knows which Command to do/run

for example, which Command does quest do?
(you do NOT want to do this!)

you type-in input during game play: example

does it display 'hi' or 'bye' ???

ERROR!!! (or maybe quest is programmed to present a popup menu of the two commands and you select one)

<command name="hi_command">
  <pattern>example</pattern>
  <script>
    msg ("hi")
  </script
</command>

<command name="bye_command">
  <pattern>example</pattern>
  <script>
    msg ("bye")
  </script
</command>

about a Command's pattern's usage of Parameters:

#object# or #objectXXX#
or
#text# or #textXXX#

the hash/pound symbol tells quest and its string/input parsing that the person's typed-in input at this location in the pattern, will be stored into a Parameter of the same name (minus the hash/pound symbols)

my 'XXX' means you can extend its name as whatever you want:

but you MUST have: '#object' or '#text', first, and last: '#'

valid examples:
#text#
#text_parameter#
#text1#
#text2#
etc etc etc

#object#
#object_parameter#
#object1#
#object2#

invalid examples:

#Atext#
#teAxt#

#Aobject#
#objAect#


and then the actually Parameter used by/in the scripting would be, for example:

(you can use as many Parameters as you want, and you can use both '#object#' and '#text#' together too in your pattern)

(and you can use a semicolon, to have as many patterns as you want too, but you must start:left-most with the most complex pattern to the least complex pattern)

// examples of typed-in inputs:
mix frog with silk and honey
mix frog with silk
mix frog
mix

<command name="example_of_a_complex_command">
  <pattern>mix #object_parameter_1# with #text_parameter_1# and #object_parameter_2; mix #object_parameter_1# with #text_parameter_1#; mix #object_parameter_1#; mix</pattern>
  <script>
    // too much work for trying to come up with some realistic scripting, so instead I'm just doing the below, to show how you use the Parameters in the scripting (simple example, not dealing with handling the complex issues involved --- too much work):
    msg (object_parameter_1.alias)
    msg (text_parameter_1)
    msg (object_parameter_2.alias)
  </script>
</command>

'#text#' Pattern just stores a typed-in input as a string/text into your 'text' String Parameter

you can then see if that text/string is an existing Object (get that Object reference/pointer for use if it exists), via for example:

// using: #text_parameter#

if (HasObject (text_parameter)) {
  object_variable = GetObject (text_parameter)
  msg (object_variable.alias)
}

whereas, the #object#, will automatically check/get if your typed-in input is an existing Object (it'll check for Object's 'name' and 'alias' if it matches up with your typed-in input), BUT it'll only check the Objects in the same room as you are... so, such an Object can indeed exist, but it's not found, as it's not in the same room as you are. You got to do additional coding to look for a matching Object outside of the same room as you're in. So, for needing to check/get an Object anywhere in the game, using the '#text#' is better, as you can use the 'HasObject' and 'Getobject' Functions for this.


I'm sure I just confused you even more... I tried to explain about Commands in a very-non organized way... they're hard to explain, and need some planning/organization to explain them clearly/well.

(Pixie's post above/before this one of mine, explains all this clearly/concisely, as usual)


ask if you got any questions and/or need any help.


Wow!

Thanks so much, both of you!

If you'd like to check out the game I'm currently porting from Inform to Quest (currently available in it's Inform version), I've got it on the Game Announcements page, looking for testers.

Here's the link to the game's main page (Luis let me alter the .css, and I'm curious as to whether or not it's for the better.):
http://textadventures.co.uk/games/view/ogj8kixyx0emjknru3nckg/they-call-ya-mister

Any input at all would be greatly appreciated. E.g., is it annoying that it prints a line for every follower when they enter the location? Or does it add to the the 'mozying around in a Western' effect?

NOTE: I will probably be asking how to implement a few of the strange things I've included in this one during the port, but I'm going to go study up on everything that's been pointed out in the post and try it out myself first.

The main one I'm worrying about is reporting the followers. In Inform, it says RALPH ARRIVES FROM THE EAST when you go west with him by your side. (We'll see if I get it myself or not in 2 or 3 days.)


Thanks again!

The first few times I read the tutorial, it seemed to go from easy to advanced, but I think you just supplied me with everything I needed in between.

Best regards!


after the 'tutorial', there's still a huge gap between it and actually trying to do stuff on your own for your own game.

'XanMag' has made a 'tutorial 2' (called tutorials and templates or I got it reversed, meh, lol - not dyzlexic, just bad memory and too lazy to look it up -- well actually, I'm going to... as I need to get the link, meh... too lazy to correct it here, then, laughs, I got to always be lazy at something, lol):

http://textadventures.co.uk/forum/games/topic/5940/quest-tutorials-and-templates-published

and also 'onimike' has youtube videos, but I don't know their url off-hand (sorry)

and Pixie has a github page too, but I don't know the url off-hand (sorry)

also, there's lots of guides on the quest doc site too (most guides are Pixie's, he's a machine!), but you got to navigate/explore around it, to find them, they're everywhere on the doc site (on the main page and nested in its sub pages too, they're all over the place):

http://docs.textadventures.co.uk/quest/ (doc site's main page)

http://docs.textadventures.co.uk/quest/#Howto (more guides, within the doc site)

and also here are even more guides (its name is a bit deceptive: libraries and code samples):

http://textadventures.co.uk/forum/samples


learning to code and/or learning quest's code (transitioning from inform to quest), will not be easy (unless you're already a good programmer) and wil be slow, so just got to be patient if you are interested in it.

(just as it took you time to learn inform, it'll take some time to learn quest, but for me, quest was the easiest thing I came across in my search, lol. Maybe, I could get some help with inform... it totally scares/confuses me, so alien to me, laughs)


as for a the player-perspective question...

not sure... it's very helpful to be informed of what's going on (bad programming to leave the user in the dark about what's going on, for examples: is it meant to be happening or is this an error?, what is going on?, etc etc etc: "prompting the user")

but at the same time, seeing the same prompt over and over, becomes annoying..

ALSO, each user is different too... whereas, I'd probably get anoyed seeing the prompting every time, someone else might love it. We all have different tastes in what types of games and game designs we like. Some people might love descriptive/immersive games, and others (not so much) as they just want to play and beat the game. You can't please everyone, so it's most important to please yourself (as you're the one making the game, if you're not excited about it, you're not going to make the game, lol), though at the same time, you likely want to have others enjoy your great game (and especially so, if this is professional, as you want to get rich, lol) too. Do you make a niche but really unique and awesome game that only a few people like and/or know about, or do you make a more bland/dull game that unfortunately most people like (a "blockbuster"), as they're not as interested in unique/awesome unknown games, like you might be... sighs (talking about myself vs all the bland FPS blockbuster games, I want a wide variety of games at venues to buy from, not a mere 6 cookie-cutter "blockbuster" games that are all alike... argh!)

for your example:

I'd like to know that (and/or which npcs) the followers/party-team-members are indeed following me... but also would get annoyed seeing it every time I moved too.

there's some (code) different designs on handling this type of stuff, for a very simple example:

maybe the first time, you prompt the user of everyone individually that is following you (joe is following you. jeff is following you. etc etc etc)

but after that, you just prompt that your followers are following you (your followers follow you)

(and additionally / or instead: you can have a method to view who're your followers, letting the user control when he/she sees who his/her followers are)

infinite game/code designs... so more of an art in deciding on the best one for what you want/need and/or for the users playing your game.

always a, battle / balancing-act, between your own interests as the game maker and of users interests (simplest example: just how descriptive are you of within your game world: more descriptive = more work/time/money for you as game maker but also more enjoyable for the users/players of your game, vs less descriptive = less work/time/money for you as game maker but also not as enjoyable for users/players of your game)


these topics/discussion can be found here:

http://textadventures.co.uk/forum/design

and also check out other sites too, such as probably the 'intfiction' site (I've not really used/looked at the site yet myself but I think it has a ton on all of this type of content there, as it's one of the big sites for 'if/interactive' games) and the 'tutsplus' site too has lots of good content too, and lastly is a really great resource:

https://emshort.blog/ (see the 'interactive fiction resources' in the black menu bar at the top)

she is a professional at game making and game designing, really good articles on this type of stuff.


as for the parsing of strings/inputs, you can also use the more generalized 'regex' (regular expression) parsing syntax too (more powerful/useful than quest's 'Command' Element and/or 'HandleCommand' Function's handling of it), which I understand the basics of now (of this 'regex' stuff), but not yet got around to practicing getting used to it using it yet:

^PARSING_EXPRESSION_SYNTAX$

or something like this, Pixie has guides on this 'regex' stuff/usage.

'XanMag' also has some good knowledge/learning of this stuff too now (got it quickly from Pixie's help/guides), already passed me along on this stuff, hehe


also, I should have included this example in the previous post/s of mine:

(there's pros and cons for using '#object#' and/vs '#text#', as they're a bit different from each other in how you'd use them and/or what additional coding is needed for how they can be used for doing various things)

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

<object name="player">
  <attr name="parent" type="object">room</attr>
  <attr name="alias" type="string">Maria</attr>
  <attr name="sex" type="string">female</attr>
  <attr name="age_integer" type="int">15</attr>
  <attr name="age_string" type="string">teen</attr>
  <attr name="strength" type="int">20</attr>
</object>

<object name="bob">
  <attr name="parent" type="object">null</attr>
  <attr name="alias" type="string">bobby</attr>
  <attr name="sex" type="string">male</attr>
  <attr name="age_integer" type="int">1</attr>
  <attr name="age_string" type="string">baby</attr>
  <attr name="strength" type="int">5</attr>
</objct>

<object name="HegemonKhan">
  <attr name="parent" type="object">room</attr>
  <attr name="alias" type="string">HK</attr>
  <attr name="sex" type="string">male</attr>
  <attr name="age_integer" type="int">18</attr> // I wish I was 18.... lol
  <attr name="age_string" type="string">adult</attr>
  <attr name="strength" type="int">100</attr>
</object>

<object name="female_npc_1">
  <attr name="parent" type="object">room</attr>
  <attr name="alias" type="string">Sarah</attr>
  <attr name="sex" type="string">female</attr>
  <attr name="age_integer" type="int">10</attr>
  <attr name="age_string" type="string">child</attr>
  <attr name="strength" type="int">25</attr>
</object>

// during game play, you'd type in:
// stats HegemonKhan
// or:
// stats female_npc_1
// or:
// stats player
//
// or, I think quest is programmed to check an Object's 'alias' String Attribute for matching with the input (using the #object# Parameter for it) too:
//
// stats HK
// or:
// stats Sarah
// or:
// stats Maria
//
// or for seeing it handling a non-successul input (notice that the 'bob' Object's 'parent' Object Attribute's Value is 'null', instead of being set to 'room' like the other Objects):
//
// stats bob

<command name="dynamic_stats_command">
  <pattern>stats #object_parameter#</pattern>
  <script>
    ClearScreen
    msg ("Name: " + object_parameter.alias)
    msg ("Age: " + object_parameter.age_integer + " (" + object_parameter.age_string + ")")
    msg ("Sex: " + object_parameter.sex)
    msg ("Strength: " + object_parameter.strength)
    wait {
      ClearScreen
    }
  </script>
  <unresolved>Either: wrong input (there's no such matching Object having that as its 'name', and then also nor its 'alias' which I think quest is programmed to do for you, String Attributes, which the 'name' String Attribute is its 'ID'. Also the person's input probably is Object's 'alias' String Atribute, as that is what the person playing the game would see, as usually you use the 'name' for you as the game-maker's side/behind-the-scenes of organization and thus the person playing would never see/know it), and if quest doesn't also check the 'alias' for you, I'd need additional coding to handling the checking of if the input matches with an Object's 'alias' String Attribute, which I've not doing here) or you're just not in the same room as that Object, as that is what the use of '#object#' checks for, unfortunately</unresolved>
</command>

vs

(using this simple/static Command, in the below code box, as a matching template with the 'dynamic_stats_command' Command in the directly above code box, to show the difference between a simple/static Command and a complex/dynamic Command):

(from my previous post up a few posts, it was named as: 'simple_command' or 'simple_stats_command', meh, whatever)

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

<object name="player">
  <attr name="parent" type="object">room</attr>
  <attr name="alias" type="string">HK</attr>
  <attr name="sex" type="string">male</attr>
  <attr name="age_integer" type="int">18</attr> // I wish I was still 18, lol
  <attr name="age_string" type="string">adult</attr>
  <attr name="strength" type="int">100</attr>
</object>

// you'd type in: stats

<command name="static_stats_command">
  <pattern>stats</pattern>
  <script>
    ClearScreen
    msg ("Name: " + player.alias) // display: Name: HK
    msg ("Age: " + player.age_integer + " (" + player.age_string + ")") // display: Age: 18 (adult)
    msg ("Sex: " + player.sex) // display: Sex: male
    msg ("Strength: " + player.strength) // display: Strength: 100
    wait {
      ClearScreen
    }
  </script>
</command>

hegemonkhan,

I feel the same way you do about blockbusters. I seldom enjoy any form of 'art' that attempts to pander to the masses. (I may be mistaken, but I believe "Bro-mances" were the first films of that sort. Ugh! Everything just worsened from there. But I digress...)

I didn't mean to bash Inform in my earlier post, either. I picked up on Inform 7-ese very quickly. Their IDE is pretty sweet, too. Being able to compile to Z-machine and Glulx is also a big plus. The option to include a website is also fantastic, but that's where it becomes a little difficult to customize things.

They have a few different extensions and interpreters to choose from that will make it easier to format your text output for HTML, but I still ended up learning some HTML, CSS, and (very little) Java to make my game look like I wanted it. (Like the command prompt: I customized the Rye font so that the ">" is displayed as a revolver pointing to your command. I was about to try to learn how to create buttons that would send commands to the parser, like Draculaland and Detectiveland, then I remembered that Quest has an option for that already built-in! Anyway. . . (I digress alot.)

The Simple Followers extension in Inform 7 was written by Emily Short. (I think. I am also too lazy to conduct quick searches sometimes. She wrote the majority of the extensions, so I'm gonna be adventurous and bet that it was her.) It would be problematic to change the way the game reports the NPCs entering the location in Inform, to say the least. I was worried less about the redundancy and more about the text filling up the screen with every move.

There is a point where 4 or 5 NPCs are following you, too. And some of them can't go everywhere you can go. When this is the case, said NPC takes the most direct route possible from their location to your location. So, you may end up with:

Ralph arrives from the east.
Chainsaw arrives from the north.
Jake arrives from the west.
Your horse arrives from above.

So... I guess I won't worry about that part so much. (Although I do very much enjoy throwing a monkey wrench into the game mechanics, then learning how to fix it.)

BUT:
To implement that in Quest, I'd need something like:

Script when entering a room-->
 if (not ListContains(ScopeVisible(), Ralph)) {
  msg ("Ralph arrives from the ???" + exit.to.Ralph.parent + "???.")
  MoveObjectHere (Ralph)
}

I've been scouring the Quest documentation. performing numerous web searches with different wording, and searching through Pixie's Github documentation, but I can't find the code that references this one.

I currently have it like this: Ralph arrives from the " + Ralph.parent.name + "
I would very much like it to print the direction to the exit to the room Ralph is in from the player's location, though.

E.g., Ralph is in a room to the west of the player.

Ralph arrives from the west.

I'm thinking I need to include something like:
ralphcomesfrom = directionto.Ralph.parent
msg ("Ralph arrives from " + ralphcomesfrom + "")
MoveObjectHere (Ralph)

I found the 'followers' document, but it just generalizes "NPC follows you into the room." Some of my locations are outdoors. I know I could use IF....THENs or something for each location, but I'd like the port to match the original as much as possible.

I just can't find the proper terminology to find "the direction towards the room Ralph is in" OR "the direction I just came from".
(I think I've just read too much information in too short of a time period, and I've gone a little more crazy than normal.)

I am using Quest 5.6 in Windows 7 and Quest 5.7 in Windows 10, by the way. Just to save you from wondering whether I'm creating games online or in the app.

After this one, I (currently) have nothing else that should be too complicated to figure out on my own.

(The reason this is important to me: one of the NPCs is a traitor, and he can be spotted early if the player is watching which direction everyone is going.)


Sorry about the lengthy post!

(I've already used 90% of the information on this page in the two games I've got going on, if that's any consolation to you.)


I currently have it like this: Ralph arrives from the " + Ralph.parent.name + "
I would very much like it to print the direction to the exit to the room Ralph is in from the player's location, though.

If every exit an NPC can use has a reverse exit, you can get the exit from the current room to where Ralph came from like this:

exit = GetExitByLink (player.parent, Ralph.parent)
dir = exit.alias

Then you get use exit.alias

Otherwise, with Quest 5.7, get the exit going to the room, and then reverse it.

exit = GetExitByLink (Ralph.parent, player.parent)
dir = ReverseDirection(exit.alias)

"... more about the text filling up the screen with every move. (Richard Headkid)"

to shamelessly promote quest (lol), quest has a 'ClearScreen' Function :D

an example:

// this 'game' Object is just a special (and required) Game Settings Object (various global game setting controls and also for publishing/online of information about your game for people to look at if they want to try it or not: author, version history, category, description of/for your game, etc etc etc. Also some other stuff too, such as its special 'start' Script Attribute that I explain-about and show/use below), it's not your entire game code, but just a part of it:

<game name="example">

  // this 'game.start' Script Attribute is a special built-in Script Attribute that is the first thing done when the game begins (good for game introductions and/or character creations if doing an rpg or rpg-like game):

  <attr name="start" type="script">
    msg ("pretend introduction for the game: blah blah blah dsjdlkasjdklajsd lkjasldaslkds akljdklasjdlaks jdlkasjdlaksda lksndlkasndk lasndklasndlkn aslkdnaslkdn")

    // the 'wait' Function waits for you to press a key on the board or to click on the blue 'continue' hypertext (thus allowing you all the time to read something before the next action-s/script-s/whatever-s, which is/are nested inside of it, occurs):

    wait {
      ClearScreen // this doesn't occur until you press a key on keyboard or click on the 'blue continue' hypertext
    }

  </attr>

</game>

A-ha! GetExitByLink!

Thanks, Pixie!

Wait. . .

I'm probably not putting the code in the correct place.

In Build 5.7.6304.23532, I've got this:

Script when entering a room-->
if (not ListContains(ScopeVisible(), Ralph)) {
  exit = GetExitByLink (Ralph.parent, player.parent)
  dir = ReverseDirection(exit.alias)
  msg ("Ralph arrives from the " + exit.alias + ".")
  MoveObjectHere (Ralph)
}

.
Which produces this:

Error running script: Error compiling expression 'ReverseDirection(exit.alias)': Variable does not refer to an object: 'exit'


Wait. . . I found GetExitByLink on the Functions page, which also listed GetObject. . . and . . .

It works after a slight tweak:

if (not ListContains(ScopeVisible(), Ralph)) {
  exit = GetExitByLink (player.parent, Ralph.parent)
  dir = GetObject (exit)
msg ("Ralph {random:arrives:mozies in:follows you} from the " + dir.alias + ".")
  MoveObjectHere (Ralph)
}

> go north
Top of the Hill
You can see The Harbinger.
You can go south or north.
Ralph arrives from the south.

Thanks so much, everyone!


to shamelessly promote quest (lol), quest has a 'ClearScreen' Function

This reminds me. Is there a command that will allow the player to save a transcript of game-play?

I had it set up to clear the screen after "big events", but I noticed there was no (obvious) way for the player to scroll back up to see what they just missed, so I (temporarily) removed them all.

(Sorry. I promise I'm not nitpicking you here. I truly forgot to ask that earlier. All searches for TRANSCRIPT lead to information about scripts.)


Pixie is a great help (most of the quest guides/code-help are Pixie's, lol. He's a machine and is very clear and concise, the opposite of my failed attempts at helping people, often just confusing them more, sighs), as this stuff was beyond my ability, laughs. Well, not so much ability (I don't think anyways), but knowledge of what quest has built-in for you to use and/or how you use it. I still got to at some point get more familiar with everything quest has built-in and how to use it properly.


unfortunately, nothing currently built-in, though Pixie may be adding it with his new version of quest (Alex moved on - as he has been developing his quest project for like about 10 years now, and luckily we got a new team continuing quest's development/existence, and Pixie is working on developing quest further, Manowar is handling the online/servers/publishing of games, and I don't know if there's any other possible positions/roles and/or who's filling them in)


however... ignore the above, because:

Pixie does have code that handles saving for offline/desktop usage... not sure where to find it at (he was helping 'anonynn' with it/saving for her game, just to be warned: it's an adult game: apocalypsemorphia or something like this... kinda close... lol: http://textadventures.co.uk/forum/games/topic/5423/apocamorphosis , but the thread/post on the saving might be within this main discussion forum we're in now, or elsewhere too, meh), so you can just ask Pixie, as he likely knows where his saving code is at and/or can provide it to you.


hegemonkhan,

Everything you've posted has helped me out tremendously!

To be fair, I believe I should also point out that I've asked how to do at least three different things in this one crash-course of a post, and I've learned how to do more than twenty things!

(I just hope the game ends up being enjoyable enough to balance out all the help I've received from everyone here!)


I think this is Pixie's saving code:

http://textadventures.co.uk/forum/samples/topic/6404/a-step-towards-an-alternative-save-game-system

best of luck with understanding it (now this stuff, IS way beyond me!), or just ask Pixie to help you out with it :D


I think this is Pixie's saving code:

http://textadventures.co.uk/forum/samples/topic/6404/a-step-towards-an-alternative-save-game-system

best of luck with understanding it (now this stuff, IS way beyond me!), or just ask Pixie to help you out with it :D

Have you ever seen Scanners?

Spoiler regarding the movie Scanners Because my head just exploded, just like at the end of that film!

But seriously, folks:

I was looking for a way to "print the story transcript" to a file, like you can in the Infocom games, but I believe I read (somewhere in the documentation) that Quest can't save to an external file, so I bet piping the STDOUT of the game to a .txt file is currently impossible.


I'm really liking Quest 5.7, by the way!

It has many nice additions!


I asked about transcripts myself many years ago. I have a feeling Alex did do something where by you could ask him to save transcripts while you were beta testing, but I can see no sign of it in code. Quest can save to an external file in the desktop version, so it is possible. I will consider it for Quest 5.8.


Pixie,

No problem. Just wanted to make sure I wasn't overlooking something.

As long as the screen doesn't get cleared, I can just copy and paste to my text editor, so it's no big deal.


Kudos on the 5.7 update, by the way!


no, never seen scanners, I presume it's a movie? or is it a tv series/show?


Scanners is a terrible movie from the eighties.

Save yourself from 90 minutes of boredom and just click the spoiler link above. (Nothing else worthwhile happens in the film.)

The scene is used quite frequently in my neck of the woods to reference information overload.


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

Support

Forums