Difference between revisions of "HPL3/Scripting/Scripting Guide/Hello World"
< HPL3
Jump to navigation
Jump to search
m (→See Also) |
|||
(12 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | |||
{{Hpl3ScriptingGuideMenuBasic}} | {{Hpl3ScriptingGuideMenuBasic}} | ||
{{shortPageTitle}} | {{shortPageTitle}} | ||
+ | |||
+ | {| style="border:0px;" cellspacing="0" | ||
+ | |- valign="top" | ||
+ | | style="padding-right:0.2em" | | ||
+ | {{Note|From this moment in this guide, we will write out script on the MinimalCustomMapMod mod that comes with SOMA and Amnesia: Rebirth.}} | ||
Let’s start by writing a very simple script. Like every programming tutorial, we will start with a "Hello World” message. | Let’s start by writing a very simple script. Like every programming tutorial, we will start with a "Hello World” message. | ||
− | We want the message to be displayed on the screen when we load our map, so for that, we will go to OnStart, and inside those curly brackets, add: <pre> | + | We want the message to be displayed on the screen when we load our map, so for that, we will go to <code>OnStart</code>, and inside those curly brackets, add: <pre> |
cLux_AddDebugMessage("Hello World!"); | cLux_AddDebugMessage("Hello World!"); | ||
</pre>Don’t worry about what it means just yet. | </pre>Don’t worry about what it means just yet. | ||
Line 20: | Line 24: | ||
Once our map is loaded, we should get basically a black screen with a handful of text around the edges. In the lower left corner, you should see the text “Hello World!”. | Once our map is loaded, we should get basically a black screen with a handful of text around the edges. In the lower left corner, you should see the text “Hello World!”. | ||
− | {{Note|If you | + | <span>{{Note|If you cannot see the text, press F5, which reloads the map.}}</span> |
− | + | | style="width:0.1%" | | |
− | == Conclusion == | + | |} |
− | + | [[File:Debug message tut.png|thumb|"Hello World!" will appear at the bottom left when using printing it to the screen.|alt=|left]] {{clr}} | |
+ | ==Conclusion== | ||
+ | we used the code <code>cLux_AddDebugMessage</code> followed by an opening and closing parentheses. This is a '''function call''', which you will learn more about in the next chapter. | ||
− | + | For now, just know that this function’s job is to print text onto the screen. Within the parentheses is some text within quotation marks, '''“Hello World!”'''. | |
+ | This is what is known as a <code>[[HPL3/SOMA/Scripting/tString|string]]</code>. The important part to note here is that it is the text that actually appeared in the game itself. | ||
− | + | == See Also == | |
− | + | *[[HPL3/Scripting/AngelScript_Fundamentals/Chapter_2_-_Structure_of_a_Script#Hello_World|Hello World - AngelScript]] | |
− | {{NavBar|HPL3/Scripting/Scripting Workflow and Structure|Scripting Workflow and Structure|HPL3/Scripting/HPL3 Scripting Guide|HPL3 Scripting Guide|HPL3/Scripting/Calling Functions and Function Callbacks|Calling Functions and Function Callbacks}} | + | {{NavBar|HPL3/Scripting/Scripting_Guide/Scripting Workflow and Structure|Scripting Workflow and Structure|HPL3/Scripting/HPL3 Scripting Guide|HPL3 Scripting Guide|HPL3/Scripting/Scripting_Guide/Calling Functions and Function Callbacks|Calling Functions and Function Callbacks}} |
[[Category:HPL3 Scripting]] | [[Category:HPL3 Scripting]] | ||
[[Category:English]] | [[Category:English]] |
Latest revision as of 11:58, 16 August 2020
From this moment in this guide, we will write out script on the MinimalCustomMapMod mod that comes with SOMA and Amnesia: Rebirth.
Let’s start by writing a very simple script. Like every programming tutorial, we will start with a "Hello World” message. We want the message to be displayed on the screen when we load our map, so for that, we will go toOnStart , and inside those curly brackets, add: cLux_AddDebugMessage("Hello World!");Don’t worry about what it means just yet. The code should look something like this: ////////////////////////////
// Run first time starting map
void OnStart()
{
cLux_AddDebugMessage("Hello World!");
}
Once our map is loaded, we should get basically a black screen with a handful of text around the edges. In the lower left corner, you should see the text “Hello World!”.
If you cannot see the text, press F5, which reloads the map.
|
Conclusion
we used the code cLux_AddDebugMessage
followed by an opening and closing parentheses. This is a function call, which you will learn more about in the next chapter.
For now, just know that this function’s job is to print text onto the screen. Within the parentheses is some text within quotation marks, “Hello World!”.
This is what is known as a string
. The important part to note here is that it is the text that actually appeared in the game itself.