|
Post by cafall on Feb 26, 2009 0:53:25 GMT
Hey, another question about SIMTools. I recently installed it for the PW I've been helping out on, and I've been tailoring it to the server's needs. I ran into a couple issues just now, though:
1. DM Tools. This isn't a problem, more of a question. It looks like there are a few wands in DMFI that aren't replicated by SIMTools: the sound wand (which generates a sound effect at the targetted location) and the affliction wand (which applies a number of negative effects to the target) are my main concerns. Before I pull the wands out of DMFI for the server, I just want to make sure: SIMTools doesn't do either of these functions, does it?
2. Languages. I've been trying to find a way to cut the <> brackets out of PC's speech when they speak languages. I was able to cut it out of the language-ified text, no problem. However, the plain english text is proving harder to crack. I added a small function to parse the brackets out of the text:
string cf_CutBrackets(string sParse) { // find the location of the start bracket int nSymbolPos = FindSubString(sParse, "<"); // Recreate sParse, but exclude the bracket sParse = GetStringLeft(sParse, nSymbolPos)+GetStringRight(sParse, (GetStringLength(sParse) - (nSymbolPos - 1)) );
// find the location of the end bracket nSymbolPos = FindSubString(sParse, ">"); // Recreate sParse, but exclude the bracket sParse = GetStringLeft(sParse, nSymbolPos)+GetStringRight(sParse, (GetStringLength(sParse) - (nSymbolPos - 1)) );
return sParse; }
It ought to work, but I can't figure out where to add it. I tried putting it in the HandleTalkSpeak() function, but when I tested it, the server gave me a "TOO MANY INSTRUCTIONS" error message and failed to process the text at all. Does anyone have any tips on this?
|
|
|
Post by FunkySwerve on Feb 26, 2009 1:35:34 GMT
1. Nope, SIMTools does neither of those, though you could certainly add commands if you felt like it. If you're using DMFI, make sure all the convos have a bailout check for GetIsDM. Otherwise players will edit themselves to have DMFI convos as their conversation field, allowing them to access the wand functions, simply by having another player talk to them. I believe the newest version of DMFI has already added such checks.
2. Without seeing more, it's impossible to tell what might be causing the TMI. Which brackets are you trying to parse out, anyway? I'm not aware of any that look like < or > in the default language operations, though it's been a LONG time since I playtested in a vanilla SIMTools environment. The square brackets surrounding the name of the language being spoken could be removed much more easily, if those are the ones you mean. The ones in front of the character name with 'Tell' in them cannot be removed. I should be able to help if you want to clarify which you mean.
Funky
|
|
|
Post by cafall on Feb 26, 2009 2:14:00 GMT
Sure. What I meant by brackets is these: <>. They're in the Process*() functions; there's a special IF statement to stop translation of anything between the brackets.
I'm trying to keep that functionality, but remove the brackets from a PC's speech text. Text between them would still be untranslated, other PCs just wouldn't see the brackets. I've fixed the language half of the text by adding a little code to the Process*() function, it works fine. It's just editing the original, untranslated chat message that I can't figure out.
Is there anything else I can give you that would give you more info? I'd be grateful for the help.
|
|
|
Post by FunkySwerve on Feb 26, 2009 5:32:36 GMT
You should be using *, not < and >, for that. The reason those are not translated is so that color codes come through properly. If you remove them, they'll break. *s also don't translate text between them, for emotes. Is that your intended use, or is it something other than that?
Funky
|
|
|
Post by cafall on Feb 26, 2009 20:39:09 GMT
Sorry -- I really didn't explain myself too well. I never knew those brackets were for color tags. Did you add that for the player's use, or does the system use color tags for something I didn't know about?
The server I'm working on is of the RP type. Although we do use emotes, we also use the brackets to block translation of things that AREN'T emotes: place names, char names, etc. Without brackets, it would be like running "I live in Oklahoma" through a (bad) French translator: You'd get the first three words in French, but "Oklahoma" would be garbled and unrecognizable. Our solution is to type "I live in <Oklahoma>."
We never use color tags. And since it's kind of jarring to read someone's chat messages laced with brackets in places, I'm trying to find a way to parse them out of the text (after it's translated). That way text between them would remain untranslated, but nobody would see the brackets.
In a couple hours I'll be back at my home computer, then I'll dig through the code and try to find anything that could help, and take a screenshot of that TMI error if that helps.
|
|
|
Post by Acaos on Feb 26, 2009 20:46:51 GMT
I recommend using some other type of bracket, such as []. The <> brackets are used by the NWN engine itself.
Acaos
|
|
|
Post by cafall on Feb 27, 2009 0:36:51 GMT
Thanks, Acaos. I took your advice and switched to [] brackets.
However, I'm still having the same problem. Here's the code I inserted in HandleTalkSpeak: // This is the line above my code (I inserted it right after the translation call). string sConvert = TranslateCommonToLanguage(nLang, sTSText);
// Look for a start bracket in the original text. int nBracket = FindSubString(sTSText, "["); if (nBracket != -1) { // If a bracket exists, we call a function to cut the brackets. sTSText = cf_CutBrackets(sTSText, nBracket); }
And here's my cf_CutBrackets() function.
string cf_CutBrackets(string sParse, int nSymbolPos) { while (nSymbolPos != -1) { // Recreate sParse, but exclude the bracket sParse = GetStringLeft(sParse, nSymbolPos)+GetStringRight(sParse, (GetStringLength(sParse) - (nSymbolPos + 1)) );
// find the location of the end bracket nSymbolPos = FindSubString(sParse, "]"); // Recreate sParse, but exclude the bracket sParse = GetStringLeft(sParse, nSymbolPos)+GetStringRight(sParse, (GetStringLength(sParse) - (nSymbolPos + 1)) );
// find the location of the start bracket nSymbolPos = FindSubString(sParse, "["); }
return sParse; }
This code seems like it should work, but it doesn't. When I test the brackets in the game, the server hangs for a couple seconds, then my PC speaks the untranslated string (as if the entire language script cancelled) and I get this TMI error:
Script fky_chat, OID: fffffffd, Tag: , ERROR: TOO MANY INSTRUCTIONS
The culprit for the TMI error seems to be the while loop in the cf_CutBrackets() function. When I commented it out, the brackets tested perfectly. But one small while loop doesn't seem like a lot to ask of this system. Plus without it, the script will only parse out one set of brackets per chat message, which would pretty much suck.
So I'm a little stuck. I'd be very grateful if anyone has any ideas.
|
|
|
Post by cafall on Feb 27, 2009 0:57:34 GMT
Erm, yeah, so I think I just solved it. I changed the condition for that while loop to:
while (TestStringAgainstPattern("**[**", sParse))
Now the TMI error is gone, and everything works smoothly. Hopefully it will stay that way.
|
|