Different shapeName for Kork than Me?
by Nmuta Jones · in Torque Game Engine · 07/17/2008 (4:15 pm) · 4 replies
When a player enters a trigger, I am writing the shapename and location to file.
here is my code:
And here is what is being written to file. This is wild !!!!!!
Kork's shape name comes out as is....."Kork".
But My shape name, (which I've set by just giving my player a name before mission starts) is saved as
"\x10\c8Shem\x11";
The given name of the player is "Shem". that's the output I need.
clearly the engine is putting the prefixes and suffixes based on the fact that is a user defined shapename. I don't want to parse the string to extract out the first four characters, etc. because I don't know how big or small the prefix will ever be.
here's the output.
Interestingly enough, when the engine echoes it in the centerprint function, it removes the \x10\c8 etc. stuff and just prints the name.
This is a very interesting problem, I hope someone can help with it. Thanks.
here is my code:
$mynew::trans = %obj.getTransform();
$mynew::thename = %obj.getShapeName();
centerprint(%obj.client, "Checkpoint for "@$mynew::thename, 2,1);
%savespot = "./../../client/revealme.cs";
export("$mynew::*", %savespot, true); And here is what is being written to file. This is wild !!!!!!
Kork's shape name comes out as is....."Kork".
But My shape name, (which I've set by just giving my player a name before mission starts) is saved as
"\x10\c8Shem\x11";
The given name of the player is "Shem". that's the output I need.
clearly the engine is putting the prefixes and suffixes based on the fact that is a user defined shapename. I don't want to parse the string to extract out the first four characters, etc. because I don't know how big or small the prefix will ever be.
here's the output.
$mynew::thename = "\x10\c8Shem\x11"; $mynew::trans = "380.994 351.705 218.53 0 0 1 1.56547"; $mynew::thename = "\x10\c8Shem\x11"; $mynew::trans = "381.882 351.709 218.53 0 0 1 1.56547"; $mynew::thename = "Kork"; $mynew::trans = "456.963 302.457 221.08 0 0 1 2.72331";
Interestingly enough, when the engine echoes it in the centerprint function, it removes the \x10\c8 etc. stuff and just prints the name.
This is a very interesting problem, I hope someone can help with it. Thanks.
About the author
Lead Developer for MediaBreeze Multimedia
#2
So there will be a file in the client folder for each player who's ever played the game, and these files will contain important savegame info.
Again, I could remove the garbage out of the string, but I really don't want to do that because I don't know if those \x10\ and \x11\ variables are constant, or if the length of the extra string characters is a constant length on each side.
Maybe they are and I should just go ahead and parse the string. ? Looks like they are constant.
07/17/2008 (9:17 pm)
I should also add, the reason I need the pure player name without the extra stuff is because I will be using the actual shapename to create a .cs file. So there will be a file in the client folder for each player who's ever played the game, and these files will contain important savegame info.
Again, I could remove the garbage out of the string, but I really don't want to do that because I don't know if those \x10\ and \x11\ variables are constant, or if the length of the extra string characters is a constant length on each side.
Maybe they are and I should just go ahead and parse the string. ? Looks like they are constant.
#3
the output:
$mynew::thename = "\x10\c8Shem\x11";
$mynew::sub1 = "\x10\c8Shem\x11";
$mynew::sub2 = "\x10\c8Shem\x11";
you see? the x10 and x11 is not being deleted.
Any help would be appreciated.
07/19/2008 (6:29 am)
I am trying to delete the garbage out of my string. but it won't work:$mynew::thename = %obj.getShapeName();
$mynew::sub1= strreplace($mynew::thename,"x10" , "");
$mynew::sub2= strreplace($mynew::sub1, "x11","");
export("$mynew::*", %savespot, true);the output:
$mynew::thename = "\x10\c8Shem\x11";
$mynew::sub1 = "\x10\c8Shem\x11";
$mynew::sub2 = "\x10\c8Shem\x11";
you see? the x10 and x11 is not being deleted.
Any help would be appreciated.
#4
\x10\ , c8 and \x11\ must be some sort of non-standard characters.
so c8 , for example, is actually one character.
I discovered this because
getSubStr ("\x10\c8Nmta\x11",2,5)
returns "Nmta\x11"
but
getSubStr ("\x10\c8Nmta\x11",1,5)
returns
"\c8Nmta"
mind you, the original "\x10\c8Nmta\x11" string I'm getting is what the engine is outputting to file based on the shapename Nmta .
I am really doing
So I'm not manipulating raw strings, I'm manipulating something the engine has spit out based on the shapeName
When you output it to the screen using CenterPrint, it ignores those odd characters, probably because they are not ASCII characters or whatever. But when you output them to file, the garbage characters show up.
07/19/2008 (7:00 am)
Ok, I think i see what is happening.\x10\ , c8 and \x11\ must be some sort of non-standard characters.
so c8 , for example, is actually one character.
I discovered this because
getSubStr ("\x10\c8Nmta\x11",2,5)
returns "Nmta\x11"
but
getSubStr ("\x10\c8Nmta\x11",1,5)
returns
"\c8Nmta"
mind you, the original "\x10\c8Nmta\x11" string I'm getting is what the engine is outputting to file based on the shapename Nmta .
I am really doing
$mynew::thename = %obj.getShapeName(); $mynew::sub3= getSubStr($mynew::thename,1 , 5);
So I'm not manipulating raw strings, I'm manipulating something the engine has spit out based on the shapeName
When you output it to the screen using CenterPrint, it ignores those odd characters, probably because they are not ASCII characters or whatever. But when you output them to file, the garbage characters show up.
Torque Owner Nmuta Jones
"Shem"
when using the centerPrint() function and outputting it to screen, but comes out as
"\x10\c8Shem\x11"
when printed to file.