You must be logged in to post messages.
Please login or register

Modding and Scripting
Moderated by Yeebaagooon, nottud

Hop to:    
loginhomeregisterhelprules
Bottom
Topic Subject: XS String Manipulation
posted 04 March 2008 05:12 PM EDT (US)   
I've manage to create a simple substring function that finally gives some value to a string other than just displaying stuff.
Here they are:
string subStr(string sText = "", int startPos = 0, int endPos = 2048)
{
int pos = 0;
string dText = "";
string subText = "";
string currentChar = "";

while(true) // To infinity, and beyond!
{
if(dText == sText)
break;

currentChar = "";
pos++;

if(dText+" " > sText) { currentChar = ""; }
else if(dText+"!" > sText) { currentChar = " "; }
else if(dText+"\"" > sText){ currentChar = "!"; }
else if(dText+"#" > sText) { currentChar = "\""; }
else if(dText+"$" > sText) { currentChar = "#"; }
else if(dText+"%" > sText) { currentChar = "$"; }
else if(dText+"&" > sText) { currentChar = "%"; }
else if(dText+"'" > sText) { currentChar = "&"; }
else if(dText+"(" > sText) { currentChar = "'"; }
else if(dText+")" > sText) { currentChar = "("; }
else if(dText+"*" > sText) { currentChar = ")"; }
else if(dText+"+" > sText) { currentChar = "*"; }
else if(dText+"," > sText) { currentChar = "+"; }
else if(dText+"-" > sText) { currentChar = ","; }
else if(dText+"." > sText) { currentChar = "-"; }
else if(dText+"/" > sText) { currentChar = "."; }
else if(dText+"0" > sText) { currentChar = "/"; }
else if(dText+"1" > sText) { currentChar = "0"; }
else if(dText+"2" > sText) { currentChar = "1"; }
else if(dText+"3" > sText) { currentChar = "2"; }
else if(dText+"4" > sText) { currentChar = "3"; }
else if(dText+"5" > sText) { currentChar = "4"; }
else if(dText+"6" > sText) { currentChar = "5"; }
else if(dText+"7" > sText) { currentChar = "6"; }
else if(dText+"8" > sText) { currentChar = "7"; }
else if(dText+"9" > sText) { currentChar = "8"; }
else if(dText+":" > sText) { currentChar = "9"; }
else if(dText+";" > sText) { currentChar = ":"; }
else if(dText+"<" > sText) { currentChar = ";"; }
else if(dText+"=" > sText) { currentChar = "<"; }
else if(dText+">" > sText) { currentChar = "="; }
else if(dText+"?" > sText) { currentChar = ">"; }
else if(dText+"@" > sText) { currentChar = "?"; }
else if(dText+"a" > sText) { currentChar = "@"; }
else if(dText+"b" > sText) { currentChar = "a"; }
else if(dText+"c" > sText) { currentChar = "b"; }
else if(dText+"d" > sText) { currentChar = "c"; }
else if(dText+"e" > sText) { currentChar = "d"; }
else if(dText+"f" > sText) { currentChar = "e"; }
else if(dText+"g" > sText) { currentChar = "f"; }
else if(dText+"h" > sText) { currentChar = "g"; }
else if(dText+"i" > sText) { currentChar = "h"; }
else if(dText+"j" > sText) { currentChar = "i"; }
else if(dText+"k" > sText) { currentChar = "j"; }
else if(dText+"l" > sText) { currentChar = "k"; }
else if(dText+"m" > sText) { currentChar = "l"; }
else if(dText+"n" > sText) { currentChar = "m"; }
else if(dText+"o" > sText) { currentChar = "n"; }
else if(dText+"p" > sText) { currentChar = "o"; }
else if(dText+"q" > sText) { currentChar = "p"; }
else if(dText+"r" > sText) { currentChar = "q"; }
else if(dText+"s" > sText) { currentChar = "r"; }
else if(dText+"t" > sText) { currentChar = "s"; }
else if(dText+"u" > sText) { currentChar = "t"; }
else if(dText+"v" > sText) { currentChar = "u"; }
else if(dText+"w" > sText) { currentChar = "v"; }
else if(dText+"x" > sText) { currentChar = "w"; }
else if(dText+"y" > sText) { currentChar = "x"; }
else if(dText+"z" > sText) { currentChar = "y"; }
else if(dText+"[" > sText) { currentChar = "z"; }
else if(dText+"\\" > sText){ currentChar = "["; }
else if(dText+"]" > sText) { currentChar = "\\"; }
else if(dText+"[" > sText) { currentChar = "]"; }
else if(dText+"^" > sText) { currentChar = "["; }
else if(dText+"_" > sText) { currentChar = "^"; }
else if(dText+"`" > sText) { currentChar = "_"; }
else if(dText+"{" > sText) { currentChar = "`"; }
else if(dText+"|" > sText) { currentChar = "{"; }
else if(dText+"}" > sText) { currentChar = "|"; }
else if(dText+"~" > sText) { currentChar = "}"; }
else if(dText+"~~" > sText){ currentChar = "~"; }

dText = dText + currentChar;

if(pos >= startPos)
subText = subText + currentChar;
if(pos == startPos+endPos-1)
break;
}
return(subText);
}

