Shoutbox

[Release] Gradient Text - 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: [Release] Gradient Text (/showthread.php?tid=62623)

[Release] Gradient Text by craig2k5 on 07-05-2006 at 10:02 PM

My First script ive made :P hope you like it :) its very simple

What It Does
Takes to numbers and makes all the text you send to your contact
will appear in a gradient Form

How To Work
Type /xgradient into the Conversation window
Press Send/enter
Input the number Of The First Colour
Input the number Of The Second Colour
Press Ok

Todo
Deactivate the Gradient Without going into the scripts window.
Allow /xconfig then 2 numbers :p instead of having to go into configuration



If you have any suggestions/features/bugs let me know :D


RE: [Realse] Gradient Text by Joereynolds89 on 07-05-2006 at 10:10 PM

mines stuck on green/blue lol whatever i put in, it was like that default


RE: [Realse] Gradient Text by craig2k5 on 07-05-2006 at 10:19 PM

are you pressing ok? after you type the two colours in?? It Works here nomatter what numbers i put in


RE: [Release] Gradient Text by Joereynolds89 on 07-05-2006 at 10:31 PM

ok?? it dosnt ask ok
it send them the command with the message
and send the message half blue/green?? :S

maybe you mean send? and when i click send it sends the contact /xconfig 12 13 or whatever numbers i put??
maybe a conflict with another add on i have??
(Smilie) good for a first script though yet not every1 has the new msn yet so it wont work to many people (Smilie)


RE: [Release] Gradient Text by craig2k5 on 07-05-2006 at 10:39 PM

You cant acutally just type /xconfig then 2 numbers :P have to send for a window to cum up... that is a good idea tho *-) i edited the post :)


RE: [Release] Gradient Text by Joereynolds89 on 07-05-2006 at 10:55 PM

yer thats what i mean, i click send, no window comes up, it just send the command with the numbers and the gradient of green/blue to the other contact??

(edit) ok i now understand, you press send before the numbers :P i understood you wrote the command with the numbers :P sorry


RE: [Realse] Gradient Text by Ezra on 07-05-2006 at 10:55 PM

Not the best script i've ever seen, why use a config file when you can use the registry, the registry is a lot easier and needs less code...

Also why the Gradient Script.js file without any code in it? Just the Initialize and Uninitialize events are in there and they do nothing...

Tried to edit your code a little to make it better, please don't take this in the wrong way, i'm simply trying to help :D

Allright, you read your config file EVERY time a message was sent, I just load the gradient information IF it is present on signing, if somehow it can't be loaded, error or first time use, it will default to 1 and 4.

It will only save the gradient information on signout, so I just cut back the reading and writing to once on signing and once on signout.
Also because the registry is much easier to use than a config file it's multi-user to it saves color information per-user.

Those are the major changes, minor changes are that I used a regex to see if the /xconfig command was called, just because... well.. I like regex :P (Just started learning regex so also using it in practice to learn) and making a seperate function for the creation of the config window.

Also... I havn't tested it, because my computer is acting up and well... No time have to get up early tommorrow...

code:
//Initialize the color variables to make them globaly accessable
var color1;
var color2;

function OnconfigEvent_CtrlClicked(Wnd, ControlId)
{
  try
  {
    //try catching the colors from the controls
    color1 = Wnd.GetControlText('clr1');
    color2 = Wnd.GetControlText('clr2');
  }
  catch(err)
  {
    //If it fails for some odd reason Display A Toast to tell the user about it
    MsgPlus.DisplayToast("GRADIENTER", "Changing Color Failed");
  }
  //Close the Config Window
  Wnd.Close(1);
}

function OnEvent_ChatWndSendMessage(ChatWnd, sMessage)
{
  if (sMessage.Match(/^\/xconfig$/i) != null)
  {
    CreateConfigWnd();
    return "";
  }
  else
  {
    return "[c=" + color1 + "]" + sMessage + "[/c=" + color2 + "]";
  }
}

function OnEvent_Signin(Email)
{
  try
  {
    //Try reading the colors from the registry
    color1 = ReadRegistry("color1");
    color2 = ReadRegistry("color2");
  }
  catch(err)
  {
    //If anything fails it will default to these colors
    color1 = "1";
    color2 = "4";
  }
}

function OnEvent_Signout(Email)
{
  try
  {
    //Try Writing the colors to the registry
    WriteRegistry("color1", color1);
    WriteRegistry("color2", color2);
  }
  catch(err)
  {
    MsgPlus.DisplayToast("GRADIENTER", "Error saving gradient information");
  }
}

function CreateConfigWnd()
{
  var configWnd = MsgPlus.CreateWnd("Interface.xml", "Config");
  configWnd.SetControlText('clr1', color1);
  configWnd.SetControlText('clr2', color2);
}

function WriteRegistry(key, value)
{
  var Shell = new ActiveXObject("WScript.Shell");
  return Shell.RegWrite(MsgPlus.ScriptRegPath + Messenger.MyEmail + "\\" + key, value);
}

function ReadRegistry(key)
{
  var Shell = new ActiveXObject("WScript.Shell");
  return Shell.RegRead(MsgPlus.ScriptRegPath + Messenger.MyEmail + "\\" + key);
}

RE: [Release] Gradient Text by Chris4 on 07-05-2006 at 10:59 PM

It's nice, but could have more features.

Like.. some people don't know that 1=black etc. So you should make a colour panel so people can choose the colour.

