spaces in text

guzmere
Hi all sorry to bother you again, Just hopefully an easy question. When you type in a description in quest is there any way to create a space in the front of the text line.
For example if I wanted to type
"_____________I can see forever in the distance"
when you run the game you get.
"I can see forever in the distance"
P.S. The underscore represents the spaces
The game seems to ignore the spaces, is there any way round this. I have tried putting a load of dots in front but it doesn't look right. Thanking you all in advance. Terry :D :D :D :D

The Pixie
The problem is that Quest uses an HTML output, and the rule in HTML is to collapse all white space (spaces, tabs and returns) into a single space.

The only way I found was to get around that is to write something in the background colour. So you might Print somethng like this (assuming your background is white):
" <color color=\"white\">- - -</color> Here is my indented paragraph"

guzmere
Hi Pixie thanks for that I'll try it that way, that makes perfect sense. I never thought of it like that. :D :D :D :D and one for good luck :D Terry

sgreig
Yeah, that's exactly what I had to do for the little hangman demo game I was working on. In order to get the hangman image to display correctly I had to use "." to fill in the spaces. I just made them the same colour as the background.

guzmere
It always amazes me that the world is tearing itself apart with wars and conflicts due to either religion or greed or hatred, and yet at the opposite end of the scale there are people from all over the globe who have never seen one another or know what the person is like and yet they are still willing to put themselves out to help others. Thanks to all of you for the answers I have been seeking and thanks to Alex for making this possible. :D :D :D :D :D :D :D :D Terry
P.S. You solution works great Pixie thanks :D :D
Hello Sgreig

Pertex
:D There is a easy way to do it. Add a bold tag. All spaces in this tag will be printed:
msg ("test<b>         </b>test")


Here is a function to add some spaces

  <function name="whitespaces" parameters="number" type="string">
<![CDATA[
text=""
for (x, 1, number) {
text = text+ " "
}
return ("<b>"+text+"</b>")
]]>
</function>

guzmere
Hi Pertex hope you are ok and well. I have tried your coding and it tells me that
Invalid XML:'Element is an invalid XMLNode Type. Thanks Terry :D :D :D :D

The Pixie
Pertex, why does that work? It is not proper HTML behaviour; is there something coded into Quest to cause this effect?

Pertex
guzmere wrote:Hi Pertex hope you are ok and well. I have tried your coding and it tells me that
Invalid XML:'Element is an invalid XMLNode Type. Thanks Terry :D :D :D :D

Did you use the first code? Then you have to surround your code with <![CDATA[ and ]]> like in my second code example.

The Pixie wrote:Pertex, why does that work? It is not proper HTML behaviour; is there something coded into Quest to cause this effect?

I don't know it exactly but you can only use some htlm tags in Quest like <br/>, <b> or <color> so I think there is a special coding for these tags

guzmere
Hi Pertex I really am sorry to bother you again but how would you implement this together into a game, say for instance I wanted to say something like "the hole is deep and wide and dark" how would i code that in with about 10 spaces in front.Hope I make myself clear. For it keeps giving me error codes. Thanks Terry :D :D :D :D

Pertex
Here it is. I added the function whitespaces and called it in the game start script

guzmere
Hi Pertex you are an absolute cracker, That is superb I finally got it going after so many spelling mistakes or syntax errors. Once again I am indebted to you sir. Thanks to The Pixie and Sgreig as well. Thanking you. Terry :D :D :D :D and two for the effort you put into all the posts for various people :D :D :D :D :D :D :D :D :D :D

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

Support

Forums