What's wrong with my switch command?

I'm working my way through the tutorial and trying to make my say #text_talk# to #object_one# command work with a switch, but it isn't working no matter what I try.

My script for object_one is a case key of television (a test object) and the script is "You say: " + text_talk / Print "The actors can't hear you.", which seems to be exactly what the tutorial suggests.

This gives the error:
Error running script: Error compiling expression '"You say: " + text_talk / Print "The actors can't hear you."': Unknown object or variable 'Print'

Can anyone explain where I'm going wrong?


Hello.

Sorry, it's been a while since I ventured through the tutorial. I just tried to find where you are in it, but I gave up after a couple of minutes.

If you post the link to the page you're on, we can probably get you fixed up.


The "Print" command in the GUI is actually msg when you look at it in code view, but from the error message it looks like you've included "Print" literally in the code.

From the error message, I'm guessing you've got code looking something like:

msg ("You say: " + text_talk / Print "The actors can't hear you.")

Maybe you've got one line where it should be two?

So that would be:

msg ("You say: " + text_talk)
msg ("The actors can't hear you.")

This is the bit I'm on in the tutorial, the Additional Example (Advanced): http://docs.textadventures.co.uk/quest/tutorial/custom_commands.html

@mrangel is right, that's what the code was looking like, but editing in code view just made it error.

I thought maybe it was because it needed a second + in the expression after text_talk but it didn't understand that either.

Really all I need to know is how these switch commands work, what the formatting is. Is the tutorial possibly a little out of date from a screenshot perspective, maybe?


The tutorial is still correct.
You must be aware that the script editor in which you click together the scripts does not display the lines of code that Quest processes.
For example, the editor displaysPrint “You say”. However, the correct Quest code for this is msg(“You Say”). You can also see this if you go to the code view. You must therefore also enter the correct code in the code view. If you enter Print “You say” in the code view, Quest can no longer translate it back for the script editor.

Here is a link to the documentation of switch:

https://docs.textadventures.co.uk/quest/multiple_choices___using_a_switch_script.html


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

Support

Forums