When I watched the documentary on Text Adventure games, something stuck in my mind. The blind person who had said that their response to being told by the game that the room was dark was "so?" They wondered why sighted people made the game so that dark rooms meant you couldn't do anything at all.
Soooo... I've been experimenting with trying to make some things "do-able" in the dark: Here's what I have so far, and wondered if anyone else has thought of this and/or wanted to help improve it?
<!--
Command allows player to feel the objects in the room randomly as if groping in the dark.
-->
<command name="DarkFeel">
<pattern>feel</pattern>
<script>
if (game.pov.parent.dark = True) {
do (PickOneChild (game.pov.parent), "darkfeel")
}
else {
msg ("When you're not in the dark, you can just tell me what it is you want to feel....")
}
</script>
</command>
<!--
Works on an exit to allow the player to leave a dark room after finding it.
-->
<darkfeel type="script">
this = this
msg ("You can feel the rungs of what must be the ladder.")
msg ("Do you want to climb out of here?")
get input {
if (result = "yes") {
msg (this.message)
MoveObject (game.pov, this.to)
}
else {
msg ("ok then, stay here in the dark.")
}
}
</darkfeel>
<!--
Works to allow player to do most typical things.
-->
<darkfeel type="script">
msg ("It feels like object2")
msg ("What do you want to do with it?")
get input {
if (result = "get") {
do (this, "takemsg")
AddToInventory (this)
}
else if (result = "open") {
do (this, "openscript")
}
else if (result = "close") {
do (this, "closescript")
}
else if (result = "switch on") {
do (this, "turnon")
do (this, "switchonmsg")
this.switchedon = True
}
else if (result = "switch off") {
do (this, "turnoff")
do (this, "switchoffmsg")
this.switchedon = False
}
else if (result = "wear") {
do (this, "wearmsg")
this.worn = True
}
else if (result = "remove") {
do (this, "removemsg")
this.worn = False
}
else if (result = "take") {
do (this, "takemsg")
AddToInventory (this)
}
else if (result = "use") {
do (this, "use")
}
else if (result = "eat") {
do (this, "eat")
}
else if (result = "stand") {
do (this, "stand")
}
else if (result = "sit") {
do (this, "sit")
}
else if (result = "recline") {
do (this, "recline")
}
else if (result = "smell") {
do (this, "smell")
}
else if (result = "taste") {
do (this, "tastedesc")
}
else {
msg ("I'm not sure you can do that in the dark.")
}
}
</darkfeel>
It uses an attribute called "darkfeel" to store the script for what you'd like to have happen when a player does manage to find an object by typing "feel" in the dark.
I couldn't figure out how to make the initial command pick from both random objects and random exits in the room at the same time and just give one that you "found" in the dark.
It could be easy to put a grue in there to eat them in the dark, or have them stub toes, knock stuff over, etc. But I also found that if I give them a choice what they want to try and do with the found object, I can't test for whether the object has the script that makes that choice do-able, so I just made it "do" as if it were possible.
Discovered an error if the darkfeel attribute doesn't exist, obviously.
So in order to test for it, I amended the command:
<command name="DarkFeel">
<pattern>feel</pattern>
<script>
o = PickOneChild (game.pov.parent)
if (game.pov.parent.dark = True) {
if (HasAttribute(o, "darkfeel")) {
do (o, "darkfeel")
}
else {
msg ("You touch something in the dark, but can't tell what it is by feeling it.")
}
}
else {
msg ("When you can see the objects around you, you can just tell me what you'd like to feel.")
}
</script>
</command>
Ok, after these several days, I've been able to figure out a few things and make this work better.
The result is a simple library called DarkactionsLib.aslx
It's a command "DarkFeel" allowing the player to type "feel" in order to encounter a random object in the dark.
The command reads "darkfeel" script attribute on an object, so you can add that to any object to do anything you like once something's been found.
There's a function "dowhatdarkobject" with parameter "this" which can be part of the "darkfeel" script and would allow the player to do most common actions.
It's designed to work if Pixie's CombatLib and PostureLib are installed in your game, but if you're not using them, simply delete the "kill/attack/fight", "sit", "stand", and "recline" portions of the dowhatdarkobject function from the library.
It's my first library which isn't merely a modification of someone else's!
There's a tiny sample example here https://textadventures.co.uk/games/view/d8dwvqqdi0oo15ivkodomg/darkactionslibtest
and the library looks like this:
<?xml version="1.0"?>
<library>
<!--
****************************************************************************************************
DarkactionsLib.aslx - Inspired by the blind... allows you to feel around in the dark and interact with objects.
by IpMan, 2023
Version 1.0
****************************************************************************************************
Quest-Version: 5.8
**Is Designed to incorporate actions from Pixie's CombatLib and PostureLib!! That documentation applies.
If you don't use them, delete the portions of dowhatdarkobject function that include:
attack, sit, stand, recline**
****************************************************************************************************
-->
<!--
DarkFeel Command allows player to feel the objects in the room randomly as if groping in the dark.
It doesn't find exits, so you'll need to get creative to allow a player to leave a dark room.
You must have a script "darkfeel" on an object in order for this library to work.
-->
<command name="DarkFeel">
<pattern>feel</pattern>
<script>
o = PickOneChild (game.pov.parent)
if (game.pov.parent.dark = True) {
if (HasAttribute(o, "darkfeel")) {
do (o, "darkfeel")
}
else {
msg ("You touch something in the dark, but can't tell what it is by feeling it.")
}
}
else {
msg ("When you can see the objects around you, you can just tell me what you'd like to feel.")
}
</script>
</command>
<!--
This sample script works on an exit to allow the player to leave a dark room after finding it.
<darkfeel type="script">
this = this
msg ("Do you want use this exit to get out of here?")
get input {
if (result = "yes") {
msg (this.message)
MoveObject (game.pov, this.to)
}
else {
msg ("ok then, stay here in the dark.")
}
}
</darkfeel>
-->
<!--
dowhatdarkobjects function works to allow player to do most typical things.
Call it on your object and name specify "this" as the parameter.
Could be used to activate the darkfeel script on an object other than this one by specifying that object name as the parameter.
-->
<function name="dowhatdarkobject" parameters="this">
msg ("What do you want to do with it?")
get input {
if (result = "get") {
if (GetBoolean(this, "take")) {
AddToInventory (this)
if (HasAttribute(this, "takemsg")) {
msg (this.takemsg)
}
else {
msg ("You take it.")
}
if (HasAttribute(this, "ontake")) {
do (this, "ontake")
}
else {
}
}
else {
msg ("It doesn't feel like something you can get.")
}
}
else if (result = "open") {
if ((DoesInherit (this, "openable"))) {
if (GetBoolean(this, "isopen")) {
msg ("It's already opened.")
}
else {
SetObjectFlagOn (this, "isopen")
do (this, "openscript")
}
}
else if ((DoesInherit (this, "container_open"))) {
if (GetBoolean(this, "isopen")) {
msg ("It's already opened.")
}
else {
msg (this.openmsg)
SetObjectFlagOn (this, "isopen")
}
}
else {
msg ("It doesn't feel like you can open it.")
}
}
else if (result = "close") {
if ((DoesInherit (this, "openable"))) {
if (GetBoolean(this, "isopen")) {
SetObjectFlagOff (this, "isopen")
do (this, "closescript")
}
else {
msg ("It's already closed")
}
}
else if ((DoesInherit (this, "container_open"))) {
if (GetBoolean(this, "isopen")) {
msg (this.closemsg)
SetObjectFlagOff (this, "isopen")
}
else {
msg ("It's already closed.")
}
}
else {
msg ("It doesn't feel like you can close it.")
}
}
else if (result = "switch on") {
if ((DoesInherit (this, "switchable"))) {
msg (this.switchonmsg)
this.switchedon = True
}
else {
msg ("It doesn't feel like you can switch this on.")
}
}
else if (result = "switch off") {
if ((DoesInherit (this, "switchable"))) {
msg (this.switchoffmsg)
this.switchedon = False
}
else {
msg ("It doesn't feel like you can turn this off.")
}
}
else if (result = "wear") {
if ((DoesInherit (this, "wearable"))) {
msg ("You'll have to get it to wear it...")
}
else {
msg ("It doesn't feel like you can wear it.")
}
}
else if (result = "take") {
if (GetBoolean(this, "take")) {
AddToInventory (this)
if (HasAttribute(this, "takemsg")) {
msg (this.takemsg)
}
else {
msg ("You take it.")
}
if (HasAttribute(this, "ontake")) {
do (this, "ontake")
}
else {
}
}
else {
msg ("It doesn't feel like something you can take.")
}
}
else if (result = "use") {
if (HasAttribute(this, "use")) {
do (this, "use")
}
else {
msg ("You can't feel how to use it.")
}
}
else if (result = "eat") {
if ((DoesInherit (this, "edible"))) {
do (this, "eat")
}
else {
msg ("It doesn't feel like something you should eat.")
}
}
else if (result = "stand") {
if ((DoesInherit (this, "furniture_type"))) {
do (this, "stand")
}
else {
msg ("It doesn't feel like something you can stand on.")
}
}
else if (result = "sit") {
if ((DoesInherit (this, "furniture_type"))) {
do (this, "sit")
}
else {
msg ("It doesn't feel like something you can sit on.")
}
}
else if (result = "recline") {
if ((DoesInherit (this, "furniture_type"))) {
do (this, "recline")
}
else {
msg ("It doesn't feel like you can lounge on it.")
}
}
else if (result = "smell") {
if (HasAttribute(this, "smell")) {
do (this, "smell")
}
else {
msg ("You can't really smell anything distinctive about it.")
}
}
else if (result = "taste") {
if (HasAttribute(this, "tastedesc")) {
do (this, "tastedesc")
}
else {
msg ("It tastes like you'd imagined.")
}
}
else if (result = "kill") {
if (HasAttribute(this, "attack")) {
do (this, "attack")
}
else {
msg ("It doesn't feel like something you can really fight with.")
}
}
else if (result = "attack") {
if (HasAttribute(this, "attack")) {
do (this, "attack")
}
else {
msg ("It doesn't feel like something you can really fight with.")
}
}
else if (result = "fight") {
if (HasAttribute(this, "attack")) {
do (this, "attack")
}
else {
msg ("It doesn't feel like something you can really fight with.")
}
}
else {
msg ("I'm not sure you can do that in the dark.")
}
}
</function>
</library>
Here's hoping that it's interesting or helpful for someone. Maybe someday someone else, or I might refine and perfect it.