I broke quest.

Hey everyone,

I was using the examples from http://docs.textadventures.co.uk/quest/advanced_scope.html
Basically to make the trivial scenery have some value in the game, as one player who inevitably will always "Examine wall...", I got all the code in and working even to the extent of having it respond to what I was looking at and replying accordingly using the this.article and/or this.name

I think I may have got a little adventurous (forgive the pun) and decide to make the responses a little more random. It didn't work... :(

Long story short, this crashes Quest when trying to print random responses:

msg({random:{this.name}})

What did I do?

regards as always,
-=Darchy=-


I don't know if this will work or not:

msg({rndalt:this})

That should (hopefully) give a random alt name for the object. Otherwise, you broke it, you pay Pixie for it : )


K.V.
game.text_processor_this = this
msg("{rndalt:this}")

...or:

s = PickOneString(this.alt)
msg (s)

Hahaha - If that is the case, I would owe Pixie LOADS of gold!!!

Sorry Dcoder, it seems I left some of the post off. using this.name and this.article returns my input correctly, what my post didn't show was this also:

msg({random:"The " + {this.name} + " is nothing special.":You look at {this.article} + ", it is just scenery."})

So if I looked at a tree is should print 1 of 2 random responses:

The tree is nothing special.
or
You look at it, it is just scenery.

It just crashes Quest.

-=Darchy=-


Sorry K.V I missed your post. I just updated my last post with something I had omitted.

-=Darchy=-


K.V.

Try this:

msg("{random:The " + this.name + " is nothing special.:You look at " + this.article + ", it is just scenery."})
msg("{random:The " + this.name + " is nothing special.:You look at " + this.article + ", it is just scenery.}")

It throws this error up K.V, but no crash at least:

You are in a room.
type x test

> x test
Error running script: Error compiling expression '"You look at " + this.article + ", it is just scenery."': SyntaxError: Unexpected character: }Line: 1, Column: 122

Sorted!!! the quotes at the end were in wrong place. swapped the " and } around.

This works:

msg("{random:The " + this.name + " is nothing special.:You look at " + this.article + ", it is just scenery.}")

Thanks for response guys!

-=Darchy=-


Yeah, the text processor's squiggly brackets are a bit confusing when it comes to placing the quotes. That text processor code is considered part of the text (so goes in quotes) even though it doesn't actually display.


@Dcoder - I find this is always my cause of confusion. I have been using Quest since around August of last year and you can guarantee it will be brackets or quotes. I have since learned about the \ and ' - making code easier to debug. If it wasn't for you chaps/esses on here I don't think I would have continued my story to get as far as I have.

-=Darchy=-


the syntax of/for nesting some scripting (like this thread is about: text processor commands + VARIABLES + TEXT) stuff, can be quite confusing... lol.


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

Support

Forums