Variable in Say line?

NOTICE: This forum is archived as read only.
Please use the Github Discussions at https://github.com/exult/exult/discussions
Forum rules
NOTICE: This forum is archived as read only.
Please use the Github Discussions at https://github.com/exult/exult/discussions
Locked
Knight Captain
Posts: 1219
Joined: Thu May 14, 2020 1:34 pm

Variable in Say line?

Post 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!@");
Knight Captain
Posts: 1219
Joined: Thu May 14, 2020 1:34 pm

Re: Variable in Say line?

Post 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!
marzo
Site Admin
Posts: 1925
Joined: Thu May 14, 2020 1:34 pm

Re: Variable in Say line?

Post 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!@");
------
Marzo Sette Torres Junior
aka Geometrodynamic Dragon
[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
Knight Captain
Posts: 1219
Joined: Thu May 14, 2020 1:34 pm

Re: Variable in Say line?

Post by Knight Captain »

This is what happens when I code without coffee.
marzo
Site Admin
Posts: 1925
Joined: Thu May 14, 2020 1:34 pm

Re: Variable in Say line?

Post by marzo »

This is what happens to anyone coding without coffee :-)
------
Marzo Sette Torres Junior
aka Geometrodynamic Dragon
[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
Locked