Mob Talker Wiki
Advertisement
How to make your own script

If you are here, it means that you want to make your own script, or you are just curious to know how to make one - well, this page may help you!

This page is a tutorial for making your own script for the mod, which will be attempted kept updated, as well as made easy to use and helpful.

If you read it all and still have problems when testing, please post:

  • What is happening when you try to use it
  • Where you have saved the script
  • The bug report (download link for the bug report, please)

Someone else will then attempt to help solve the problem. In case the problem is within the script code, please include a download link to your script as well to make it easier to identify the problem.

The admins User:TheAbner and User:ServantOfTheThirdEye stand available to help if need be. Simply message one of them, and they will get back to you as soon as they can.

We hope you all write good scripts and post them in the Custom Scripts article so that people can try it out.

Making a Script

Step 1

  1. Create a folder named mobTalker_script.

  2. Create a folder inside mobTalker_script, named after the mob you're making a script for. (Referred to as [Mob Name])

    OBS: While in most cases the names are simply "Enderman", "Creeper", etc, if you are writing a script for any of the below mobs, the folder name should be as follows:
    • Magma Cube = LavaSlime
    • Iron Golem = VillagerGolem
    • Snow Golem = SnowMan

  3. Open Notepad (Windows) or TextEdit (Mac), create an empty text file, and save it with UTF-8 character encoding.
    • Win: Go to 'Save As'. Under 'Encoding' choose 'UTF-8'.
    • Mac: Click 'Format' in the menubar, and choose 'Make Plain Text'. Go to "Save As". Under "Plain Text Encoding" choose 'UTF-8'.

  4. Save the file in [Mob Name], and name it Normal.
    mobTalker_script/[Mob Name]/Normal.txt

  5. On the first line, write the code:
  6. SET_NAME

  7. After that, on the same line, write the name of your mob in your script. Ex: "Andr" or "Cupa".
    This will be the display name of your mob when you talk to it.

  8. On the next line, write the first thing the mob will say. Ex: "..."

  9. On the next line, write the code:
  10. END.
    • This code tells Minecraft to stop reading the script, as it's the end of it.

  11. Your code now looks as follows:
    #SET_NAME Andr
    ...
    #END


Now, run a test to see if you've done everything right this far:

  1. Change the file extension of Normal.txt to Normal.script
    • Win: If you can't see the file extension in the folder, go to 'Organize > Folder and Search Options', then click the 'View' tab. Uncheck the box titled 'Hide extensions for known file types'. Now you can change the file extension by renaming the file.
    • Mac: Highlight the file and hit Cmd-i (Command/Apple-key left of the spacebar). Change the file extension under 'Name & Extension', and press Enter, then 'Use .script' in the pop-up warning.

  1. Install your script like any other script, following the installation guide.

  2. Run Minecraft.

  3. Talk to the mob your script is made for.


If the mob replies with "..." every time you talk to it, then you have successfully completed Step 1 of this guide.


Step 2

  1. Rename Normal.script back to Normal.txt so you can edit it again.

  2. Add the code
  3. MAKESHADOW on a new line above
  4. END.
    #SET_NAME Andr
    ...
    #MAKESHADOW
    #END
  5. Create a folder inside mobTalker_script, named Friendly.

  6. Create a folder inside Friendly, named after the mob you're making a script for. (Referred to as [Mob Days])

  7. Create a folder inside [Mob Days], named day1.

  8. Create a new UTF-8 text file inside day1, and name it love0.
    mobTalker_script/Friendly/[Mob Days]/day1/love0.txt
    • The "Love Level" can be increased or decreased with the
  9. INCREASE_LOVE or
  10. DECREASE_LOVE commands. Depending on the value of the level, the mod reads 'love#.script', with '
  11. ' being the current love level.
    Ex: If the love level is at '25', then the mod will read 'love25.script' next time you talk to the mob.
    Like this, you can have different stories in a single script.
    Ex: If the player chooses Option 1 the love will decrease by 5, and the love#.script file that it will then run, will make the mob attack the player. However Option 2 will increase the love and the love#.script file that it will run, will be a lovely ending, etc.

  12. Pay close attention now. This is where the real coding starts.
    Type in the following code:
