How to add object name string SOLVED!!!!
Vitokin
03 Jun 2019, 12:57So i been following the combat tutorial and spent all night making my own combat system based on it, we can actually attack the Green Snake by typing attack green snake etc... My damage system works but my issue is that I need to do generic print text like You hit the enemy for x damage but i wished it chose the object name instead, thank you!

Io
03 Jun 2019, 13:19You want to change the box that says 'message' to 'expression'. What that basically does it change it into a 'code view' of your text.
So you'd do something like - and you'd keep the quotations - "You hit "+Enemy.alias+" for "+Player.OutgoingDamage+" damage!"
Vitokin
03 Jun 2019, 13:35Thanks a lot ;)
hegemonkhan
04 Jun 2019, 01:41(filler to get my edited post, updated/posted)
just to expand on IO's post:
---------------
the '[MESSAGE]' command option allows for:
1. ONLY TEXT (strings):
// in code: msg ("Hi, my name is HK, what is your name?")
// using GUI/Editor:
print [MESSAGE] Hi, my name is HK, what is your name?
// output: Hi, my name is HK, what is your name?
// in code: msg ("Hi, my name is \"HK\", what is your name?")
// using GUI/Editor:
print [MESSAGE] Hi, my name is "HK", what is your name?
// output: Hi, my name is "HK", what is your name?
-----------------
the '[EXPRESSION]' command option allows for any one of these:
1. ONLY TEXT:
// in code: msg ("Hi, my name is HK, what is your name?")
// using GUI/Editor: print [EXPRESSION] "Hi, my name is HK, what is your name?"
// output: Hi, my name is HK, what is your name?
// in code: msg ("Hi, my name is \"HK\", what is your name?")
// using GUI/Editor: print [EXPRESSION] "Hi, my name is \"HK\", what is your name?"
// output: Hi, my name is "HK", what is your name?
2. ONLY VARIABLE:
// in code: create ("example_object")
// in code: example_object.greeting_string_attribute = "Hi, my name is HK. What is your name?"
// in code: msg (example_object.greeting_string_attribute)
// in code with the 'text processor commands': msg ("{example_object.greeting_string_attribute}")
// using GUI/Editor: print [EXPRESSION] example_object.greeting_string_attribute
// using GUI/Editor with the 'text processor commands': print [EXPRESSION] "{example_object.greeting_string_attribute}"
// output: Hi, my name is HK, what is your name?
// in code: create ("example_object")
// in code: example_object.greeting_string_attribute = "Hi, my name is \"HK\", what is your name?"
// in code: msg (example_object.greeting_string_attribute)
// in code with the 'text processor commands': msg ("{example_object.greeting_string_attribute}")
// using GUI/Editor: print [EXPRESSION] example_object.greeting_string_attribute
// using GUI/Editor with the 'text processor commands': print [EXPRESSION] "{example_object.greeting_string_attribute}"
// output: Hi, my name is "HK", what is your name?
3. TEXT AND VARIABLE:
// in code: player.alias = "HK"
// in code: msg ("Hi, my name is " + player.alias + ", what is your name?")
// in code with the 'text processor commands': msg ("Hi, my name is {player.alias}, what is your name?")
// using GUI/Editor: print [EXPRESSION] "Hi, my name is " + player.alias + ", what is your name?"
// output: Hi, my name is HK, what is your name?
// in code: player.alias = "HK"
// in code: msg ("Hi, name is \"" + player.alias + "\", what is your name?")
// in code with the 'text processor commands': msg ("Hi, name is \"{player.alias}\", what is your name?")
// using GUI/Editor: print [EXPRESSION] "Hi, name is \"" + player.alias + "\", what is your name?"
// using GUI/Editor with the 'text processor commands': print [EXPRESSION] "Hi, name is \"{player.alias}\", what is your name?"
// output: "Hi, my name is "HK", what is your name?"
-------------
Pixie's trick to getting the syntax correct:
break it up into "chunks"
HK is an 18 year old adult male human warrior.
player.alias = "HK"
player.age_integer = 18
player.age_string = "adult"
player.sex = "male"
player.race = "human"
player.class = "warrior"
msg (player.alias + " is an " + player.age_integer + " year old " + player.age_string + " " + player.sex + " " + player.race + " " + player.class + ".")
// using GUI/Editor:
print [EXPRESSION] player.alias + " is an " + player.age_integer + " year old " + player.age_string + " " + player.sex + " " + player.race + " " + player.class + "."
the "chunks":
01. player.alias
02. +
03. " is an " // "[SPACE]is[SPACE]an[SPACE]"
04. +
05. player.age_integer
06. +
07. " year old " // "[SPACE]year[SPACE]old[SPACE]"
08. +
09. player.age_string
10. +
11. " " // "[SPACE]"
12. +
13. player.sex
14. +
15. " " // "[SPACE]"
16. +
17. player.race
18. +
19. " " // "[SPACE]"
20. +
21. player.class
22. +
23. "." // "[DOT/PERIOD]"
// the "chunks" (more condensed: shorter):
01. player.alias +
02. " is an " // "[SPACE]is[SPACE]an[SPACE]"
03. + player.age_integer +
04. " year old " // "[SPACE]year[SPACE]old[SPACE]"
05. + player.age_string +
06. " " // "[SPACE]"
07. + player.sex +
08. " " // "[SPACE]"
09. + player.race +
10. " " // ""SPACE]"
11. + player.class +
12. "." // "[DOT/PERIOD]"
---------
Escape Commands:
outputs/displays some symbol or does some action
escape character: \
// IMPORTANT: make sure you hit the 'BACK-SLASH' key, and NOT the 'forward-slash' key (argh, so easy to mix them up, lol)
escape command: \WHATEVER_EXISTING_COMMAND
// IMPORTANT: there is NO [SPACE] between the 'escape character' and the 'WHATEVER_EXISTING_COMMAND'
https://en.wikipedia.org/wiki/Escape_character