Also, it should be added to the Plus! menu with the other scripts, so you can edit the gradient from their. Some people won't know the command.

When you've added some more features, it'll be good enough to add to the Scripts Database. :)


RE: [Release] Gradient Text by Joereynolds89 on 07-05-2006 at 11:02 PM

where abouts am i suppose to place that script in his? as using it on its own shows command not, and if putting it where i think it goes in his, i also get no command found :S sorry


RE: [Release] Gradient Text by craig2k5 on 07-05-2006 at 11:04 PM

:) thanks guys this is the first script ive made lol and ill take what you have said and try for the next realse


RE: [Release] Gradient Text by Chris4 on 07-05-2006 at 11:12 PM

quote:
Originally posted by Joereynolds89
where abouts am i suppose to place that script in his? as using it on its own shows command not, and if putting it where i think it goes in his, i also get no command found :S sorry

If your editng the script with the code posted above, the code is wrong. You need to use this instead:

code:
//Initialize the color variables to make them globaly accessable
var color1;
var color2;

function OnconfigEvent_CtrlClicked(Wnd, ControlId)
{
  try
  {
    //try catching the colors from the controls
    color1 = Wnd.GetControlText('clr1');
    color2 = Wnd.GetControlText('clr2');
  }
  catch(err)
  {
    //If it fails for some odd reason Display A Toast to tell the user about it
    MsgPlus.DisplayToast("GRADIENTER", "Changing Color Failed");
  }
  //Close the Config Window
  Wnd.Close(1);
}

function OnEvent_ChatWndSendMessage(ChatWnd, sMessage)
{
  if (sMessage == "/xconfig")
  {
    CreateConfigWnd();
    return "";
  }
  else
  {
    return "[c=" + color1 + "]" + sMessage + "[/c=" + color2 + "]";
  }
}

function OnEvent_Signin(Email)
{
  try
  {
    //Try reading the colors from the registry
    color1 = ReadRegistry("color1");
    color2 = ReadRegistry("color2");
  }
  catch(err)
  {
    //If anything fails it will default to these colors
    color1 = "1";
    color2 = "4";
  }
}

function OnEvent_Signout(Email)
{
  try
  {
    //Try Writing the colors to the registry
    WriteRegistry("color1", color1);
    WriteRegistry("color2", color2);
  }
  catch(err)
  {
    MsgPlus.DisplayToast("GRADIENTER", "Error saving gradient information");
  }
}

function CreateConfigWnd()
{
  var configWnd = MsgPlus.CreateWnd("Interface.xml", "Config");
  configWnd.SetControlText('clr1', color1);
  configWnd.SetControlText('clr2', color2);
}

function WriteRegistry(key, value)
{
  var Shell = new ActiveXObject("WScript.Shell");
  return Shell.RegWrite(MsgPlus.ScriptRegPath + Messenger.MyEmail + "\\" + key, value);
}

function ReadRegistry(key)
{
  var Shell = new ActiveXObject("WScript.Shell");
  return Shell.RegRead(MsgPlus.ScriptRegPath + Messenger.MyEmail + "\\" + key);
}
Replacing Gradient.js ;)
RE: [Release] Gradient Text by Ezra on 07-05-2006 at 11:13 PM

quote:
Originally posted by Joereynolds89
where abouts am i suppose to place that script in his? as using it on its own shows command not, and if putting it where i think it goes in his, i also get no command found :S sorry

Just replace all his code in Gradient.js with mine.

Chris4 said the command /xconfig doesn't work with my version anymore, trying to fix this.

Chris4 already posted my fix, this works and is simple, no biggie :)
RE: [Release] Gradient Text by Joereynolds89 on 07-05-2006 at 11:25 PM

/xgradient would probably work better?? :P


RE: [Release] Gradient Text by craig2k5 on 07-05-2006 at 11:30 PM

Ok thanks for re-writing my code 8-) anyway ive used your code and i will try and andd a few new features

quote:
Originally posted by Joereynolds89
/xgradient would probably work better?? :P


Done for next Release
RE: [Release] Gradient Text by Ezra on 07-05-2006 at 11:31 PM

quote:
Originally posted by Joereynolds89
/xgradient would probably work better?? :P

Whatever you like, but indeed xconfig is a little too common and could be applied for more things than this script :)
RE: [Release] Gradient Text by craig2k5 on 07-05-2006 at 11:36 PM

Updated The Script See First Post


RE: [Release] Gradient Text by MX-G on 07-05-2006 at 11:41 PM

Thanks craig2k5 :D


RE: [Release] Gradient Text by Joereynolds89 on 07-05-2006 at 11:49 PM

you forgot to change the attachment :( therefore now what you have wrote dosnt represent the file :P


RE: [Release] Gradient Text by craig2k5 on 07-05-2006 at 11:54 PM

i did change the attatchment :S lol


RE: [Release] Gradient Text by Joereynolds89 on 07-06-2006 at 12:00 AM

ahh, i wasnt aware it was possibel to change an attachment, plus it must be downloading from my cache because i get the old version :( ill clean and try again, even though ive got it anyway :P

Edit:
Yer, its all fine now (Smilie) and to whoever asked for implementation of colour codes, the colour codes are the WLM codes, accessable using the colour chooser within the conversation screen (Smilie)


RE: [Release] Gradient Text by craig2k5 on 07-06-2006 at 12:13 AM

Thanks.. i think he means have a list of colours or even have the colour chooser in the configuration window :P Any1 know how?