int lengthStr(string sText = "")
{
int pos = 0;
string dText = "";
string currentChar = "";

while(true) // To infinity, and beyond!
{
if(dText == sText)
break;

currentChar = "";
pos++;

if(dText+" " > sText) { currentChar = ""; }
else if(dText+"!" > sText) { currentChar = " "; }
else if(dText+"\"" > sText){ currentChar = "!"; }
else if(dText+"#" > sText) { currentChar = "\""; }
else if(dText+"$" > sText) { currentChar = "#"; }
else if(dText+"%" > sText) { currentChar = "$"; }
else if(dText+"&" > sText) { currentChar = "%"; }
else if(dText+"'" > sText) { currentChar = "&"; }
else if(dText+"(" > sText) { currentChar = "'"; }
else if(dText+")" > sText) { currentChar = "("; }
else if(dText+"*" > sText) { currentChar = ")"; }
else if(dText+"+" > sText) { currentChar = "*"; }
else if(dText+"," > sText) { currentChar = "+"; }
else if(dText+"-" > sText) { currentChar = ","; }
else if(dText+"." > sText) { currentChar = "-"; }
else if(dText+"/" > sText) { currentChar = "."; }
else if(dText+"0" > sText) { currentChar = "/"; }
else if(dText+"1" > sText) { currentChar = "0"; }
else if(dText+"2" > sText) { currentChar = "1"; }
else if(dText+"3" > sText) { currentChar = "2"; }
else if(dText+"4" > sText) { currentChar = "3"; }
else if(dText+"5" > sText) { currentChar = "4"; }
else if(dText+"6" > sText) { currentChar = "5"; }
else if(dText+"7" > sText) { currentChar = "6"; }
else if(dText+"8" > sText) { currentChar = "7"; }
else if(dText+"9" > sText) { currentChar = "8"; }
else if(dText+":" > sText) { currentChar = "9"; }
else if(dText+";" > sText) { currentChar = ":"; }
else if(dText+"<" > sText) { currentChar = ";"; }
else if(dText+"=" > sText) { currentChar = "<"; }
else if(dText+">" > sText) { currentChar = "="; }
else if(dText+"?" > sText) { currentChar = ">"; }
else if(dText+"@" > sText) { currentChar = "?"; }
else if(dText+"a" > sText) { currentChar = "@"; }
else if(dText+"b" > sText) { currentChar = "a"; }
else if(dText+"c" > sText) { currentChar = "b"; }
else if(dText+"d" > sText) { currentChar = "c"; }
else if(dText+"e" > sText) { currentChar = "d"; }
else if(dText+"f" > sText) { currentChar = "e"; }
else if(dText+"g" > sText) { currentChar = "f"; }
else if(dText+"h" > sText) { currentChar = "g"; }
else if(dText+"i" > sText) { currentChar = "h"; }
else if(dText+"j" > sText) { currentChar = "i"; }
else if(dText+"k" > sText) { currentChar = "j"; }
else if(dText+"l" > sText) { currentChar = "k"; }
else if(dText+"m" > sText) { currentChar = "l"; }
else if(dText+"n" > sText) { currentChar = "m"; }
else if(dText+"o" > sText) { currentChar = "n"; }
else if(dText+"p" > sText) { currentChar = "o"; }
else if(dText+"q" > sText) { currentChar = "p"; }
else if(dText+"r" > sText) { currentChar = "q"; }
else if(dText+"s" > sText) { currentChar = "r"; }
else if(dText+"t" > sText) { currentChar = "s"; }
else if(dText+"u" > sText) { currentChar = "t"; }
else if(dText+"v" > sText) { currentChar = "u"; }
else if(dText+"w" > sText) { currentChar = "v"; }
else if(dText+"x" > sText) { currentChar = "w"; }
else if(dText+"y" > sText) { currentChar = "x"; }
else if(dText+"z" > sText) { currentChar = "y"; }
else if(dText+"[" > sText) { currentChar = "z"; }
else if(dText+"\\" > sText){ currentChar = "["; }
else if(dText+"]" > sText) { currentChar = "\\"; }
else if(dText+"[" > sText) { currentChar = "]"; }
else if(dText+"^" > sText) { currentChar = "["; }
else if(dText+"_" > sText) { currentChar = "^"; }
else if(dText+"`" > sText) { currentChar = "_"; }
else if(dText+"{" > sText) { currentChar = "`"; }
else if(dText+"|" > sText) { currentChar = "{"; }
else if(dText+"}" > sText) { currentChar = "|"; }
else if(dText+"~" > sText) { currentChar = "}"; }
else if(dText+"~~" > sText){ currentChar = "~"; }

dText = dText + currentChar;
}
return(pos);
}
They are both limited when it comes to characters, and won't resolve a "zzzz" string correctly for now. Furthermore, It can't compare uppercase with lowercase. But this is a progress nontheless.

