Line break in random text
m4u
28 Nov 2013, 02:35Here is another one:
I created random answers when taking an object using "Random:text:text" in the inventory tab of the object, but it keeps showing a line break when I type the command "Get all", like this:
thing 1: You take it.
thing 2:
You can't take it (ramdom text)
Instead of
thing 2: You can't take it
How to remove it?
Thanks guys for your patience and help!
I created random answers when taking an object using "Random:text:text" in the inventory tab of the object, but it keeps showing a line break when I type the command "Get all", like this:
thing 1: You take it.
thing 2:
You can't take it (ramdom text)
Instead of
thing 2: You can't take it
How to remove it?
Thanks guys for your patience and help!
The Pixie
28 Nov 2013, 10:15The problem is not the random text as such, as that you are using a script. Quest creates a prefix, "thing 1: ". If the object has a message, it adds that message to the prefix, then prints the lot, so it goes on one line. If the object has a script instead, it prints the prefix on one line, then runs the script. Your script then has its own "msg" command, where it prints your text on its own line.
One way to solve it would be to copy the DoTake function to your game, and replace this:
With this:
Then for each object that you have a script for taking, add another script called "takemultiple", which does the same, except the message has "thing 2: " at the start.
One way to solve it would be to copy the DoTake function to your game, and replace this:
case ("script") {
if (ismultiple) {
msg (prefix)
}
do (object, "take")
takemsg = ""
}
With this:
case ("script") {
if (ismultiple) {
do (object, "takemultiple")
}
else {
do (object, "take")
}
takemsg = ""
}
Then for each object that you have a script for taking, add another script called "takemultiple", which does the same, except the message has "thing 2: " at the start.
m4u
28 Nov 2013, 15:46Then for each object that you have a script for taking, add another script called "takemultiple", which does the same, except the message has "thing 2: " at the start.
I don't know what you mean by that, Jay...
The Pixie
28 Nov 2013, 16:06For each object, go to the attributes tab. In the low half, all the attributes are listed. One will be called "take", and will be a script. You need to add another called "takemultiple", set it to be a script, and then make the script do the same stuff as take (the easy way to do that is to click on the code view for the script, copy the text, and paste it into the new script).
m4u
28 Nov 2013, 16:39Yeah, no, I did that and I'm getting this error:
Error running script: Error compiling expression 'object': Unknown object or variable 'object'
Error running script: Error compiling expression 'object': Unknown object or variable 'object'
m4u
28 Nov 2013, 16:42Never mind that, I was doing it wrong. I tried again and now im getting the right message but without the "thing 1:"

Pertex
28 Nov 2013, 20:46You could also import the DoTake function into your game and change it this way
old:
new:
old:
...
switch (TypeOf(object, "take")) {
case ("script") {
if (ismultiple) {
msg (prefix)
}
do (object, "take")
takemsg = ""
}
...
new:
...
switch (TypeOf(object, "take")) {
case ("script") {
if (ismultiple) {
OutputTextNoBr (prefix)
}
do (object, "take")
takemsg = ""
}
...