Page 1 of 1

Variable in Say line?

Posted: Thu Jan 26, 2017 5:09 pm
by Knight Captain
How do I avoid this error when using a variable for an NPC's name in a say line/
Compiling Usecode...
items/oracle.uc:87: 'is' not declared
items/oracle.uc:87: syntax error, unexpected IDENTIFIER, expecting ')'
There were error(s) compiling usecode!
The offending line is:
say("@", defendant ", is innocent! ", playername ", and ", pronoun ", companions have no wish to destroy Beauty!@");

Re: Variable in Say line?

Posted: Thu Jan 26, 2017 5:10 pm
by Knight Captain
This is the correct error:
Compiling Usecode...
items/oracle.uc:87: syntax error, unexpected STRING_LITERAL, expecting ')'
There were error(s) compiling usecode!

Re: Variable in Say line?

Posted: Thu Jan 26, 2017 10:15 pm
by marzo
Spot the differences:
say("@", defendant ", is innocent! ", playername ", and ", pronoun ", companions have no wish to destroy Beauty!@");
say("@", defendant, " is innocent! ", playername, " and ", pronoun, " companions have no wish to destroy Beauty!@");

Re: Variable in Say line?

Posted: Thu Jan 26, 2017 11:12 pm
by Knight Captain
This is what happens when I code without coffee.

Re: Variable in Say line?

Posted: Fri Jan 27, 2017 1:19 am
by marzo
This is what happens to anyone coding without coffee :-)