I'll write some simple functions to take further advantage of this. And I'm also including in my next update to the QV triggers for AoM.

Any thoughs? .
-invent00r

My Work: 1 2 3 4 5 6 7 8 9 10

WIP: Master XS Battle Micro AI
Paused: AI (%4.247)
Os segredos são de quem os souber guardar.

[This message has been edited by invent00r (edited 03-07-2008 @ 05:13 PM).]

Replies:
posted 04 March 2008 05:17 PM EDT (US)     1 / 12  
Oooh, nice. That was probably the only way you could have done it. Did you use an ASCII table to find out those?
while(true) // To infinty, and beyond!
-_-"
I wrote just about the same thing at my while(true) loop for my school project.



P.S.: did you somewhere hide your name from the user list? I never see you online anymore.

If we knew what it was we were doing, it would not be called research, would it? - Einstein, A.
Master XS - AoM Code Reference - Trigger Loader - Trigger Requests - Chess

Wow, I never thought that I would actually know something before nottud did... it's actually not all that satisfying ~ Steak
posted 04 March 2008 05:29 PM EDT (US)     2 / 12  
I was using the table, until - for some strange reason - I though they were inconsistent. So then I just checked each character with an if clause. They look like they are ASCII but I still prefer to test one by one just to be completely sure.
Quoted from Mythic_Freak:
I wrote just about the same thing at my while(true) loop for my school project.
Maybe you didn't mispelled infinity .

My online status was deselected indeed. But I can't ever see you on either.
-invent00r

My Work: 1 2 3 4 5 6 7 8 9 10

WIP: Master XS Battle Micro AI
Paused: AI (%4.247)
Os segredos são de quem os souber guardar.
posted 05 March 2008 07:57 AM EDT (US)     3 / 12  
Haha.

I noticed my was also disabled. Weird, I never came across the preference page before. Anyway, it's enabled now, it doesn't really matter.

Soo, are there any other functions you will work on? Like http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html#method_summary

If we knew what it was we were doing, it would not be called research, would it? - Einstein, A.
Master XS - AoM Code Reference - Trigger Loader - Trigger Requests - Chess

Wow, I never thought that I would actually know something before nottud did... it's actually not all that satisfying ~ Steak
posted 06 March 2008 04:33 PM EDT (US)     4 / 12  
I'll be doing a express\Val - converts a string to a number, and to lower\upper case.

And possibly, if I have the time, the toString() function.
-invent00r

