Extending the Text Processor

I have created a library that expands the functionality of the Text Processor. The documentation is here (curerently the same as this post, but that web page will get updated if the library changes significantly):
https://github.com/ThePix/quest/wiki/Library:-Text-Processor-Plus

The library is here:
TextProcessorPlus

Let me know if there are issues.

either

Use "either" instead of "if" when you also have text for when the condition is false. Here is an example. If game.weather is over 5 the player is told it is sunny, otherwise she is told it is cloudy.

  You look up at the sky. It is {either game.weather > 5:sunny:cloudy}.
  The player is {either player.male:male:female}.
  Where is the ball? {either ball.parent=player:The player has it:The player is looking everywhere}!

Note that you cannot have additional text processor commands inside an either section.

eval

Use eval to display the result of a Quest expression. This could be the return value of a function, a calculation, etc.

  You look up at the sky. {eval:WeatherDescription()}
  Your health is {eval:GetHealth()}.
  Your progress is {eval:100 * GetScore() / 312}%.
  Hi, {eval:CapFirst(\"mary\")}

The expression must return a value, you will get an error otherwise. If the expression has double quotes, you will need to escape them (place a backslash before each one), as shown in the last example.

colour

You can use colour to display the text in a different colour (you can also use color if you prefer that spelling). You back to change the background colour (highlighting).

  Some {back:red:text of a red background} here.
  This text {colour:red:is in red}!
  Some text in {color:green:green} even with funny US spelling.
  Now text {back:red:{color:yellow:in yellow on red}} by nesting.

popup

Text inside a popup section will appear in blue. If the player clicks it, a popup box will appear showing the rest of the text. The popup can be hidden by clicking it.

In this example, it is used to explain an obscure term.

  Across the street there is a {popup:TeleMat booth:TeleMat booths offer instant travel around the world; just step inside, type in your destination, and you will be instantly teleported there.}.

Clothing

You can use this in conjuction with my ClothingLib, and get two extra functions. Note that this library must be above ClothingLib in the list. Three new directives are available.

bare: This text is only seen if the given body part is exposed.

covered: This text is only seen if the given body part is covered.

covering: Shows the outermost garment covering this body part.

Here are some examples:

  Your legs are {bare:legs:exposed}{covered:legs:properly covered}.
  On your chest, you are wearing {covering:chest}, and on your legs {covering:legs}.

Note that you can supply an NPC name, and have the text depend on what he or she is wearing, rather than the player.

  Mary's legs are {bare:mary:legs:exposed}{covered:mary:legs:properly covered}.
  On her chest, Mary is wearing {covering:mary:chest}, and on her legs {covering:mary:legs}.

Note that you cannot have additional text processor commands inside any clothing sections.


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

Support

Forums