mIRC Home    About    Download    Register    News    Help

Print Thread
#132145 07/10/05 09:11 PM
Joined: Jun 2003
Posts: 54
C
croyfer Offline OP
Babel fish
OP Offline
Babel fish
C
Joined: Jun 2003
Posts: 54
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?

Last edited by croyfer; 07/10/05 09:12 PM.

I'm Croyfer @ the EF.net -- #nesse
Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
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


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
Joined: Jun 2003
Posts: 54
C
croyfer Offline OP
Babel fish
OP Offline
Babel fish
C
Joined: Jun 2003
Posts: 54
Tnx - ill try that out !=)


I'm Croyfer @ the EF.net -- #nesse
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
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.


Gone.
Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
Ah learn something everyday laugh


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
Joined: Oct 2005
Posts: 2
K
Bowl of petunias
Offline
Bowl of petunias
K
Joined: Oct 2005
Posts: 2
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

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
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-
}


Invision Support
#Invision on irc.irchighway.net
Joined: Oct 2005
Posts: 2
K
Bowl of petunias
Offline
Bowl of petunias
K
Joined: Oct 2005
Posts: 2
im using raw sockets, not the /server stuff...
the /sockopen etc

so, im parsing out the raw data from the socket

Joined: Jun 2003
Posts: 54
C
croyfer Offline OP
Babel fish
OP Offline
Babel fish
C
Joined: Jun 2003
Posts: 54
Is there any way to remove X letters from the right, and Y letters from the left using this or other commands?

Last edited by croyfer; 23/11/05 12:36 AM.
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
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.


Link Copied to Clipboard