My Work: 1 2 3 4 5 6 7 8 9 10

WIP: Master XS Battle Micro AI
Paused: AI (%4.247)
Os segredos são de quem os souber guardar.
posted 06 March 2008 04:52 PM EDT (US)     5 / 12  
Why not first the easy work? Like charAt() (just a specific substring). Very useful.

What will the toString do? It's usually used with objects to print them out with all necessairy info, but if you already have a string...

If we knew what it was we were doing, it would not be called research, would it? - Einstein, A.
Master XS - AoM Code Reference - Trigger Loader - Trigger Requests - Chess

Wow, I never thought that I would actually know something before nottud did... it's actually not all that satisfying ~ Steak
posted 07 March 2008 05:03 PM EDT (US)     6 / 12  
Quoted from Mythic_Freak:
What will the toString do? It's usually used with objects to print them out with all necessairy info, but if you already have a string...
Yes - it returns itself! .

New functions:
string charAt(string sText = "", int pos = 1)
{
return(subStr(sText, pos, 1));
}

string toUpperCase(string sText = "")
{
string dText = "";
string currentChar = "";

while(true) // To infinity, and beyond!
{
if(dText == sText)
break;

currentChar = "";

if(dText+" " > sText) { currentChar = ""; }
else if(dText+"!" > sText) { currentChar = " "; }
else if(dText+"\"" > sText){ currentChar = "!"; }
else if(dText+"#" > sText) { currentChar = "\""; }
else if(dText+"$" > sText) { currentChar = "#"; }
else if(dText+"%" > sText) { currentChar = "$"; }
else if(dText+"&" > sText) { currentChar = "%"; }
else if(dText+"'" > sText) { currentChar = "&"; }
else if(dText+"(" > sText) { currentChar = "'"; }
else if(dText+")" > sText) { currentChar = "("; }
else if(dText+"*" > sText) { currentChar = ")"; }
else if(dText+"+" > sText) { currentChar = "*"; }
else if(dText+"," > sText) { currentChar = "+"; }
else if(dText+"-" > sText) { currentChar = ","; }
else if(dText+"." > sText) { currentChar = "-"; }
else if(dText+"/" > sText) { currentChar = "."; }
else if(dText+"0" > sText) { currentChar = "/"; }
else if(dText+"1" > sText) { currentChar = "0"; }
else if(dText+"2" > sText) { currentChar = "1"; }
else if(dText+"3" > sText) { currentChar = "2"; }
else if(dText+"4" > sText) { currentChar = "3"; }
else if(dText+"5" > sText) { currentChar = "4"; }
else if(dText+"6" > sText) { currentChar = "5"; }
else if(dText+"7" > sText) { currentChar = "6"; }
else if(dText+"8" > sText) { currentChar = "7"; }
else if(dText+"9" > sText) { currentChar = "8"; }
else if(dText+":" > sText) { currentChar = "9"; }
else if(dText+";" > sText) { currentChar = ":"; }
else if(dText+"<" > sText) { currentChar = ";"; }
else if(dText+"=" > sText) { currentChar = "<"; }
else if(dText+">" > sText) { currentChar = "="; }
else if(dText+"?" > sText) { currentChar = ">"; }
else if(dText+"@" > sText) { currentChar = "?"; }
else if(dText+"A" > sText) { currentChar = "@"; }
else if(dText+"B" > sText) { currentChar = "A"; }
else if(dText+"C" > sText) { currentChar = "B"; }
else if(dText+"D" > sText) { currentChar = "C"; }
else if(dText+"E" > sText) { currentChar = "D"; }
else if(dText+"F" > sText) { currentChar = "E"; }
else if(dText+"G" > sText) { currentChar = "F"; }
else if(dText+"H" > sText) { currentChar = "G"; }
else if(dText+"I" > sText) { currentChar = "H"; }
else if(dText+"J" > sText) { currentChar = "I"; }
else if(dText+"K" > sText) { currentChar = "J"; }
else if(dText+"L" > sText) { currentChar = "K"; }
else if(dText+"M" > sText) { currentChar = "L"; }
else if(dText+"N" > sText) { currentChar = "M"; }
else if(dText+"O" > sText) { currentChar = "N"; }
else if(dText+"P" > sText) { currentChar = "O"; }
else if(dText+"Q" > sText) { currentChar = "P"; }
else if(dText+"R" > sText) { currentChar = "Q"; }
else if(dText+"S" > sText) { currentChar = "R"; }
else if(dText+"T" > sText) { currentChar = "S"; }
else if(dText+"U" > sText) { currentChar = "T"; }
else if(dText+"V" > sText) { currentChar = "U"; }
else if(dText+"W" > sText) { currentChar = "V"; }
else if(dText+"X" > sText) { currentChar = "W"; }
else if(dText+"Y" > sText) { currentChar = "X"; }
else if(dText+"Z" > sText) { currentChar = "Y"; }
else if(dText+"[" > sText) { currentChar = "Z"; }
else if(dText+"\\" > sText){ currentChar = "["; }
else if(dText+"]" > sText) { currentChar = "\\"; }
else if(dText+"[" > sText) { currentChar = "]"; }
else if(dText+"^" > sText) { currentChar = "["; }
else if(dText+"_" > sText) { currentChar = "^"; }
else if(dText+"`" > sText) { currentChar = "_"; }
else if(dText+"{" > sText) { currentChar = "`"; }
else if(dText+"|" > sText) { currentChar = "{"; }
else if(dText+"}" > sText) { currentChar = "|"; }
else if(dText+"~" > sText) { currentChar = "}"; }
else if(dText+"~~" > sText){ currentChar = "~"; }

dText = dText + currentChar;
}
return(dText);
}

