mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Sep 2003
Posts: 120
G
Gar Offline OP
Vogon poet
OP Offline
Vogon poet
G
Joined: Sep 2003
Posts: 120
Well I have changed my methods a little. Here is the one that does work:

Code:
alias dw {
  if($1- == isalnum) {
    /msg $chan $replace($1-,about,aboot,after,efter,all,a',along,alang,alright,a'right, $&
      and,'n,are,ur,aren't,urnae,around,roon',ass,arse,ball,ba',being,bein',before,afore, $&
      belongs,belangs,between,a'tween,body,boady,but,bar,call,ca',can,kin,can not,cannae, $&
      center,centre,children,weans,cold,cauld,come on,c'moan,couldn't,couldnae,crazy, $&
      cracked,daft one,daftie,dead,deid,deaf,deef,do,dae,does,diz,doing,daein',do you, $&
      d'ye,done,doon,don't,doan't,down,doon,drunk,blootered,fellow,fella,floor,flair,foot, $&
      fit,for,fur,from,fae,get it,gerrit,girl,girrel,give,gie,god,goad,going,gaun,going to, $&
      gonnae,got,goat,had,hid,half,hauf,has,hiz,hand,haun,hang,hing,have,huv,having,huvin', $&
      haven't,havnae,head,heid,herself,hersel',himself,himsel',hold,haud,home,hame)
  }
}


But when I try to add the second half to it I get an error that says it is too long. Error is: * $&: line too long (line 105, aliases.ini)

This is the second half of it:

Code:
      I,ah,I'm,ahm,into,intae,isn't,isnae,I've,Ah've,just,jist,language,langweej,leave, $&
      lea',little,wee,lost,loast,messy,manky,more,mair,mouth,mooth,my,ma,myself,masel', $&
      no,nae,none,nane,not,no',now,noo,now a days,nooadays,of,'o,off,aff,on,oan,once, $&
      wance,one,wan,our,oor,out,oot,outside,ootside,over,o'er,own,ain,pissing,pishin', $&
      poor,puir,put,pit,round,roond,[censored],shite,shouldn't,shouldnae,small,wee,south,sooth, $&
      stand,staun,stop,stoap,stupid,stupit,them,thum,those,thae,thought,thaot,to,tae, $&
      toilet,cludgie,told,telt,too,tae,trousers,troosers,understand,understaun,wall,wa', $&
      was,wus,wasn't,wiznae,were,wur,what,whit,will not,willnae,with,wi',world,worreld, $&
      would,wid,wouldn't,wouldnae,wouldn'tve,widnae,you,ye,you'd,ye'd,you'll,ye'll,your, $&
      yer,you're,ye're,yourself,yersel',you've,ye've)


Note that you will need to add a , and a $& and remove the ) at the end of the first part.

The first one works, but the second one doesn't. Is there a way of doing these both at the same time?

Joined: Dec 2002
Posts: 1,893
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,893
Keep in mind that $replace() doesn't replace whole words, so word like "mind" will be changed to "mahnd" because of the i => ah replacement.

Instead of using $replace I'd create a hash table with original words as items and replacements as data.
  • /hmake rep
    /hadd rep about aboot
    /hadd rep after efter
    ...
$reptext($1-) will loop through the words in text and return a modified version,
Code:
alias reptext {
  var %r, %i = 1
  tokenize 32 $1-
  while %i <= $0 {
    %r = %r $iif($hget(rep,$ [ $+ [ %i ] ]),$ifmatch,$ [ $+ [ %i ] ])
    inc %i
  }
  return %r
}

T
theRat
theRat
T
%var = $1-
tokenize 32 $1-
if ( $1- == %var ) echo why are we using tokenize anyway?


grin

Joined: Jan 2003
Posts: 2,125
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,125
%var = $1
tokenize 32 $1-
if ($1 != %var) echo Because $!reptext(word1 word2 ....) is a custom identifier, so $!1 will be "word1 word2 ...."

Joined: Sep 2003
Posts: 120
G
Gar Offline OP
Vogon poet
OP Offline
Vogon poet
G
Joined: Sep 2003
Posts: 120
I don't understand this reptext thing or hash tables. How do I create all this, where do I put this information? What information do I need? What would the syntax be?

Joined: Dec 2002
Posts: 1,893
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,893
Hash tables tutorial

To create the table, type /hmake rep. To add to the table, type /hadd rep <word> <replacement> for each word. For example,
  • /hadd rep about aboot
    /hadd rep fellow fella
When you finish, save the table to a file by typing /hsave -o rep rep.dat, because after closing mIRC the table is lost and will need to be reloaded later.

My $reptext identifier gets a string from the user and sees which words can be replaced. You can use it in an input event like this:
  • On *:input:#:if /* !iswm $1 { say $reptext($1-) | halt }
I hope it's more clear now.


Link Copied to Clipboard