[Request] C/C++ Keywords Script - Printable Version -Shoutbox (https://shoutbox.menthix.net) +-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58) +--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4) +---- Forum: Scripting (/forumdisplay.php?fid=39) +----- Thread: [Request] C/C++ Keywords Script (/showthread.php?tid=62638) [Request] C/C++ Keywords Script by Paril on 07-06-2006 at 01:17 AM
Hello everyone. code: but that didn't work. I also tried.. code: The first one works, but it only works when I say "if" and nothing else. Any ideas? -Paril Aughven Kalashnikov RE: [Request] C/C++ Keywords Script by Silentdragon on 07-06-2006 at 01:26 AM
sMessage.replace(/if/gi,"[c=2]if[/c]); RE: [Request] C/C++ Keywords Script by Paril on 07-06-2006 at 01:29 AM Yeah, I thought of that.. RE: [Request] C/C++ Keywords Script by ShawnZ on 07-06-2006 at 01:29 AM
quote: sMessage is the whole message. in the first example, you check if the first letter is "if". in the second, you check if the whole message is "if". use Replace instead. RE: [Request] C/C++ Keywords Script by Paril on 07-06-2006 at 01:31 AM
Sorry for double post, but RE: [Request] C/C++ Keywords Script by Silentdragon on 07-06-2006 at 01:42 AM sMessage = sMessage.replace(/if/gi,"[c=2]if[/c]"); RE: [Request] C/C++ Keywords Script by ShawnZ on 07-06-2006 at 01:45 AM
quote: Again, think about it logically. sMessage is the _entire message._ You're checking to see if the entire message is equal to "if", which its not. RE: [Request] C/C++ Keywords Script by Paril on 07-06-2006 at 01:48 AM
Yeah, I replied before I saw your first message RE: [Request] C/C++ Keywords Script by ShawnZ on 07-06-2006 at 01:53 AM you could replace // with Alt0003-3// and replace linefeeds with Alt0003 RE: [Request] C/C++ Keywords Script by Paril on 07-06-2006 at 01:59 AM Could you post an example please? I am really no good at Jscript [Sorry for Double Post] Ok, I finished the part with the blue keywords Problem is, if I do a text that has one of the keywords in it, it turns that blue, example: [c=12]int[/c] ; i =ran[c=12]do[/c]m(1-10); // not real.. [c=12]switch[/c] { [c=12]case[/c] 1: pr[c=12]int[/c]f ("the number is 1"); [c=12]break[/c]; [c=12]case[/c] 2: printf ("dfh"); [c=12]break[/c]; [c=12]default[/c]: [c=12]printf[/c] ("it's not 1 or 2!"); [c=12]break[/c]; } Any way to stop it from doing like: ran[c=12]do[/c]m? Do I, like, change this sMessage = sMessage.replace(/do/gi,"[c=12]do[/c]"); to like sMessage = sMessage.replace(/do /gi,"[c=12]do[/c]"); and add a space after the first do, so it makes sure it's not part of current text? -Paril RE: [Request] C/C++ Keywords Script by Silentdragon on 07-06-2006 at 02:26 AM sMessage = sMessage.replace(/\bdo\b/gi,"[c=12]do[/c]"); RE: [Request] C/C++ Keywords Script by Paril on 07-06-2006 at 02:35 AM
Thank you [Sorry, yet again for dualpost] About the last post SilentDragon, how would I do that to this? sMessage = sMessage.replace("asm","[c=12]asm[/c]"); do I put asm in a var or something? EDIT: I was right -Paril [Triple, sorry ] Alright, I got a small block comment thing in. Problem is, if I do it with a blue keyword, it does this: [c=3]/*[c=12]true[/c]*/[/c] Any way to stop this? -Paril RE: [Request] C/C++ Keywords Script by matty on 07-06-2006 at 04:57 AM You should check to see if the keyword is a part of a multiline comment RE: [Request] C/C++ Keywords Script by Paril on 07-06-2006 at 05:00 AM I tried that, but it wouldn't let me use comments at all after that.. I must be doing it wrong, I'm not very good at Jscript.. |