string toLowerCase(string sText = "")
{
string dText = "";
string currentChar = "";

while(true) // To infinity, and beyond!
{
if(dText == sText)
break;

currentChar = "";

if(dText+" " > sText) { currentChar = ""; }
else if(dText+"!" > sText) { currentChar = " "; }
else if(dText+"\"" > sText){ currentChar = "!"; }
else if(dText+"#" > sText) { currentChar = "\""; }
else if(dText+"$" > sText) { currentChar = "#"; }
else if(dText+"%" > sText) { currentChar = "$"; }
else if(dText+"&" > sText) { currentChar = "%"; }
else if(dText+"'" > sText) { currentChar = "&"; }
else if(dText+"(" > sText) { currentChar = "'"; }
else if(dText+")" > sText) { currentChar = "("; }
else if(dText+"*" > sText) { currentChar = ")"; }
else if(dText+"+" > sText) { currentChar = "*"; }
else if(dText+"," > sText) { currentChar = "+"; }
else if(dText+"-" > sText) { currentChar = ","; }
else if(dText+"." > sText) { currentChar = "-"; }
else if(dText+"/" > sText) { currentChar = "."; }
else if(dText+"0" > sText) { currentChar = "/"; }
else if(dText+"1" > sText) { currentChar = "0"; }
else if(dText+"2" > sText) { currentChar = "1"; }
else if(dText+"3" > sText) { currentChar = "2"; }
else if(dText+"4" > sText) { currentChar = "3"; }
else if(dText+"5" > sText) { currentChar = "4"; }
else if(dText+"6" > sText) { currentChar = "5"; }
else if(dText+"7" > sText) { currentChar = "6"; }
else if(dText+"8" > sText) { currentChar = "7"; }
else if(dText+"9" > sText) { currentChar = "8"; }
else if(dText+":" > sText) { currentChar = "9"; }
else if(dText+";" > sText) { currentChar = ":"; }
else if(dText+"<" > sText) { currentChar = ";"; }
else if(dText+"=" > sText) { currentChar = "<"; }
else if(dText+">" > sText) { currentChar = "="; }
else if(dText+"?" > sText) { currentChar = ">"; }
else if(dText+"@" > sText) { currentChar = "?"; }
else if(dText+"a" > sText) { currentChar = "@"; }
else if(dText+"b" > sText) { currentChar = "a"; }
else if(dText+"c" > sText) { currentChar = "b"; }
else if(dText+"d" > sText) { currentChar = "c"; }
else if(dText+"e" > sText) { currentChar = "d"; }
else if(dText+"f" > sText) { currentChar = "e"; }
else if(dText+"g" > sText) { currentChar = "f"; }
else if(dText+"h" > sText) { currentChar = "g"; }
else if(dText+"i" > sText) { currentChar = "h"; }
else if(dText+"j" > sText) { currentChar = "i"; }
else if(dText+"k" > sText) { currentChar = "j"; }
else if(dText+"l" > sText) { currentChar = "k"; }
else if(dText+"m" > sText) { currentChar = "l"; }
else if(dText+"n" > sText) { currentChar = "m"; }
else if(dText+"o" > sText) { currentChar = "n"; }
else if(dText+"p" > sText) { currentChar = "o"; }
else if(dText+"q" > sText) { currentChar = "p"; }
else if(dText+"r" > sText) { currentChar = "q"; }
else if(dText+"s" > sText) { currentChar = "r"; }
else if(dText+"t" > sText) { currentChar = "s"; }
else if(dText+"u" > sText) { currentChar = "t"; }
else if(dText+"v" > sText) { currentChar = "u"; }
else if(dText+"w" > sText) { currentChar = "v"; }
else if(dText+"x" > sText) { currentChar = "w"; }
else if(dText+"y" > sText) { currentChar = "x"; }
else if(dText+"z" > sText) { currentChar = "y"; }
else if(dText+"[" > sText) { currentChar = "z"; }
else if(dText+"\\" > sText){ currentChar = "["; }
else if(dText+"]" > sText) { currentChar = "\\"; }
else if(dText+"[" > sText) { currentChar = "]"; }
else if(dText+"^" > sText) { currentChar = "["; }
else if(dText+"_" > sText) { currentChar = "^"; }
else if(dText+"`" > sText) { currentChar = "_"; }
else if(dText+"{" > sText) { currentChar = "`"; }
else if(dText+"|" > sText) { currentChar = "{"; }
else if(dText+"}" > sText) { currentChar = "|"; }
else if(dText+"~" > sText) { currentChar = "}"; }
else if(dText+"~~" > sText){ currentChar = "~"; }

dText = dText + currentChar;
}
return(dText);
}

