Making a msg directly follow another msg (Solved)
Nakita Block
24 Aug 2018, 20:10I am making a scripted room description that describes the room according to variables. I don't want to make it obvious by having each variable checked producing a msg on a separate line. Is there a way to print messages that directly follow the previous msg instead of being printed on the next line?
For instance in BASIC code you would follow your print command with a semicolon letting the program know the next line printed would be placed immediately after.
mrangel
24 Aug 2018, 20:44OutputTextNoBr ("Here's the first part of my description. ")
OutputTextNoBr ("And another part. ")
msg ("And the end of the paragraph.")
(OutputTextNoBr is named after the <br/>
HTML element, which outputs an extra line break when printed)
Alternatively, you could have your scripts create the whole description in a string, and then print it all at once.
Nakita Block
24 Aug 2018, 21:15I love you. Thank you for your quick response.

Anonynn
25 Aug 2018, 00:20You can also do...
msg ("")
wait {
msg ("")
}
:D
Anonynn.
hegemonkhan
25 Aug 2018, 06:53(filler for getting my edited post, updated/posted)
(again, filler for getting my edited post, updated/posted)
(again, filler for getting my edited post, updated/posted)
the alternative that mrangel was alluding to is known as:
concatenation (literally putting things together / next to each other)
concatenation is very powerful/useful, there's a lot of applications you can use it for
Addition Arithmetic (uses amounts: integers/int and doubles: floats/floating-points/decimal/fractional):
5 + 5 = 10
55 + 55 = 110
5 + "mama" = ERROR!
"mama" + 5 = ERROR!
"5" + "5" = ERROR!
~~~~~ VS ~~~~~~~~
Concatenation (uses Strings/"text"):
"5" + "5" = "55"
"55" + "55" = "5555"
"mama" + "mia" = "mamamia"
"mama" + "7" = "mama7"
"mama" + " " + "mia" = "mama mia" // "mama" + "(SPACE)" + "mia"
"mama " + "mia" = "mama mia" // "mama(SPACE)" + "mia"
"mama" + " mia" = "mama mia" // "mama" + "(SPACE)mia"
5 + "mama" = ERROR!
"mama" + 5 = ERROR!
5 + 5 = ERROR!
here's a simple example of concatenation:
(you can use 'if' Scripts to utilize concatenation's powerfulness/usefulness, but I don't show that here, if you want example of it, I can show it, just let me know if you want an example of it, or if you need help with anything)
string_variable = "Hi"
msg (string_variable)
msg ("") // this is alternative method of creating a blank/empty line (as you can instead, use the '<br>' html in quest 'msg' scripting directly too)
string_variable = string_variable + ", how are you?"
msg (string_variable)
msg ("")
string_variable = string_variable + " My name is HK, what is your name?"
msg (string_variable)
msg ("")
get input {
player.name_string_attribute = result
// let's say you typed in: Nakita
// result = "Nakita" // quest does this automatically (hidden from you) for you (for: 'get input', 'show menu / ShowMenu', 'ask/Ask', and maybe some more Scripts/Functions too)
// player.name_string_attribute = [result = "Nakita"]
// player.name_string_attribute = "Nakita"
}
string_variable = string_variable + " Ah, nice to meet you, " + player.name_string_attribute + "!"
msg (string_variable)
// output/display:
Hi
Hi, how are you?
Hi, how are you? My name is HK, what is your name?
Hi, how are you? My name is HK, what is your name? Ah, nice to meet you, Nakita!
Nakita Block
29 Aug 2018, 06:00Well that was a lot more information than I expected, which I'm very thankful for.
The main thing I appreciate is that when I went back to the editor, I noticed that "Print without br" was the second option in the list. And instead of you saying "You dummy, it's right there in the drop-down menu!" you actually elaborated on the subject and that's absolutely awesome of you guys.
It's extremely helpful that most of this is pretty much like BASIC with a Visual BASIC type of interface, so the more I mess around with it the easier it gets to understand. In many cases I don't even use the interface and instead just write the code myself because it's sometimes faster that way than it is to wait for the options to pop up (at least in the browser it is).
Anyway I'm rambling. I just wanted to thank you guys for your courteous and out-of-your-way answers. I know I'll have more questions in due time. Right now I'm sure there are things that could be faster, but I've learned how to set and utilize variables (properly, without the syntax error) so I have been able to solve some of my questions just by throwing in an extra variable that may not necessarily be efficient, but it works. Is it okay to once in a while throw out a code just to see if there's a more efficient way to write it?
hegemonkhan
30 Aug 2018, 06:48Is it okay to once in a while throw out a code just to see if there's a more efficient way to write it? (Nakita)
definitely, coders love this... to try to come up with better code, we find it fun! (and can be compulsive-consuming: detrimenting making actual progress on the game/software you're creating, lol, as you can always make the code more efficient and/or more scalable/dynamic/editable --- HK has this problem), hehe :D