What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [SOLVED] How do I create a variable thing like (!VER)?

Pages: (2): « First [ 1 ] 2 » Last »
[SOLVED] How do I create a variable thing like (!VER)?
Author: Message:
Agret
Junior Member
**

Avatar

Posts: 23
34 / Male / –
Joined: Dec 2003
O.P. [SOLVED] How do I create a variable thing like (!VER)?
How do I create a variable thing like (!VER)?

I want it so that when a person writes (!MEH) it's auto-replaced by a variable from my script, how can I accomplish this?

This post was edited on 12-01-2006 at 02:17 PM by Agret.
[Image: agret.png]
(¯`·._¤²°°²Agret²°°²¤_.·´¯)
¸.-~·*'˜¨¯Ï”m_†hê_ôñë_åñd_õñl¥_Åg®ê†¨˜'*·~-.¸
12-01-2006 07:43 AM
Profile E-Mail PM Web Find Quote Report
markee
Veteran Member
*****

Avatar

Posts: 1621
Reputation: 50
35 / Male / Flag
Joined: Jan 2006
RE: How do I create a variable thing like (!VER)?
code:
function OnEvent_ChatWndSendMessage(Wnd,Msg){
...
Msg = Msg.replace(/\(\!MEH\)/g,variable);//replace (!MEH) with string in variable
..
}
If you want it to be case insensitive then use gi rather than just g.  This just uses regular expressions, which I highly recommend for all scripters to learn.
[Image: markee.png]
12-01-2006 07:48 AM
Profile PM Find Quote Report
Agret
Junior Member
**

Avatar

Posts: 23
34 / Male / –
Joined: Dec 2003
O.P. RE: How do I create a variable thing like (!VER)?
Thanks a lot markee, you have been helpful. This forum should get a thanks mod installed :P
[Image: agret.png]
(¯`·._¤²°°²Agret²°°²¤_.·´¯)
¸.-~·*'˜¨¯Ï”m_†hê_ôñë_åñd_õñl¥_Åg®ê†¨˜'*·~-.¸
12-01-2006 08:03 AM
Profile E-Mail PM Web Find Quote Report
NiteMare
Veteran Member
*****

Avatar
Giga-Byte me

Posts: 2497
Reputation: 37
36 / Male / Flag
Joined: Aug 2003
RE: How do I create a variable thing like (!VER)?
quote:
Originally posted by markee
This just uses regular expressions, which I highly recommend for all scripters to learn.

thats like a whole nother language in itself
[Image: sig/]
I'll never forget what she said 6659 days, 8 hours, 27 minutes, 2 seconds ago
Need hosting? Check
out my website. we can help you out :)
12-01-2006 08:17 AM
Profile PM Web Find Quote Report
Agret
Junior Member
**

Avatar

Posts: 23
34 / Male / –
Joined: Dec 2003
O.P. RE: How do I create a variable thing like (!VER)?
Heh, i've gotten somewhat used to regular expressions although they vary in usage. UltraEdit and PHP have different regular expressions and now I'll have to learn the JavaScript ones :(

I think it's better to just look up a cheat sheet for regular expressions rather than try and learn them, it'll drive you insane trying to remember which one to use between which language / program.
[Image: agret.png]
(¯`·._¤²°°²Agret²°°²¤_.·´¯)
¸.-~·*'˜¨¯Ï”m_†hê_ôñë_åñd_õñl¥_Åg®ê†¨˜'*·~-.¸
12-01-2006 08:28 AM
Profile E-Mail PM Web Find Quote Report
Ezra
Veteran Member
*****

Avatar
Forgiveness is between them and God

Posts: 1960
Reputation: 31
37 / Male / Flag
Joined: Mar 2003
RE: How do I create a variable thing like (!VER)?
PHP has two different versions of regex.

IIRC Jscript uses one of these two.

I recommend:
http://www.regular-expressions.info/ along with The Regex Coach
[Image: 1-0.png]
             
12-01-2006 09:09 AM
Profile PM Web Find Quote Report
Agret
Junior Member
**

Avatar

Posts: 23
34 / Male / –
Joined: Dec 2003
O.P. RE: How do I create a variable thing like (!VER)?
markee I finally got around to testing your code and although it replaces the Message thing alright it doesn't actually replace the message that is sent to your recipient, I can only access the new value from a script
[Image: agret.png]
(¯`·._¤²°°²Agret²°°²¤_.·´¯)
¸.-~·*'˜¨¯Ï”m_†hê_ôñë_åñd_õñl¥_Åg®ê†¨˜'*·~-.¸
12-01-2006 12:38 PM
Profile E-Mail PM Web Find Quote Report
markee
Veteran Member
*****

Avatar

Posts: 1621
Reputation: 50
35 / Male / Flag
Joined: Jan 2006
RE: How do I create a variable thing like (!VER)?
quote:
Originally posted by Agret
markee I finally got around to testing your code and although it replaces the Message thing alright it doesn't actually replace the message that is sent to your recipient, I can only access the new value from a script
Sorry, you have to return the Msg variable, I just put in ... for if you wanted to do more in the script.  If you just want to do that one thing then here is the script.

code:
function OnEvent_ChatWndSendMessage(Wnd,Msg){
Msg = Msg.replace(/\(\!MEH\)/g,variable);//replace (!MEH) with string in variable
return Msg;
}

Btw you can still add more than you want, I just wanted to give you an example or snippet of the code first rather than writing something fully.
[Image: markee.png]
12-01-2006 12:44 PM
Profile PM Find Quote Report
Felu
Veteran Member
*****


Posts: 2223
Reputation: 72
29 / Male / Flag
Joined: Apr 2006
Status: Away
RE: How do I create a variable thing like (!VER)?
Markee forgot to return the message [Image: msn_tongue.gif].
code:
var meh = "meh"
function OnEvent_ChatWndSendMessage(ChatWnd,Message){
    Message = Message.replace(/\(\!MEH\)/gi,meh);
return Message;
}

Edit : Beaten by markee :P.

This post was edited on 12-01-2006 at 12:48 PM by Felu.
12-01-2006 12:46 PM
Profile E-Mail PM Web Find Quote Report
Agret
Junior Member
**

Avatar

Posts: 23
34 / Male / –
Joined: Dec 2003
O.P. RE: How do I create a variable thing like (!VER)?
Yeah, I figured it out myself. Forgot to delete my post lol :D Thanks for replying anyway guys.

The script is pretty much finished now, just gotta do some usability improvements to it ;)
[Image: agret.png]
(¯`·._¤²°°²Agret²°°²¤_.·´¯)
¸.-~·*'˜¨¯Ï”m_†hê_ôñë_åñd_õñl¥_Åg®ê†¨˜'*·~-.¸
12-01-2006 02:17 PM
Profile E-Mail PM Web Find Quote Report
Pages: (2): « First [ 1 ] 2 » Last »
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On