XML:TxtC

From OniGalore
Revision as of 14:46, 8 November 2008 by Paradox-01 (talk | contribs) (can't think of more things to add here; Category:Tutorials)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

TxtC: text console (page)

general notes

  • See HERE if you don't know how to convert an oni file into XML and vice versa.
  • Console text pages can be called via BSL command "text_console". In fact they don't need a console, you can call up a page in any function you like.
  • TxtC's are normally level specific, but could be made global.


BSL support

console_activate console_id:int
console_deactivate console_id:int
console_reset console_id:int (resets a console to initial state)
text_console name:string


two example functions

### called up by a console
func void console_jump(string ai_name)
{
	text_console level_1g
	console_reset 18
}

### called up by a random function, pops up when player performs Konoko's first punch
func just_show_me_a_page
{
	chr_wait_animation 0 KONCOMcomb_p
	text_console level_1f
}


XML structure

Think of "instances" (#N) as file sections, they go from 1 to N. 0 is the header (it defines the file type, here "TxtC").

Every TxtC contains one instance of type IGPA.
Every IGPA contains a number of instances of type IGPG.
Every IGPG contains a number of instances of type IGSA.
Every IGSA contains a number of instances of type IGSt.
IGPA means a page array (think of it as a little book)
IGPG means a page
IGSA means a (text) string array
IGSt means a (text) string
Take care of the structure and the cake is yours.
TxtC_TN.png

example on "TxtClevel_1f.xml":

#0 (TxtC instance) links to #1 (IGPA instance)
#1 (IGPA instance) links from #2 up to #4 (IGPG instances, here we have 3 pages as you see)
#2 (IGPG instance) links to #32 (IGSA instances)
#3 (IGPG instance) links to #20 (IGSA instances)
#4 (IGPG instance) links to #6 (IGSA instances)
#5 corresponds to the TSFFTahoma placeholder
#6 (IGSA instance) links from #7 up to #19 (IGSt Instances)
#20 (IGSA instance) links from #21 up to #31 (IGSt Instances)
#32 (IGSA instance) links from #33 up to #43 (IGSt Instances)


XML tags and options

TxtC instance tags

<Pages> (defines the number of pages)

IGPA instance tags

<Pages>
<Link> (links to an IGPG instance)

IGPG instance tags

<Font> (defines the font in case it isn't defined in the IGSt instance)
<Family>
TSFFTahoma
<Style>
Normal
Bold
Italic
<Color> (RGB range, e.g. <Color>255 0 77</Color>)
<Size> (10 and 12 are usually used)
<Image> (links to a TXMP or PSpc file)
<Text1> (links to an IGSA instance)
<Text2> (not used by TxtC)

IGSA instance tags

<Strings>
<Link> (links to an IGSt instance)

IGSt instance tags

<Font>
<Family>
TSFFTahoma
<Style>
Normal
Bold
Italic
<Color>
<Size>
<Flags> (Every IGSt can use own properties. The <Flag> tag let you enable these. Add "Size" when you want to get a new font size, add "Color" when you want to get a new font color, etc..)
Family
Style
Color
Size
<Text> (contains the actual text but can also create a bare paragraph (see example at instance #46))


example

In this example you can see a modified header, a link to instance number 5 was added (OniSplit reindexes it when repacking, so there is no conflict with the original instance #5, the TSFFTahoma placeholder).

modders_preview.png
<?xml version="1.0" encoding="utf-8"?>
<Oni Version="0.9.28.0">
   <Instance id="0" type="TxtC" name="level_31b">
       <Pages>#1</Pages>
   </Instance>
   <Instance id="1" type="IGPA">
       <Pages>
           <Link>#2</Link>
           <Link>#3</Link>
           <Link>#4</Link>
           <Link>#5</Link>
       </Pages>
   </Instance>

You can display a little image if you use the image tag in the IGPG instance. (Either non-animated TXMP or PSpc.)

<Text2> cannot be used for TxtC because there isn't a note/hint field.

   <Instance id="5" type="IGPG">
       <Font>
           <Family>TSFFTahoma</Family>
           <Style>Bold</Style>
           <Color>116 208 255</Color>
           <Size>10</Size>
           <Flags>Family Style Color Size</Flags>
       </Font>
       <Image>TXMPlevel31_modders</Image>
       <Text1>#44</Text1>
       <Text2></Text2>
   </Instance>

Instance number 46 has a space between the text tags (<Text> </Text>) to produce a new paragraph. The import doesn't care about that in onisplit v0.9.28 but you can fix that by writing "<Text xml:space="preserve"> </Text>".

   <Instance id="44" type="IGSA">
       <Strings>
           <Link>#45</Link>
           <Link>#46</Link>
           <Link>#47</Link>
       </Strings>
   </Instance>
   <Instance id="45" type="IGSt">
       <Font>
           <Family></Family>
           <Style>Bold</Style>
           <Color>116 208 255</Color>
           <Size>12</Size>
           <Flags>Style Color Size</Flags>
       </Font>
       <Text>That's a blue caption.</Text>
   </Instance>
   <Instance id="46" type="IGSt">
       <Font>
           <Family></Family>
           <Style>Normal</Style>
           <Color>0 0 0 0</Color>
           <Size>0</Size>
           <Flags></Flags>
       </Font>
       <Text xml:space="preserve"> </Text>
   </Instance>
   <Instance id="47" type="IGSt">
       <Font>
           <Family></Family>
           <Style>Normal</Style>
           <Color>150 150 150</Color>
           <Size>8</Size>
           <Flags>Color Size</Flags>
       </Font>
       <Text>And that's a white, smaller text.</Text>
   </Instance>