mIRC Home    About    Download    Register    News    Help

Print Thread
If any word can be made with autocomplete. #260541 09/05/17 04:02 PM
Joined: Nov 2014
Posts: 23
N
nexux Offline OP
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Nov 2014
Posts: 23
Hi all,
I would like to know if any word can be made with autocomplete. For example:

I really like drinking Heineken , and I do not like []Corona[] .


But, that certain words are autocompleted, others do not

It's possible?

Re: If any word can be made with autocomplete. [Re: nexux] #260543 10/05/17 01:08 PM
Joined: May 2017
Posts: 12
PlasmaStar Offline
Pikka bird
Offline
Pikka bird
Joined: May 2017
Posts: 12
I don't understand. As far as I know, tab-completion only "auto"-completes nick names.


Happy license owner. smile
Re: If any word can be made with autocomplete. [Re: PlasmaStar] #260544 10/05/17 04:00 PM
Joined: Nov 2014
Posts: 23
N
nexux Offline OP
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Nov 2014
Posts: 23
If I write Heineken in black, let the remote be in blue

But the word Heineken is not a nickname

Certain words other than nickname are autocompleted once the enter is pressed

Re: If any word can be made with autocomplete. [Re: nexux] #260545 10/05/17 04:04 PM
Joined: Nov 2014
Posts: 23
N
nexux Offline OP
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Nov 2014
Posts: 23
<@nexux> I like Heineken but I do not like Corona
<marisol42> Yes, it's true, Heineken is very rich
<@nexux> marisol42 you have to try drinking the heineken

Re: If any word can be made with autocomplete. [Re: nexux] #260546 10/05/17 05:53 PM
Joined: Nov 2014
Posts: 23
N
nexux Offline OP
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Nov 2014
Posts: 23


Code:
On *:Input:*: {
  If ($left($1,1) != /) && (!$Ctrlenter) { msg $active $replace($1-,heineken, heineken) | halt }
}

Re: If any word can be made with autocomplete. [Re: nexux] #260547 10/05/17 06:04 PM
Joined: Nov 2014
Posts: 23
N
nexux Offline OP
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Nov 2014
Posts: 23
But I can not put two colors: 3,1

for example:
Code:
On *:Input:*: {
  If ($left($1,1) != /) && (!$Ctrlenter) { msg $active $replace($1-,heineken, 3,1Heineken, corona, 4corona) | halt }
}


Code:
* Invalid parameters: $replace (line 3, remote.ini)

Re: If any word can be made with autocomplete. [Re: nexux] #260548 10/05/17 10:11 PM
Joined: Jan 2004
Posts: 1,202
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,202
The replace is seeing the commas from your color codes. Take a look at the syntax for $replace, and you'll see it's like: $replace(text,look for this, replace with this, look for this too, replace 2nd text with this). So $replace is seeing your commas as the border between replaced and replacement strings. Invalid sequence for replace() is to have an odd number of comma-separated strings following the text string that's having replacements made against it.

Instead of having 3,1 inside the parenthesis, you should instead have: 3 $+ $chr(44) $+ 1

As long as you're guaranteed to not have the color numbers not touching numbers to be displayed, you won't have to worry about making sure the numbers are zero padded to be 2 digits, like 03

Another issue is just personal preference, but many people find it hard to read characters were the background to the left of the 1st letter and to the right of the last letter is a different color. So instead of doing

8,4Heineken

you might want to do

8,4 Heineken 

When coloring the entire line, the stray control-c at the end makes sure the last letter has the same color space appearing after it.

Edit: clarifying that it's legit to have commas inside replace() as long as they belong to other identifiers(). So you can have something like: $replace(text,$gettok(text,1,32),newtext) and it won't see the portions of the $gettok() as several search/replace strings.

Last edited by maroon; 11/05/17 01:11 AM. Reason: clarify about commas inside replace()
Re: If any word can be made with autocomplete. [Re: nexux] #260556 11/05/17 11:37 AM
Joined: Nov 2014
Posts: 23
N
nexux Offline OP
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Nov 2014
Posts: 23
Thank you very much! It worked for me!
But, if I want to add more colors and more shapes?

Re: If any word can be made with autocomplete. [Re: nexux] #260558 11/05/17 06:44 PM
Joined: Jul 2014
Posts: 27
S
SykO Online
Ameglian cow
Online
Ameglian cow
S
Joined: Jul 2014
Posts: 27
you could use variables, like so:

var %heineken = HERE_SOME_STUFF

$replace($1-,heineken,%heineken)

Re: If any word can be made with autocomplete. [Re: nexux] #260561 12/05/17 11:28 AM
Joined: Nov 2014
Posts: 23
N
nexux Offline OP
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Nov 2014
Posts: 23
Thank you very much! It worked for me!

But, And if I want to put these symbols for example:
Code:
;
,
.
^^
^^,
:P
:)
:(
:O
-.-


And any other kind of symbol?


Last edited by nexux; 12/05/17 11:38 AM. Reason: But, And if I want to put these symbols for example: Code:
Re: If any word can be made with autocomplete. [Re: nexux] #260562 12/05/17 11:46 AM
Joined: Nov 2014
Posts: 23
N
nexux Offline OP
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Nov 2014
Posts: 23

This way is okay?


Code:
On *:Input:*: {
  ;===[ words


  var %heineken = 0,3 heineken 
  var %cafe = 0 $+ $chr(44) $+ 5 cafe 
  var %hiphop =  13 $+ $chr(44) $+ 6 HipHop 
  var %Buenosdias = 3Buenos dias 

  ;===[ symbols 

  var %t1 = :)
  var %t2 = 4:)
  var %t3 = ^^
  var %t4 = 7^^
  var %t5 = -.-
  var %t6 = 6 -.-   

  If ($left($1,1) != /) && (!$Ctrlenter) { msg $active $replace($1-,heineken,%heineken,cafe,%cafe,hiphop,%hiphop,Buenos dias,%buenosdias,!,7!,?,4?,%t1,%t2,%t3,%t4,%t5,%t6) | halt }
}