mIRC Homepage
Posted By: croyfer How to remove last letter - 07/10/05 09:11 PM
Is it possible to remove the last character in a line, like $3 ? The character is a "." , and I only want to remove the last one, and not other "."'s that might be in $3

Any suggestions?
Posted By: Lpfix5 Re: How to remove last letter - 07/10/05 09:16 PM
well if its always the $3 word you can do

$left($gettok($3,1,32), -1) this pushes the text to backup one character so if $3 == Hello. it will come out Hello if you do

$left($gettok($3,1,32), -2) this pushes the text to back 2 characters if $3 == Hello. it will come out Hell

or then again you can just do $left($3,-1)

example if lets say a phrase was like

Hi my name is lpfix and im scripting!

you can replace the ! with a .

$left($1-,-1) $+ .

but if you want to take the middle of text then use gettok commands like example

Hello I love to script, and I like baseball.

I can strip I love to script from there and use it has a Statement

so this would be the script

on *:TEXT:*:#: {
if (script isin $1-) {
msg $chan $left($gettok($1-,2-5,32),-1) $+ !
}
}

see what i did is get the token 2 to 5 then removed the , from it and added a !

so my script will message to the channel I love to script!

smile

hope this helps
Posted By: croyfer Re: How to remove last letter - 07/10/05 09:39 PM
Tnx - ill try that out !=)
Posted By: FiberOPtics Re: How to remove last letter - 07/10/05 09:47 PM
Small tip:

The $N tokens are filled in the on text event, meaning you don't need to specify $gettok($1-,2-5,32) but simply $2-5

On another note, it's not sure that there will be multiple words said, so it's best to specify $$2-5 which will only perform the command if there is atleast a second parameter filled.
Posted By: Lpfix5 Re: How to remove last letter - 07/10/05 11:10 PM
Ah learn something everyday laugh
Posted By: kaotix Re: How to remove last letter - 11/10/05 02:12 AM
ok, so i have a similar problem but i cant seem to figure it out.
i made mirc connect to an irc network and then join a channel, using the sockets in mirc.
i want to strip the : off the channel messages
eg ':Hello'
would be 'Hello'

ive been scratching my head over this for ages as i dont have much knowledge of mirc scripting, but i know the basics...

if anyone can supply a simple solution that would be great
Posted By: Riamus2 Re: How to remove last letter - 11/10/05 01:03 PM
Using the sockets in mIRC? You mean you typed /server irc.yournetwork.org and then /join #yourchannel?

You shouldn't have a colon in front of messages in a channel unless you have some script doing that.

Anyhow, this would remove the colon...
Code:
on ^*:text:*:#: {
  haltdef
  if ($left($1-,1) == :) { echo $chan $right($1-,-1) }
  else echo $chan $1-
}
Posted By: kaotix Re: How to remove last letter - 11/10/05 06:01 PM
im using raw sockets, not the /server stuff...
the /sockopen etc

so, im parsing out the raw data from the socket
Posted By: croyfer Re: How to remove last letter - 23/11/05 12:36 AM
Is there any way to remove X letters from the right, and Y letters from the left using this or other commands?
Posted By: RusselB Re: How to remove last letter - 23/11/05 01:58 AM
To remove X letters from the right, use $left(<variable/string>,-X)
To remove Y letters from the left, use $right(<variable/string>,-Y)

By using a NEGATIVE number, you are counting from the opposite end, so $left with a negative number counts that name characters from the right. and vice versa for $right.
© mIRC Discussion Forums