

![]() |
| Please help us to raise in the ranks of podcasting and subscribe to our itunes feed using the link above. |
|
Learn how to display text on screen.
This tutorial may seem a little complicated - but if you take each file and complete them individually it becomes very easy -
Lines of text are called "strings" The complete list of text strings for a map are known as a "string package" Let us create a string package for a co-op map... For this you need 3 files 1. The script or os file that will "print" the commands to the screen 2. The ds file that contains the numbers/identities of the strings of text 3. The sp file that contains the actual words/logos that will be printed The sp file is made in notepad and saved with the file extension of sp ie RDAM.sp The ds and sp file should be called a relevant name - for this example tutorial I will call it RDAM.ds and the sp file will be called RDAM.sp Let us begin... First we need to know what text we want to appear on screen Imagine that I have a co-op map in which I want the following 5 lines of text to appear... 1. "Rescue the hostages !" 2. "Danger : Watch out for Landmines" 3. "This door is locked" 4. "Activate the switch !" 5. "Congratulations - You have won!" First I need to summarise the text into one word - so the text above becomes in short... 1. RESCUE 2. DANGER 3. LOCKED 4. ACTIVATE 5. WINNER As I am going to call everything RDAM I need to create a blank ds file in notepad and save it as RDAM.ds - this is totally blank with no text in it at all The first line defines the name of the string package... #define PACKAGE_RDAM 0x64 This line must be written as above with the # symbol and all letters in capitals The number at the end is a coded number that just sets up the text lines to use numbers within a certain range Now we are ready to list the lines of text and give each one its own number The sequence of numbers are as follows... 0x6400 0x6401 0x6402 0x6403 0x6404 0x6405 0x6406 0x6407 0x6408 0x6409 0x640a 0x640b 0x640c 0x640d 0x640e 0x640f 0x6410 0x6411 0x6412 0x6413 0x6414 0x6415 0x6416 0x6417 0x6418 etc That should be more than enough for an average map - if more are needed I usually make a second string package for the map The first line of text which we called "RESCUE" is defined like this... #define RDAM_RESCUE 0x6400 You can see that the name of the string package (RDAM) is written together with the name of the text string (RESCUE) and then a number - It is good practice to create a number of spaces between the text and the number - keep the spaces in the line to make it appear clear So if I define all the strings our ds file will now look like this... ---------------------------------------------- #define PACKAGE_RDAM 0x64 #define RDAM_RESCUE 0x6400 #define RDAM_DANGER 0x6401 #define RDAM_LOCKED 0x6402 #define RDAM_ACTIVATE 0x6403 #define RDAM_WINNER 0x6404 (Note that this forum post incorrectly displays the above lines - there should be about 10 spaces in between the writing and the numbers) ------------------------------------------------- Save this as RDAM.ds That's it for the ds file - this ds file is NOT compiled into an os file You simply place this ds file in the same folder as the script file that WILL be compiled later into an os file If you have followed my tutorials you should put this RDAM.ds file into the C:\Sample/ds/test folder Now we need to make the sp file that contains the actual text strings that the RDAM.ds file refers to - so open a text file in Notepad to begin... The sp file starts like this... VERSION 1 ID 100 REFERENCE RDAM DESCRIPTION "RDAM Specific Strings" COUNT 5 For now - don't worry about the Version and ID number - just include it in your file The REFERENCE just needs to be the same name as your ds file = RDAM - The description can be anything within the quotation marks - I just keep it standard and write, as above, "RDAM specific strings" The COUNT is the number of text strings you have defined which in this example= 5 The next lines are the most important to get correct Each statement must be within brackets etc and is like code - if you have any punctuation or spaces in the wrong place then the file will not work There is a variety of ways to display the text - to keep it simple for the moment I will make all the text appear in the middle of the screen The first section will look like this... INDEX 0 { FLAGS SP_FLAG_CENTERED REFERENCE RESCUE TEXT_ENGLISH "Rescue the hostages !" TEXT_GERMAN "Rescue the hostages !" TEXT_FRENCH "Rescue the hostages !" } The index defines the number of the text string that must match the number in the RDAM.ds file - the first text string begins at zero The REFERENCE is the name we gave this text string in RDAM.ds The actual text is within quotation marks and you can see that there are 3 languages that you can translate into If somebody is running SoF with French language setting then they will see the message after the TEXT_FRENCH - I have obviously not bothered to translate but you may like to do this - If you went through every string package in SoF then you may see that you could write say Russian words instead of German maybe and add a new language to SoF completely - but that is another story... If I add the other text strings in a similar manner I will now have a file that looks like this... ------------------------------------------------------------ VERSION 1 ID 100 REFERENCE RDAM DESCRIPTION "RDAM Specific Strings" COUNT 5 INDEX 0 { FLAGS SP_FLAG_CENTERED REFERENCE RESCUE TEXT_ENGLISH "Rescue the hostages !" TEXT_GERMAN "Rescue the hostages !" TEXT_FRENCH "Rescue the hostages !" } INDEX 1 { FLAGS SP_FLAG_CENTERED REFERENCE DANGER TEXT_ENGLISH "Danger : Watch out for Landmines" TEXT_GERMAN "Danger : Watch out for Landmines" TEXT_FRENCH "Danger : Watch out for Landmines" } INDEX 2 { FLAGS SP_FLAG_CENTERED REFERENCE LOCKED TEXT_ENGLISH "This door is locked" TEXT_GERMAN "This door is locked" TEXT_FRENCH "This door is locked" } INDEX 3 { FLAGS SP_FLAG_CENTERED REFERENCE ACTIVATE TEXT_ENGLISH "Activate the switch !" TEXT_GERMAN "Activate the switch !" TEXT_FRENCH "Activate the switch !" } INDEX 4 { FLAGS SP_FLAG_CENTERED REFERENCE WINNER TEXT_ENGLISH "Congratulations - You have won!" TEXT_GERMAN "Congratulations - You have won!" TEXT_FRENCH "Congratulations - You have won!" } ------------------------------------------------------------------ Note that there are no spaces between the statements This file is saved in Notepad as RDAM.sp and needs to be in the sof/base/strip folder - again you may need to create this folder Now we will make the script to print the text in your map - this will be run by a script runner in your map - for instructions on how this is done see my previous tutorials Make a "normal" ds file as per previous instructions - ie you should start with the following 2 lines of text... #include "../common/header.ds" output "C://sample/ds/test" To this we add a further line as follows... #include "RDAM.ds" This means that the script to follow will be able to refer to your string package that you called RDAM.ds and which should be in the same folder as this script The rest is easy - you just need to use the "print" command with the string reference - ie print RDAM_DANGER To test all the strings you made you may put the following in your script... --------------------------------------------------------- #include "../common/header.ds" output "C://sample/ds/test" #include "RDAM.ds" print RDAM_RESCUE wait 5 seconds print RDAM_DANGER wait 5 seconds print RDAM_LOCKED wait 5 seconds print RDAM_ACTIVATE wait 5 seconds print RDAM_WINNER wait 5 seconds exit ----------------------------------------------------- Compile this into an os file and run it in your map All the txt will appear in yellow writing in the middle of the game screen If you have put the text strings in the wrong order in your sp file or the count is wrong or the reference numbers are wrong you may see the following errors in your game... {null} - this will appear when the print command refers to a text string that is incorrect "string package not defined for 0eo4" - ...or something similar - your sp file has major errors or is not in the STRIP folder In the next tutorial I will explain the different ways of displaying text and how to display logos or pictures on screen Hope this helps! Demise RDAM |
Members Online
Latest MODSonline Poll
MODSonline Teamspeak
Partners of MODSonline
Friends of MODSonline
|