float toNumber(string sText = "")
{
float number = 0.0;
float multiplayer = 10.0; // We will this to increment the number in the rigth position.
// It will increase by 10 as we add more numbers, decrease 10 when we find a .
bool isNegative = false; // We all like to be positive. =)

string dText = "";
string currentChar = "";

while(true)
{
if(dText == sText)
break;

int currentNumber = -1;

if(dText+"-" > sText) { currentChar = "I'm so Fabulicious OMG!!!"; }
else if(dText+"." > sText) { isNegative = true; currentChar = "-"; }
else if(dText+"0" > sText) { currentChar = "."; multiplayer = 0.1; } // Slash Dot Dash dot dot dot dot com
else if(dText+"1" > sText) { currentChar = "0"; currentNumber = 0; }
else if(dText+"2" > sText) { currentChar = "1"; currentNumber = 1; }
else if(dText+"3" > sText) { currentChar = "2"; currentNumber = 2; }
else if(dText+"4" > sText) { currentChar = "3"; currentNumber = 3; }
else if(dText+"5" > sText) { currentChar = "4"; currentNumber = 4; }
else if(dText+"6" > sText) { currentChar = "5"; currentNumber = 5; }
else if(dText+"7" > sText) { currentChar = "6"; currentNumber = 6; }
else if(dText+"8" > sText) { currentChar = "7"; currentNumber = 7; }
else if(dText+"9" > sText) { currentChar = "8"; currentNumber = 8; }
else if(dText+":" > sText) { currentChar = "9"; currentNumber = 9; }
else { return(-1.0); } // We only accept the above characters.

dText = dText + currentChar;

if(currentNumber != -1)
{
if(multiplayer == 10.0)
{
number = 1*(number*10.0+currentNumber);
}
else
{
number = number + multiplayer*currentNumber;
multiplayer = multiplayer*0.1;
}
}
}

if(isNegative)
return(-1.0*number);
return(number);
}


-invent00r

My Work: 1 2 3 4 5 6 7 8 9 10

