Thread: [Tutorial] XSE Scripting Tutorial
View Single Post
Old 1st March 2018, 10:02 PM  
Avara
Mirage Of Tales Creator
 
Join Date: Nov 2013
Posts: 33
Avara
Default

Simple Text Scripts

Let's start with a basic NPC - we want to make someone face us and say hi, or in scripting terms, display a string of text. We do this with a msgbox.

The msgbox command is set up like this:
Quote:
Originally Posted by Avara View Post
msgbox @pointer 0x[number of msgbox type]
There are various msgbox types which we'll go through one at a time. Here's the most common, 0x6:



Spoiler:
#dynamic 0x800000

#org @main
lock
faceplayer
msgbox @greeting 0x6
release
end

#org @greeting
= Hi!


So, we have quite a few new additions here.
lock prevents the player from moving. Alternatively, lockall stops all NPCs on the map from moving. Should come directly after your #org @main but before your msgbox.
faceplayer is fairly self explanitory too; it just makes the NPC face the PC before talking.
release lets the player move again. If you used lockall instead, you'll have to use releaseall. After release or releaseall, finish with end.
#org @greeting is a pointer to our text string, "= Hi!". I'll go into more detail on text info later, but the "=" basically tells XSE it's the start of a string, or line of text.

That script will make someone face you and say "Hi!". Alternatively, there is a shorter way of scripting NPCs: msgbox 0x2.



Spoiler:
#dynamic 0x800000

#org @main
msgbox @greeting 0x2
end

#org @greeting
= Hi!


Using the above version, msgbox 0x2, means you don't need the lock, faceplayer or release commands, whereas msgbox 0x6 does. Both scripts do exactly the same thing.

msgbox 0x3 is used in the original games for signposts; it displays the sign textbox when used on an actual signpost tile. Like 0x2, you don't need the lock, faceplayer or release commands.
Quote:
Originally Posted by Avara View Post
#dynamic 0x800000

#org @main
msgbox @sign 0x3
end

#org @sign
= Signpost
msgbox 0x4 is a normal textbox just like 0x6, in that you need the lock, faceplayer and release commands surrounding it. The difference here is that the textbox will stay open, meaning we require a new command to make it go away, closeonkeypress.
Quote:
Originally Posted by Avara View Post
#dynamic 0x800000

#org @main
lock
faceplayer
msgbox @greeting 0x4
closeonkeypress
release
end

#org @greeting
= Hi!

Last edited by Avara; 1st March 2018 at 10:07 PM.
Avara is offline   Reply With Quote
Likes Lunos liked this post