Flip Text 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: Flip Text Script (/showthread.php?tid=93992)
Flip Text Script by Tawa on 03-02-2010 at 08:19 AM
Hello for all,
I've made a simple script called FlipText, you can download it from here. I hope you guys like it.
Since I don't have a better place to receive feedback and suggestions, I thought about opening a thread in this forum for this purpose.
So, I hope you like my script, and please share your feedback and suggestions.
If you check the code, you'll notice that it's too messy anyhow, I changed a few things, and added some stuff to it.
For the next version of the script, I added the following:
- Flipon/Flipoff option, so that the script would flip every message you send without the command /flip
- Tweaked the code of course.
- Added the option to flip the text before sending it.
Working On:
- Flipon/Flipoff option for each conversation separately.
- Adding support for letters with accents.
Known Bugs:
- Flipping the PSM for the first time after signing in would clear the PSM, if however the PSM has not been edited at least once since login[Apparently it is a bug from Messenger Plus.]
Again, I'll be glad to hear any suggestions that would make this script more fun.
Thanks in Advance.
Tawa Nicolas
RE: Flip Text Script by matty on 03-02-2010 at 01:48 PM
One suggestion would to make a single function that has a parameter which is the text you want to flip. Then at the end of the script return the temp variable and then you can assign it as the name or PSM or the text in the conversation.
RE: Flip Text Script by Tawa on 03-02-2010 at 05:59 PM
I already did that. And to be honest I was expecting someone to tell me to do it
RE: Flip Text Script by CookieRevised on 03-03-2010 at 03:06 AM
When I first saw the topic I thought: "Oh no.. , not another entire script to simply swap a string from left to right " (as you can do that in one line of code, see below). But I must say, I am pleasantly surprised to see you took it a step further with a twist (almost literally ).
Anyways...
The whole process to replace a character with another in OnEvent_ChatWndSendMessage() can already be made more efficient if you integrate the second 'For' loop (line 74) into the first (line 62).
At this moment you do:
- iterate thru the original string and replace character x with y
- iterate thru the new string and flip it left to right.
This means 2 times iterating thru the entire string.
Together with that you also look up a part of the string deep inside the loop each time to build your new string (and even two times: the stuff which is in front of the replaced character, and the stuff which comes after it), this is very slow and not needed.
All you need is the actual new character in the loop. Do the concatenation later, after the whole loop. The benefit is also that you can immediatly add the new character at the end of the new string instead of at the beginning (and then later start a new loop to swap from left to right), thus automatically swapping the string from left to right too.
improvement example: js code: var temp = Message.substring(6);
var str = "";
var charNew = "";
for(var i = 0; i < temp.length; i++){
// Assign the new character to the original character in case
// there is no replacement. Note: this also features a double
// purpose, see next comment.
charNew = temp.charAt(i);
for(var j = 0; j < alpha.length; j++){
// Also note that I replaced all the temp.charAt(i) with charNew
// eliminating all the (slow) string lookups.
if(charNew === alpha[j] || charNew === kappa[j]){
charNew = omega[j];
break;
}
if(charNew === omega[j]){
charNew = alpha[j];
break;
}
}
// instead of doing 'str+=charNew' and then making another loop to
// swap everything from left to right, we immediatly add the new
// character to the end of the new string
str = CharNew + str;
}
return str;
Also note the change from == (equality operator) to === (identity operator) which is faster.
See CookieRevised's reply to Script about lock messenger
----
PS: if you ever want to swap an entire string from left to right, instead of this:js code: var OriginalStr = "Hello World";
var NewStr = "";
for(var i = OriginalStr.length-1; i >= 0; i--){
NewStr+=temp.charAt(i);
}
return New Str
you can also do this:js code: var OriginalStr = "Hello World";
return OriginalStr.split('').reverse().join('')
RE: Flip Text Script by Tawa on 03-03-2010 at 04:23 PM
CookieRevised, thanks a lot for the clarifications.
I had already replaced the Reverse function, but never knew that temp.charAt() slows the process. And the === thing looks good now to me
Anyways, I'm new to JavaScript, I got little experience in it. But I'm learning from this
Thanks again.
RE: Flip Text Script by billyy on 03-03-2010 at 04:25 PM
A litle part on what it does would be cool?
Hmm too bad uppercase doesn't work that well and some numbers look ****py but i like it
RE: Flip Text Script by Spongshga on 03-04-2010 at 08:25 PM
SmilieBUG:
Report:
bug with "^^" smilie!!! make it "vv" | ^=v
quote: Orginaltext: "this was a funny joke ^^"
FlipText: "^^ ǝʞoɾ ʎuunɟ ɐ sɐʍ sıɥʇ"
BugfreeFixed FlipText: "vv ǝʞoɾ ʎuunɟ ɐ sɐʍ sıɥʇ"
Screen:
----------------------------
Textformation
make a option to set "ABC" in "abc"
RE: RE: Flip Text Script by davidpolitis on 03-07-2010 at 11:18 AM
quote: Originally posted by Tawa
Anyways, I'm new to JavaScript, I got little experience in it. But I'm learning from this
Messenger Plus! Live scripts are written in JScript, not JavaScript.
RE: RE: Flip Text Script by Tawa on 03-07-2010 at 11:44 PM
quote: Originally posted by billyy
Hmm too bad uppercase doesn't work that well and some numbers look ****py but i like it
I could enable capital letters, but they would look sh**ier than flipped numbers.
Turning this:
AB
C
DEFGHI
J
KLMNOPQRSTUVWXYZ
Will give this:
quote: Originally posted by Spongshga
SmilieBUG:
Report:
bug with "^^" smilie!!! make it "vv" | ^=v
quote: Orginaltext: "this was a funny joke ^^"
FlipText: "^^ ǝʞoɾ ʎuunɟ ɐ sɐʍ sıɥʇ"
BugfreeFixed FlipText: "vv ǝʞoɾ ʎuunɟ ɐ sɐʍ sıɥʇ"
Screen:
----------------------------
Textformation
make a option to set "ABC" in "abc"
Thank you for your effort in pointing me to this
Replacing ^ with the letter v would change the sentence, so I added a character I found in Windows' Character Map which resembles the letter 'v'
quote: Originally posted by davidpolitis
quote: Originally posted by Tawa
Anyways, I'm new to JavaScript, I got little experience in it. But I'm learning from this
Messenger Plus! Live scripts are written in JScript, not JavaScript.
Thank you for pointing this out.
RE: Flip Text Script by Tawa on 03-10-2010 at 08:20 PM
Script update is now live
RE: Flip Text Script by Spongshga on 03-10-2010 at 09:58 PM
thanks pleas make for next version:
a) DONT FLIP SMILIES and do NOT FLIP Codes "[*b][*u][#4543] etg.!!!!!!!!
Oginal:
Fliped: (-:
b) give a option to DO NOT Flip URL!
c) give a option to reset (all option off) for simple quick-handling
d) Add Script-Flip-Option from Conversion Window to Main WLM-Skript Option!
e) a lot of languages have problem with read. pleas make it simple to see status (one of them) of "ON/OFF"i mean to see just "on" or just "off".
f) flip without text backswart... example:
g) give just for fun a translate to german :
quote: Flip On all Conv. = Flip alle Kon.
Flip Name = Flip Name
Flip Name and PSM = Flip Name und PSM
Flip PSM = Flip PSM = Flip PSM
Flip and Send = Flip und senden
PreSend Flip = ???? what is mean?
Toggle Conv. Fip On/Off = ???? what is mean?
Info: = Info:
- Commands are: = Kommandos
-- /flip <~ sends a flipped message. = sendet "flipped" Nachricht. also verkehrt herum und rückwärts.
-- /flipname <~ flips your nickname = "flipt" deinen Anzeige Namen verkehrt herum und rückwärts.
-- /flippsm <~ flips your personal message = "fliped" deine Statusnachricht verkehrt herum und rückwärts.
-- /flipon & /flipoff <~ Toggles flipping all the message you send to all conversations = Schalte "fliped" an/aus, auf alle Nachrichten die Gesendet werden.
-- /fliptoggle <~ Toggles flipping message you send to the current conversation. = Schalte "fliped" an/aus, auf momentan gestartete aktive Konversationen.
h) bug with "o" to flip an enable flip is the "o" = "O". (It's a very uncommon bug)
Example:
Original: vany kommt morgen <3
fliped: ***(fliped text...)***
unfliped: vany kOmmt mOrgen <3
I wish taht you make a credits button an do me with "www.spongshga.de.tl - reporter" add.
(I Am a reporter for a lott of stuff... skripts, greasmonkey, linkstore.in, jdonwloader.org , KNDS-Softwares etc.
RE: RE: Flip Text Script by Tawa on 03-20-2010 at 12:06 AM
Hello Spongshga, thank you for your reply.
a) It's hard to not flip smilies, because as far as I know, when going through the text to flip it, you can't know when you're passing through a smily. And about the Codes, I got the request from lots of people, I'll work on it.
b) I'll work on not flipping url
c) Good idea.
d) Can you please elaborate.
e) Sadly, On or Off can be set only in the Contact List.
f) I honestly think it's useless, but I'll add it. I'll call it /turn
g) Well it's just a simple script, doesn't need translations.
h) Fixed, thank you.
And, I don't know about the credit thing
RE: RE: RE: Flip Text Script by Spongshga on 03-22-2010 at 01:28 PM
quote: Originally posted by Tawa
Hello Spongshga, thank you for your reply.
a) It's hard to not flip smilies, because as far as I know, when going through the text to flip it, you can't know when you're passing through a smily. And about the Codes, I got the request from lots of people, I'll work on it.
b) I'll work on not flipping url
c) Good idea.
d) Can you please elaborate.
e) Sadly, On or Off can be set only in the Contact List.
f) I honestly think it's useless, but I'll add it. I'll call it /turn
g) Well it's just a simple script, doesn't need translations.
h) Fixed, thank you.
And, I don't know about the credit thing
a) what???? you must intigrate a "hide-flip"-fliter ...
b) the same option windows and menus from your script in a chat, add to contactlist-msn!
f) okay, and the mistical backsword add is a funny thing too
g) oh but some textes is hard to understand because its not so easy to translate for simple english.
creditbutton: its okay thanks.
|