WIP: Master XS Battle Micro AI
Paused: AI (%4.247)
Os segredos são de quem os souber guardar.
posted 07 March 2008 06:03 PM EDT (US)     7 / 12  
I didn't test this yet, but I'm sure it will work.
float multiplayer = 10.0; // We will this to increment the number in the rigth position.
In a hurry somewhere? Multiplier is what you need.

Oh well, up to regular expressions I'd say!

If we knew what it was we were doing, it would not be called research, would it? - Einstein, A.
Master XS - AoM Code Reference - Trigger Loader - Trigger Requests - Chess

Wow, I never thought that I would actually know something before nottud did... it's actually not all that satisfying ~ Steak
posted 07 March 2008 06:27 PM EDT (US)     8 / 12  
I was going to type multiplier but the word complete suggested me multiplayer and I said - "boy, aren't you funny?".

I didn't perform any intensive test on the special characters.
And also, the toNumber will return rounds results if decimal values are involved - for some strange reason. Like: "12.1" = 12.09976...
-invent00r

My Work: 1 2 3 4 5 6 7 8 9 10

WIP: Master XS Battle Micro AI
Paused: AI (%4.247)
Os segredos são de quem os souber guardar.
posted 08 March 2008 05:28 AM EDT (US)     9 / 12  
BTW, do you know eclipse? It's an open-source SDK. The original version is for java, but you can download lots of plug-ins for C, perl etc. It would be nice if I could figure out how to make an 'aom xs' plugin for it, but I don't have a clue how.

Actually, it would jusy have to be a c++ plugin ripoff, but with some more functions/primitive types for word complete.

If we knew what it was we were doing, it would not be called research, would it? - Einstein, A.
Master XS - AoM Code Reference - Trigger Loader - Trigger Requests - Chess

Wow, I never thought that I would actually know something before nottud did... it's actually not all that satisfying ~ Steak
posted 14 March 2008 05:45 PM EDT (US)     10 / 12  
Yes, that was the 1st thing I tried when I started learning how to script AoMs AI.
I was quite uncessful at it tho...

It would be really great if you could get it to work. .
-invent00r

My Work: 1 2 3 4 5 6 7 8 9 10

WIP: Master XS Battle Micro AI
Paused: AI (%4.247)
Os segredos são de quem os souber guardar.
posted 07 May 2008 11:23 AM EDT (US)     11 / 12  
I'm bringing this back to life because it is an important discovery, though I'm not sure how many people can use it. When you say you will triggerify it, you mean that you can create this function just like global vars were created, so that these functions can be used in custom effects/conditions right? That would mean declaring the function at the global level in the trigger.xs file I presume....

Oh.... I just realized that we're not in Kansas anymore, Toto....

This is under AI/RMS Scripting....


In all your science of the mind, seeking blind through flesh and bone
Find the blood inside this stone
Well, I know I've never shown what I feel, I've always known
I plan my vengeance on my own - and I was always alone

[This message has been edited by Elrich (edited 05-07-2008 @ 11:36 AM).]

posted 08 May 2008 04:07 AM EDT (US)     12 / 12  
Maybe if you read through this, you'll be able to understand it a little better: http://aom.heavengames.com/cgi-bin/forums/display.cgi?action=ct&f=19,26582,,all

Triggers created in the editor are just rules (similar to void f(void) {/*...*/} functions that run on a timed interval), and you can manually end them (see link). Then you can put global vars, but also functions into the trigtemp.xs file. It would of course require you to first invoke the "Load Custom Functions" trigger. From then on you can use them in any trigger script just like any other tr/kb/console command. It could also be used in the send chat effect for example.


But I'm a bit busy for uni at the moment, and exams are nearing, so it might take a while. The idea is that the load trigger contains math functions, string functions, for player setup, some misc functions and for vanilla the QVs. Any other suggestions welcome.

If we knew what it was we were doing, it would not be called research, would it? - Einstein, A.
Master XS - AoM Code Reference - Trigger Loader - Trigger Requests - Chess

Wow, I never thought that I would actually know something before nottud did... it's actually not all that satisfying ~ Steak
Age of Mythology Heaven » Forums » Modding and Scripting » XS String Manipulation
Top
You must be logged in to post messages.
Please login or register
Hop to:    
Age of Mythology Heaven | HeavenGames