Shoutbox

Another Little Problem! For u no problem! - 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: Another Little Problem! For u no problem! (/showthread.php?tid=89871)

Another Little Problem! For u no problem! by NorteX on 03-25-2009 at 04:51 PM

Hey,

i have already 2 scripts who tell the ppl random 25 sentences automatically when i type /sc1 and /sc2 that are the 2 scripts for conversations... Example: I type with my best friend and type /sc1 then i press the enter button and the script replace it with a random sentence from my script....

now thats the problem ....i wanted to do a third script that when i type for exemple /both that he replaces this with either /sc1 or /sc2 ... i have made such a script... he also replaces and types but then when i use this script ... he only types /sc1 or /sc2 and sends it .... not even replace it ... (u know? ^^) then when i would type with my fingers the /sc1 or /sc2 ... its as normal (replaced through random sentences...)


so i ask u why its not working?




my script for the /both is:

function OnEvent_ChatWndSendMessage(ChatWnd,Message){
var rn_txt = new Array();

rn_txt[1] = "hmmm...";
rn_txt[2] = "/sc1";
rn_txt[3] = "Hey This is a Bot ";
rn_txt[4] = "/sc2";


var i = Math.round(4*Math.random());
var RANDOMISM = Message.replace(/\/both/,rn_txt[i]);
return RANDOMISM;
}




Hope someone can help me in both Topics


RE: Another Little Problem! For u no problem! by matty on 03-25-2009 at 05:25 PM

I am so confused...

Are you saying that when you try to develop a script and use /both as the command it is supposed to replace /both with either /sc1 or /sc2 but instead it just sends the text? Am I understanding that correctly?


RE: Another Little Problem! For u no problem! by NorteX on 03-25-2009 at 05:59 PM

yeah i have 2 plugins which when i type /sc1 in chat with my friend, it types a random sentence from 50 sentences which are saved - the second plugin replaces it when I type /sc2 .... so now i want a third script that when i go AWAY( idle) autoanswers /both (or something like this) which now will be the plugin that /both is replaced through /sc1 or /sc2 in random .... but my script which i posted always only writes the /sc1 and /sc2 to my friend in chat instead of replacing it automatically with the plugin based sentences for this 2 commands (sc1 and sc2) .... but when i then type it again to check if the other 2 plugins are possibly not working i am surprised to see that if i press enter the plugins replace it....

so shortly my third plugin types the /sc1 and /sc2 but then when the plugin sends the letters its not replaced through the sc1 and sc2 plugin-sentences - when i myself type the /sc1 and press [Enter] it is replaced...


some kind of confusing to me because in the other script i only said type and send /sc1 or /sc2 and it does but it doesnt replace ...-.-

i hope u understand xD


RE: Another Little Problem! For u no problem! by CookieRevised on 03-26-2009 at 02:23 AM

Number one solution: make those three seperate scripts into one script.

Because, as it is now, you most likely also have a lot of double code in script 1 (/sc1) and 2 (/sc2). If you find a bug in script 1, you might forget to fix it in script 2, updating means you need to update 2 scripts each time, etc... There are a lot of disadvantages if you work with three different (yet 99,999% the same) scripts like that. So, I bet those 3 scripts can be made in just one, much shorter, script.

There are a lot of examples on this forum and on the official scripts database which show you how to react on different commands from within the same script.

;)