#FETCH_NAME
#SET_NAME Andr
Hi...
#SET_NAME Andr
Who are you?
#SET_NAME (playername)
I'm (playername)::Nice to meet you!
#SET_NAME
What do you want with me... I'm an Enderman , shouldn't you be scared of me... or try to attack me, or avoid looking me in the eyes?????
#SET_NAME (playername)
You don't look dangerous
#SET_POS Middle
#SET_NAME Narrator
*She was very shy and that's why she acted like that*
#SET_POS Left
#SET_NAME Andr
Don't I...
#INCREASE_LOVE 5
#FINISH_DAY
#END


Having trouble understanding what you just copy-pasted? Don't worry, that's normal.

Let us take a closer look at it, piece at a time.

Command Explanation
  1. FETCH_NAME
This code enables the use of (playername) throughout the script.

This command needs only to be run once in a single love#.script file, but will still have to be written in all script files taking use of (playername).

(playername) When the mod runs into this word in a script, it will automatically replace it with the player's Minecraft username.

Please note that when used together with

  1. SET_NAME, it will only work if (playername) is the only thing written.
:: This code allows you to force a line jump.

Normally the text will only automatically make a line jump when the lines character limit is reached.

  1. SET_POS
This code allows you to change the location of the display name from
  1. SET_NAME, giving you three options: Left (default) / Middle / Right.

Once the position is set, it will stay as such until changed again.
Ex: If you wish to switch it from left to right halfway through, you only have to type in

  1. SET_POS Right once for it to affect the script until it reads a new
  2. SET_POS command or reaches the
  3. END.
  1. INCREASE_LOVE
  2. DECREASE_LOVE
This will increase/decrease the 'love level', which was explained earlier.
  1. FINISH_DAY
This command ends scripts for the day, and makes the mod load up default.script (explained later) until the next day starts.

It's optional, making it possible to run several love#.script files in a single day.
Observation: The love level carries over from one day to the next.

These are some of the basic commands. For a full list of available commands, as well as their usage, read the article; Script Commands.

We previously mentioned a file - or actually, several files - called default.script. These are the files which the mod will read under several circumstances:

  • When
  1. FINISH_DAY is executed
  • Once the Script is over.
  • If it can't find the file it's looking for.

Which makes all of them very important.

Also important to note is that each day# folder needs to have it's own default.script file.

Without these files, the script won't function correctly, so you'll need to get those in place before you can run another test of the script.

  1. Create a new UTF-8 text file inside day1, and name it default.
    mobTalker_script/Friendly/[Mob Days]/day1/default.txt

  2. Now insert some simple code.
    #SET_NAME Andr
    ...
    #END

    This will be the text which will be repeated once a love#.script file executes the
  3. FINISH_DAY command.
    Important: Don't include the
  4. MAKESHADOW command, as it should only be used in the Normal.script file.

  5. Create a folder inside [Mob Days], named default.

  6. Create a new UTF-8 text file inside default, and name it default.
    mobTalker_script/Friendly/[Mob Days]/default/default.txt

  7. Now insert some simple code.
    #SET_NAME Andr
    ...
    #END

    This will be the text which will be repeated once the script is over.

Time to test if you've completed Step 2 of this guide correctly.

  1. Rename all .txt files to .script.
  2. Open Minecraft.
  3. Talk to the mob your script is made for.

If the script runs the way it's supposed to - as described through this guide - you've done everything correct, and can continue on to Step 3.


Step 3

Next up, you'll be adding in 1-3 options to choose from during a conversation. To do so, you'll need to understand the basics of how to setup and use the #CONDITION command, so go ahead and read that before continuing.

In a nutshell, the setup which

  1. CONDITION uses is as such: "OptionNL" - N = Number, L = Letter

If you have three options to choose from, the names will then be "Option1A", "Option1B", and "Option1C". This is important to keep in mind, as the mod determines which script file to run next, based on the name of the option.
Ex: If Option1A is chosen, then the mod will load up the file Option1A.script next, etc.

Observation: The love level carries on from a love#.script file, into a OptionNL.script file, and vice versa, making it possible to create several paths to the story.

When you've become familiar with the setup of this command, try use it, and test the script the same way you've done previously. If it works, then you can continue on to testing out some of the other commands as well.

That sums up the basics you need to know in order to code your own scripts.
For further instructions on the different commands, as well as a list of them all, please read the Script Commands article.
And as mentioned earlier, if you have any further questions or issues with script creating, please let us know, and we'll try and help best possible.

References

Advertisement