apex
Junior Member
Posts: 20
Joined: Mar 2008
|
O.P. My script gets auto-disabled on logout, Any help?
Hey all, I have this script, for PSM Chat, but when i log out, msg plus disables it. Auto, wich sucks.
So does any1 knows where the bug is ?
Here is the script:
code: var d = new Date();
time = d.getMonth() + 1;
oldpsm = "";
isxmason = "0";
test = "";
function OnEvent_Uninitialize(MessengerExit)
{
}
function OnEvent_Initialize(MessengerStart)
{
TurnOn();
var test="";
oldpsm = Messenger.MyPersonalMessage;
var fso = new ActiveXObject("Scripting.FileSystemObject");
filehandle = fso.OpenTextFile(MsgPlus.ScriptFilesPath+"\\Config.ini",1);
filecontents = filehandle.ReadAll();
checkpsm = filecontents.split("[currentpsm]")[1].split("[/currentpsm]")[0];
filehandle.close();
if (oldpsm == checkpsm){
Messenger.MyPersonalMessage = checkpsm;
} else if (oldpsm != checkpsm && checkpsm != "") {
msgbox("Je huidige PSM komt niet overeen met de laatst opgeslagen PSM, Ga alstublieft naar PSM Instellingen om dit te verhelpen.\nAls je dit niet verhelpt, kan PSM Chat mogelijk niet goed werken.");
} else {
var fso = new ActiveXObject("Scripting.FileSystemObject");
filehandle = fso.OpenTextFile(MsgPlus.ScriptFilesPath+"\\Config.ini",2);
data = "[currentpsm]" + Messenger.MyPersonalMessage + "[/currentpsm]";
filehandle.Write(data);
msgbox("PSM Chat is ingesteld..\n\nThis bericht zou niet nog eens moeten verschijnen, neem anders contact op met de scriptor.");
filehandle.close();
}
}
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MessageKind)
{
if (test == "on")
{
var name = MsgPlus.RemoveFormatCodes(Origin.substring(0,25));
if (name == Messenger.Myname) {
if(Message.substring(0,1) == "~") {
damessage = Message.substring(1,500);
ChatWnd.SendMessage("");
}
} else {
if(Message.substring(0,1) == "~") {
damessage = Message.substring(1,500);
Messenger.MyPersonalMessage = "" + name + " zegt: " + damessage + " - Jou berichtje hier?Typ een ~ voor je berichtje!";
ChatWnd.SendMessage(" Je berichtje: " + "" + damessage + "" + " staat erin! " );
MsgPlus.DisplayToast("PSM Chat","PSM veranderd in: " + damessage + ".");
}
}
}
}
And:
code: oldpsm=Messenger.MyPersonalMessage;
var fso = new ActiveXObject("Scripting.FileSystemObject");
filehandle = fso.OpenTextFile(MsgPlus.ScriptFilesPath+"\\Config.ini",1);
filecontents = filehandle.ReadAll();
oldpsm = filecontents.split("[currentpsm]")[1].split("[/currentpsm]")[0];
filehandle.close();
function OnGetScriptMenu(Location)
{
if (Location == 1 || Location == 2)
{
var ScriptMenu = "<ScriptMenu>";
ScriptMenu += "<MenuEntry Id=\"MnuOn\">Aanzetten</MenuEntry>";
ScriptMenu += "<MenuEntry Id=\"MnuOff\">Uitzetten</MenuEntry>";
ScriptMenu += "<Separator/>";
ScriptMenu += "<MenuEntry Id=\"MnuReset\">Reset</MenuEntry>";
ScriptMenu += "<Separator/>";
ScriptMenu += "<MenuEntry Id=\"MnuConf\">Instellingen</MenuEntry>";
ScriptMenu += "<MenuEntry Id=\"MnuAbout\">Over</MenuEntry>";
ScriptMenu += "</ScriptMenu>";
return ScriptMenu;
}
}
function OnEvent_MenuClicked(Id, Location, OrgWnd)
{
if (Id == "MnuOn")
TurnOn();
if (Id == "MnuOff")
TurnOff();
if (Id == "MnuReset")
Reset();
if (Id == "MnuConf")
Conf();
if (Id == "MnuAbout")
About();
}
function About()
{
MsgPlus.CreateWnd("dialogues.xml", "About");
}
function msgbox(msg)
{
Interop.Call("User32.dll", "MessageBoxW", 0,msg,"PSM Chat", 0);
}
function Conf()
{
var Wnd = MsgPlus.CreateWnd("dialogues.xml", "Conf");
var fso = new ActiveXObject("Scripting.FileSystemObject");
filehandle = fso.OpenTextFile(MsgPlus.ScriptFilesPath+"\\Config.ini",1);
filecontents = filehandle.ReadAll();
oldpsm = filecontents.split("[currentpsm]")[1].split("[/currentpsm]")[0];
filehandle.close();
thecurrentpsm = oldpsm;
Wnd.SetControlText("curpsm",thecurrentpsm);
}
function Reset()
{
if(test == "on") {
Messenger.MyPersonalMessage = "Mijn PSM chat staat aan, vraag me hoe het werkt!";
MsgPlus.DisplayToast("PSM Chat","Reset");
} else if(test == "off") {
var fso = new ActiveXObject("Scripting.FileSystemObject");
filehandle = fso.OpenTextFile(MsgPlus.ScriptFilesPath+"\\Config.ini",1);
filecontents = filehandle.ReadAll();
oldpsm = filecontents.split("[currentpsm]")[1].split("[/currentpsm]")[0];
filehandle.close();
Messenger.MyPersonalMessage = oldpsm;
MsgPlus.DisplayToast("PSM Chat","Reset");
} else if(test == "") {
var fso = new ActiveXObject("Scripting.FileSystemObject");
filehandle = fso.OpenTextFile(MsgPlus.ScriptFilesPath+"\\Config.ini",1);
filecontents = filehandle.ReadAll();
oldpsm = filecontents.split("[currentpsm]")[1].split("[/currentpsm]")[0];
filehandle.close();
Messenger.MyPersonalMessage = oldpsm;
MsgPlus.DisplayToast("PSM Chat","NOT RUNNING.");
}
}
function Refresh()
{
if(test == "on") {
Messenger.MyPersonalMessage = "Jou berichtje hier? Typ: ~ plus je berichtje!";
} else if(test == "off" || test == "") {
var fso = new ActiveXObject("Scripting.FileSystemObject");
filehandle = fso.OpenTextFile(MsgPlus.ScriptFilesPath+"\\Config.ini",1);
filecontents = filehandle.ReadAll();
oldpsm = filecontents.split("[currentpsm]")[1].split("[/currentpsm]")[0];
filehandle.close();
Messenger.MyPersonalMessage = oldpsm;
}
}
function TurnOn()
{
test = "on";
MsgPlus.DisplayToast("PSM by Jules Huls","Status is: " + test + ".");
Messenger.MyPersonalMessage = "Jou berichtje hier? Typ: ~<bericht>";
}
function TurnOff()
{
test = "off";
MsgPlus.DisplayToast("PSM by Jules Huls","Status is: " + test + ".");
Messenger.MyPersonalMessage = oldpsm;
}
function OnConfEvent_CtrlClicked(PlusWnd,ControlId) {
if (ControlId == "BtnSave") {
var fso = new ActiveXObject("Scripting.FileSystemObject");
filehandle = fso.OpenTextFile(MsgPlus.ScriptFilesPath+"\\Config.ini",2);
thenewpsm = PlusWnd.GetControlText("newpsm2");
data = "[currentpsm]" + thenewpsm + "[/currentpsm]";
filehandle.Write(data);
msgbox("Je nieuwe PSM is opgeslagen.");
filehandle.close();
var fso = new ActiveXObject("Scripting.FileSystemObject");
filehandle = fso.OpenTextFile(MsgPlus.ScriptFilesPath+"\\Config.ini",1);
filecontents = filehandle.ReadAll();
thecurrentpsm = filecontents.split("[currentpsm]")[1].split("[/currentpsm]")[0];
filehandle.close();
PlusWnd.SetControlText("curpsm",thecurrentpsm);
PlusWnd.SetControlText("newpsm2","");
Refresh();
}
}
Yes, i know it can be a simple thing, im just starting to create scripts, but this ain't mine, and the scriptor stopped, and i can't figure it out.
~Apex
|
|