46
Technical forum / Re: How to get the next char in the abc
« on: July 31, 2009, 06:24:51 PM »
Yes as you can see there are several aproachs to this solution

Forum rules - please read before posting, it can save you a lot of time.
function GetNextLetter(alphabet, letter)
{
var i=0;
var nextLetter = "";
for(i=0; i<alphabet.Length; i=i+1)
{
if(alphabet[i] == letter)
{
if(i+1 < alphabet.Length) nextLetter = alphabet[i+1];
else nextLetter = "z";
}
}
return nextLetter;
}
/* Example of use: */
var alphabet = new Array("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "v", "w", "x", "y", "z");
var letter = "k";
Game.Msg(GetNextLetter(alphabet, letter)); /* It should show l */
Game.Msg(GetNextLetter(alphabet, "b")); /* It should show c */
var other_letter = GetNextLetter(alphabet, "y"); /* other_letter should have z */
C:\Archivos de programa\WME DevKit>wme_comp.exe -project "C:\Archivos de program
a\WME DevKit\projects\wme_demo\wme_demo.wpr"
Wintermute Engine Script Compiler 1.8.010, (c) 2009 Dead:Code
Usage:
wme_comp.exe -script script.dcs [-project project.wpr] [-output output_path] [
-format default|scite]