is there somthing wrong with this 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: is there somthing wrong with this script..? (/showthread.php?tid=82677)
is there somthing wrong with this script..? by joosh00 on 03-26-2008 at 04:34 PM
Well ive started to creat this script, it sends random jokes when you tell it too. it all works fine exept for 1 bit, that bit is when you open a conversation and you click the script button its there but when i try and click on it it doesnt work, but it works if you type in the command. anyway please help...
Here is the script...
code: //This script is created by Josh Brand
//Version - 1.0
//Released
//Last Updated
//Created for the Messenger Plus!
/*Changelog
0.1 - Script Created
0.2 - Made it functional
0.3 - Fixed most spelling/grammar mistakes
0.4 - Fixed bugs and some more grammar mistakes
0.5 - Fixed "unidentified" error =D (first real bug solved!)
0.6 - Added other insults!
0.7 - Added about window! =D
1.0 - Final Version! Finally!
*/
var sArray = new Array();
sArray[0] = "How did the blonde try to kill the bird? She threw it off a cliff.";
sArray[1] = "Did you hear about the blonde secretary who cut her fingers off so that she could write short hand?";
sArray[2] = "Your mom's so fat that Nasa octually orbits her.";
sArray[3] = "I'm not a steady drinker - my hand shakes too much.'";
sArray[4] = "Yo momma so ugly, she make blind muthafuckas cry.";
sArray[5] = "1 Tequila, 2 Tequila, 3 Tequila, Floor.";
sArray[6] = "How do you start an onion race? Onion marks! Get set! Go!";
sArray[7] = "Your mom.";
sArray[8] = "Your mom owes me money, you douche!";
sArray[9] = "Just cause you went to prom with Merv the Perv.";
sArray[10] = "Your mom is like a brick, flat on both sides and gets laid by Mexicans.";
sArray[11] = "Your Mom has a really nice hat...";
sArray[12] = "Don't worry, Your Mom is still a virgin. You were a backdoor baby.";
sArray[13] = "Your mom is poop.";
function OnEvent_ChatWndSendMessage(ChatWnd, Message){
if(Message.substr(0,8).toLowerCase()=="/jokes"){
var i = Math.floor((Math.random()*(sArray.length-1)));
return "[c=blue]"+sArray[i]+"[/c]";
}
}
function OnGetScriptCommands(){
var commands = '<ScriptCommands>';
commands+='<Command>';
commands+='<Name>Jokes</Name>';
commands+='<Description>Sends a joke</Description>';
commands+='</Command>';
commands+='</ScriptCommands>';
return commands;
}
function OnEvent_MenuClicked(MenuItemId, Location, OriginWnd){
if(MenuItemId=="jk"){
OriginWnd.SendMessage(OnEvent_ChatWndSendMessage("", "/jokes"));
}
if(MenuItemId=="about"){
WndAbout = MsgPlus.CreateWnd("WndAbout.xml", "WndAbout");
}
}
function OnGetScriptMenu(nLocation){
var ScriptMenu = "<ScriptMenu>\n";
if(nLocation===2){
ScriptMenu += "<MenuEntry Id=\"JK\">Jokes</MenuEntry>";
ScriptMenu += "<Separator/>";
}
ScriptMenu += "<MenuEntry Id=\"about\">About</MenuEntry>";
ScriptMenu += "</ScriptMenu>";
return ScriptMenu;
}
oh and 1 more thing... the about box works fine.
Thanks ~joosh00~
RE: is there somthing wrong with this script..? by pollolibredegrasa on 03-26-2008 at 04:45 PM
quote: Originally posted by joosh00
code: function OnEvent_MenuClicked(MenuItemId, Location, OriginWnd){
if(MenuItemId=="jk"){
code: ScriptMenu += "<MenuEntry Id=\"JK\">Jokes</MenuEntry>";
Scripting is case sensitive, so make these the same case and it should work fine
Hope this helps
RE: is there somthing wrong with this script..? by joosh00 on 03-26-2008 at 04:49 PM
OMG im such an idiot xD thanks it works now.. lol
RE: is there somthing wrong with this script..? by Jesus on 03-26-2008 at 05:09 PM
quote: Originally posted by joosh00
var i = Math.floor((Math.random()*(sArray.length-1)));
should be code: Math.floor(Math.random()*sArray.length);
otherwise the last item will never be used. Math.random() is always <1 so if you multiply it by 14 you'll get a number between 0 and 13.999etc, which makes a maximum of 13 because of the Math.floor() function.
RE: is there somthing wrong with this script..? by joosh00 on 03-26-2008 at 05:42 PM
Thanks Jesus =P
1 more problem now it wont run and when i try and quit the preferences it says
quote: Couldn't start script "Jokes".
The Script may be defective or you may not have the proper privileges to run scripts.
And here is an updated version of my script.
code: //This script is created by Josh Brand
//Version - 0.1
//Released
//Last Updated
//Created for the Messenger Plus!
/*Changelog
0.1 - Script Created
*/
var sArray = new Array();
sArray[0] = "How did the blonde try to kill the bird? She threw it off a cliff.";
sArray[1] = "Did you hear about the blonde secretary who cut her fingers off so that she could write short hand?";
sArray[2] = "Your mom's so fat that Nasa octually orbits her.";
sArray[3] = "I'm not a steady drinker - my hand shakes too much.'";
sArray[4] = "Yo momma so ugly, she make blind muthafuckas cry.";
sArray[5] = "1 Tequila, 2 Tequila, 3 Tequila, Floor.";
sArray[6] = "How do you start an onion race? Onion marks! Get set! Go!";
sArray[7] = "Your mom.";
sArray[8] = "Your mom owes me money, you douche!";
sArray[9] = "Just cause you went to prom with Merv the Perv.";
sArray[10] = "Your mom is like a brick, flat on both sides and gets laid by Mexicans.";
sArray[11] = "Your Mom has a really nice hat...";
sArray[12] = "Don't worry, Your Mom is still a virgin. You were a backdoor baby.";
sArray[13] = "Your mom is poop.";
sArray[14] = "Crime doesn't pay...Does that mean my job is a crime?";
sArray[15] = "What do you call a sheep with no legs? A cloud.";
sArray[16] = "Do you know how to save a drowning lawyer? No? Good!";
sArray[17] = "What do you call a dog with no legs? Doesn't matter... he won't come to you anyway!";
sArray[18] = "I love deadlines. I especially like the whooshing sound they make as they go flying by.";
sArray[19] = "Why are men like blenders?You need one, but you're not quite sure why. ";
sArray[20] = "Why are guys like lava lamps? They're fun to watch, but not very bright!";
sArray[21] = "Yo mama so old she has Jesus' beeper number! ";
sArray[22] = "Yo mama's so stupid she can't pass a blood test.";
sArray[23] = "How many Marxists does it take to screw in a light bulb? None, the seeds of revolution and change are within the lightbulb itself.";
sArray[24] = "Yo mama's so stupid, she put lipstick on her forehead, because she wanted to make up her mind";
sArray[25] = "Yo mama so short she has to use a ladder to pick up a dime.";
sArray[26] = "How do you make a blonde laugh on a Saturday? Tell her a joke on a Wednesday.";
sArray[27] = "Yo mama's so fat that on her drivers licence it says picture continued on other side.";
sArray[28] = "What does a blonde say after her doctor tells her that she's pregnant. Is it mine?";
sArray[29] = "Waiter! This coffee tastes like mud. Yes sir, its fresh ground.";
sArray[30] = "What do you call a fish with no eyes? A fsh";
sArray[31] = "Why don't aliens eat clowns. Because they taste funny. ";
sArray[32] = "Two snowmen are standing in a field. One says to the other : Funny, I smell carrots too".";
sArray[33] = "What do you get when you cross an elephant and a rhino? el-if-i-no ";
sArray[34] = "Two peanuts walk into a bar. One was a salted.";
sArray[35] = "What do you call a woman with one leg? Ilene";
sArray[36] = "WHAT DID THE GHOST SAY TO THE BEE? BOO-BEE";
sArray[37] = "What do you call a man with no arms and no legs sitting on your front porch? Matt";
sArray[38] = "What do you call a man with no arms and no legs sitting in a pool? Bob";
sArray[39] = "Whats best about shagging Twenty - Eight year olds? There is Twenty of them!";
sArray[40] = "If you lend someone $20, and never see that person again; it was probably worth it.";
sArray[41] = "Keep honking. I'm reloading";
function OnEvent_ChatWndSendMessage(ChatWnd, Message){
if(Message.substr(0,8).toLowerCase()=="/jokes"){
var i = Math.floor((Math.random()*(sArray.length)));
return "[c=blue]"+sArray[i]+"[/c]";
}
}
function OnGetScriptCommands(){
var commands = '<ScriptCommands>';
commands+='<Command>';
commands+='<Name>Jokes</Name>';
commands+='<Description>Sends a joke</Description>';
commands+='</Command>';
commands+='</ScriptCommands>';
return commands;
}
function OnEvent_MenuClicked(MenuItemId, Location, OriginWnd){
if(MenuItemId=="jk"){
OriginWnd.SendMessage(OnEvent_ChatWndSendMessage("", "/jokes"));
}
if(MenuItemId=="about"){
WndAbout = MsgPlus.CreateWnd("WndAbout.xml", "WndAbout");
}
}
function OnGetScriptMenu(nLocation){
var ScriptMenu = "<ScriptMenu>\n";
if(nLocation===2){
ScriptMenu += "<MenuEntry Id=\"jk\">Jokes</MenuEntry>";
ScriptMenu += "<Separator/>";
}
ScriptMenu += "<MenuEntry Id=\"about\">About</MenuEntry>";
ScriptMenu += "</ScriptMenu>";
return ScriptMenu;
}
RE: is there somthing wrong with this script..? by joosh00 on 03-27-2008 at 12:03 AM
any1..?
RE: is there somthing wrong with this script..? by pollolibredegrasa on 03-27-2008 at 12:10 AM
The script Debugger shows code: Error: Unterminated string constant (code: -2146827273)
File: test.js. Line: 44.
And looking at line 44 you have an extra ". After removing that it works for me.
code: sArray[32] = "Two snowmen are standing in a field. One says to the other : Funny, I smell carrots too".";
Hope this helps
RE: is there somthing wrong with this script..? by joosh00 on 03-27-2008 at 12:16 AM
OMG thank you sooo much..is this good for my first script..?
RE: is there somthing wrong with this script..? by CookieRevised on 03-27-2008 at 01:15 AM
If this is your first script... very very good, imho. You have programmed before?
(PS: if you didn't already, turn debugging options in Plus!'s preferences on, so you can check such errors yourself )
RE: is there somthing wrong with this script..? by joosh00 on 03-27-2008 at 01:32 AM
yah this is my first script, ive not done any programming before, my friend helped me a bit though.
Ive finished the whole thing and im trying to package it but i dont get how too.. and advice..?
RE: is there somthing wrong with this script..? by Naruto-SR on 03-27-2008 at 01:51 AM
"Script Packager" script:
[RELEASE] PACKAGER : Packs made easy for scripts developers
This script uses the 7-zip command line application as zipper.
Dempsey's "Script Packager" application:
http://mpscripts.net/tools.php
This VB6 application uses the Info-Zip's DLL and the Common Controls ActiveX OCXs.
Thank CookieRevised .. information from his post which is here.
RE: is there somthing wrong with this script..? by joosh00 on 03-27-2008 at 02:07 AM
Hmmm... They both dont work... help?!?!?!?
RE: is there somthing wrong with this script..? by roflmao456 on 03-27-2008 at 02:32 AM
quote: Originally posted by joosh00
Hmmm... They both dont work... help?!?!?!?
zip up the files (not folder) and change the extension to plsc.
you need to have a ScriptInfo.xml
RE: is there somthing wrong with this script..? by joosh00 on 03-27-2008 at 02:34 AM
o kk =P
|