Start a new message without starting a new line?

Eaten By A Grue
Hi all, I'm pretty new here and have been working on a text adventure which I'm hoping to get into some kinda of fit shape to share one of the these days. There's a lot of stuff I'm still puzzling out, but one question I had in particular was -- is it possible to assemble a paragraph out of messages without starting a new line? I'm making a character who can change between two outfits, get damaged in various (purely cosmetic) ways throughout the game, and can be at various hunger levels, all of which I've done by breaking 'look' down into pieces, setting flags, etc. I'd like to be able to say some thing like 'You are wearing slacks, a cardigan and boots. You are suffering from scratches, have a nasty bruise, are a little hungry, and have no idea what's coming next.'

However, the way I have it set up, the out put is:

You are wearing slack, a cardigan and boots.

You are
suffering from scratches,
have a nasty bruise,
are a little hungry.
and have no idea what's coming next.

The game is still perfectly playable, but it'd look a lot nicer if I could make it a solid paragraph. Is there any way to do that?

HegemonKhan
just write out your message, just as if you were writing a school paper. 'enter' goes to a new line and 'space bar' moves a space over, without going to a new line. etc etc etc. the only difference is if you want to code in code things along with just the text.

msg ("You are wearing slacks, a cardigan and boots. You are suffering from scratches, have a nasty bruise, are a little hungry, and have no idea what's coming next.")

output:

You are wearing slacks, a cardigan and boots. You are suffering from scratches, have a nasty bruise, are a little hungry, and have no idea what's coming next.

Eaten By A Grue
Yeah, the issue is that all of those parts can change depending on what's going on in the game, so it can't be a simple message. So in the example I gave, the message is really "(You are wearing a cardigan, slack and boots.) You are (suffering from scratches,)( have a nasty bruise,)( are a little hungry,) and have no idea what's going to happen next" -- everything in parantheses is something that can change. Like, you start off ( in perfect health), and if anything happens, it deactivates the 'perfect health' flag and adds a new status flag, so you can end up with quite a chain of them at the end. The clothes can vary between two options and the hunger level can vary between seven levels. I'm just curious if there's a way to construct the message so that it'll all run together smoothly. It's not a major problem if not, but it'll look nicer that way!

HegemonKhan
in the GUI~Editor:

run as script -> add a script -> output (or whatever it's category name) -> print a message -> [EXPRESSION] -> (see below)

or, in code:

the 'trick~rule' is to break it down in chunks:

text
" + Object.Attribute + "

and~or

"text"
+ Object.Attribute +

also, there must be an equal number of total quotes too.

so, for an example:

(in playing a game, after I finish a character creation function at the start of the game)
player.alias = "HK"
player.age_integer = 18 // (I wish, lol)
player.age_string = "adult"
player.gender_string = "male"
player.race_string = "european"
player.species_string = "human"
player.class_string = "warrrior"
output of the 'msg' Script below: HK is a 18 year old adult male european human warrior.
('game.pov' references whoever is your currently controlled Player Object, be it the default "player" Player Object or a custom:self-made Player Object)

msg (game.pov.alias + " is a " + game.pov.age_integer + " year old " + game.pov.age_string + " " + game.pov.gender_string + " " + game.pov.race_string + " " + game.pov.species_string + " " + game.pov.class_string + ".")


the 'chunks' :

game.pov.alias +
" is a "
+ game.pov.age_integer +
" year old "
+ game.pov.age_string +
" (space) "
+ game.pov.gender_string +
" (space) "
+ game.pov.race_string +
" (space) "
+ game.pov.species_string +
" (space) "
+ game.pov.class_string +
"."

-------

make sure that your Attributes (Object.Attribute) in your 'msg' Script exist (were created~added to your Object), as you can't act (which is what a Script does) upon something, if that something (your Attributes) doesn't exist, obviously.

to create (add) Attributes to an Object (in the GUI~Editor):

(whatever) Object -> Attributes (tab) -> Attributes -> Add ->

Attribute Name: _______
Attribute Type: ________ (String, Int:Integer, Double:Float:Floating Point:Decimal Number, Script, Boolean:Flag, List, Dictionary, etc)
Attribute Value: ________ (depends upon your Attribute Type)

-------------

another example (in code, as it's quicker, and I'm lazy, lol):

('this' refers ONLY to the Object that it's scripting is attached to, aka is within. So for the "orc_1" Object's Scripting's, the "this" within that scripting, refers to the Object, in this case below, to the "orc_1" Object)

<object name="orc_1">
<inherit name="editor_object" />
<alias>orc</alias>
<attr name="dead" type="boolean">false</attr>
<attr name="changeddead" type="script">
if (this.dead = false) {
this.status_effect = "alive"
} else if (this.dead = true) {
this.status_effect = "dead"
}
on ready {
msg ("The " + this.alias + " is " + this.status_effect + ".")
}
</attr>
<attr name="status_effect" type="string">alive</attr>
<attr name="fight" type="script">
if (this.dead = false) {
this.dead = true
} else if (this.dead = true) {
this.dead = false
}
</attr>

jaynabonne
You have two options:

1) assemble the string piece by piece and then print it all out at once, or
2) use OutputTextNoBr instead of msg to output the text. :) (This shows up in the editor as "Print a message (no line-break)".)

The latter seems like what would work the best for you here, but the first option has its uses as well. (I've done both.)

Eaten By A Grue
Thanks, I'll give those a try! The codier things are something I'm still struggling with but I'll get 'em eventually!

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

Support

Forums