Adventure Game Studio

AGS Support => Modules, Plugins & Tools => Topic started by: SSH on Fri 02/12/2005 17:39:03

Title: MODULE: Digraphs v1.0 - Automatically replace accented characters
Post by: SSH on Fri 02/12/2005 17:39:03
This module is for translating digraphs (i.e. pairs of characters) into single characters. This may be useful if you have accented characters in your font, replacing some unused chars like '$' or '!'.

Download here (http://ssh.me.uk/modules/Digraphs.zip) (Requires AGS v2.71)
Documentation (http://ssh.me.uk/moddoc/Digraphs)
Mirror (http://www.lumpcity.co.uk/~ssh/Digraphs.zip)
Mirror 2 (http://www.2dadventure.com/ags/Digraphs.zip)

Just two functions:

//   function Digraph.Set(String digraph, char to);
//     Set up a digraph. One would normally set up a bunch of these in
//     game_start so that they apply for the whole game. The two characters
//     specified in the string will be converted to the char value "to" when
//     the digraph-translation function is used.
//    
//   String function Digraph.T(String from)
//     Translates the String passed and returns a modified string. If no
//     digraphs to translate, will return an identical string. A #define is
//     also setup to allow abbreviation of this function name to DG

Example code:


// global script

function game_start() {
  Digraph.Set("a'", '$'); // a acute
  Digraph.Set("e'", '!'); // e acute
  Digraph.Set("n~", '@'); // enye
}



// room script

function room_a() {
  // Script for room: Player enters room (after fadein)

  Display(DG("Ole', mi espan~ola, que ta'l?"));
}
Title: Re: MODULE: Digraphs v1.0
Post by: strazer on Fri 02/12/2005 19:44:06
I thought about doing something like this once but abandoned it since you can't use it in dialog scripts. Good work though.