Can I do this? Text Processor within String Lists

I'm dabbling with string lists for random stuff and flavor, and also to learn more about how code works . the idea I have is to have a big of ambiance trigger every minute or so using a timer. Simple enough with this code.

game.text_processor_this = this 
environment.sound = PickOneStr (environment effects)
msg ("<B>{environment.sound}</B>")

This is simple enough, works fine , however I'm also trying to use the string lists to reference where the event is occurring.. something like this is one of the string list entries.

A gentle breeze is blowing through the {this.alias}
or
A gentle breeze is blowing through the {player.parent.alias}

When tried out the code just ignores any of the text processing done in the string list itself

Am I trying to do something far to complex for a very minor aspect of my project

Thank you Talon


EDIT: I think this might be wrong. I glanced through the text processor code and didn't see where it would recurse into included strings, but I think that's done by ProcessTextSection. So there could be another error here, that I've missed because I wasn't following your explanation clearly.

The text processor runs when a string is sent to the frontend. That is, when you run the msg command with it.

this.alias should work properly, as long as the text_processor_this actually has an alias.

Do you mean one of the elements in your stringlist contains text processor directives? In that case, you may need to run ProcessText manually.

If environment.sound is set to A gentle breeze is blowing through the {this.alias} then Quest would process it like this:

  • message = "<b>{environment.sound}</b>" - the message is now <b>{environment.sound}</b>
  • message = ProcessText (message) - the message variable is now <b>A gentle breeze is blowing through the {this.alias}</b>
  • message = ProcessText (message) - the message variable is now <b>A gentle breeze is blowing through the fields</b>

Running msg calls ProcessText once only. You could run it again if you want that to work. Or build the string manually.
So the last line could be:

msg (ProcessText("<B>{environment.sound}</B>"))

or

msg ("<B>" + environment.sound + "</B>")

then it should work, because the string passed to the text processor is the one you want.


Log in to post a reply.

Support

Forums