mIRC Home    About    Download    Register    News    Help

Print Thread
#125855 22/07/05 06:22 PM
Joined: May 2005
Posts: 449
Fjord artisan
OP Offline
Fjord artisan
Joined: May 2005
Posts: 449
I am trying to write a remote that will replace "90 degrees" etc. with 90(degree sign, which is $chr(176)). I'm not sure how to go about finding the word "degrees" and making the replacement, thanks.

#125856 22/07/05 06:41 PM
Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
$replace(string of text,item to replace, new item)

$replace(90 degrees,degrees,$chr(0176))

//say Test $replace(90 degrees,degrees,$chr(0176))

#125857 22/07/05 07:47 PM
Joined: May 2005
Posts: 449
Fjord artisan
OP Offline
Fjord artisan
Joined: May 2005
Posts: 449
I decided to use an alias to do this, but now I want to know if there is a way I can have it find the number in the sentence so I can have the temp anywhere in a sentence? This is the alias how it is now:

/temp {
msg $chan $1- $+ $chr(176)

I want to be able to say "It will be 90 degrees today" or "It is 90 degrees" and have it find the number and replace "degrees" with the sign. Thanks.

#125858 22/07/05 08:53 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Try this. I'm not positive the halting is set up correctly right now and can't test it.

Code:
on ^*:input:*:{
  if (*degrees* iswm $1-) {
    say $replace($1-,degrees,$chr(0176))
    halt
  }
}

on ^*:text:*degrees*:*:{
  echo $target $replace($1-,degrees,$chr(0176))
  halt
}


Invision Support
#Invision on irc.irchighway.net
#125859 23/07/05 08:13 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
assuming your text is in %text

%text = $replace(%text,degrees,$chr(176))


Link Copied to Clipboard