mIRC Home    About    Download    Register    News    Help

Print Thread
Colortext in on Text Event #263538 16/08/18 12:19 AM
Joined: Aug 2018
Posts: 6
K
Kaleah Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
K
Joined: Aug 2018
Posts: 6
I have the following problem:

I want my bot to respond to the following colored text and then execute a command ...

it is for my own network of Friends
here is the Code:

Code:
on *:text:* $+ $(*4has entered the battle!*):#: {
  set %enemy $1
  /os client join %enemy #battledome
}



so my Problem is the bot dont react of a collored text.. frown


for example: if the gamebot says: Bee has entered the battle!


the Other bot should start the command…

But it dont work smirk

Can Anybody help?

Re: Colortext in on Text Event [Re: Kaleah] #263539 16/08/18 02:40 AM
Joined: Jan 2004
Posts: 1,276
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,276
Unless there's a need to differentiate between different messages having different color codes, just do a text match for the text within:

Code:
on *:TEXT:* has entered the battle!*:#:{
  set %enemy $1
  /os client join %enemy #battledome
}


Unless the /os alias contains code to verify that the text is being done by the correct gamebot, you should have code at the beginning of your event handler to make sure it's not me sending that message smile

Something like:
Code:
if ($nick != NameOfGameBot) return

Re: Colortext in on Text Event [Re: maroon] #263540 16/08/18 08:22 AM
Joined: Aug 2018
Posts: 6
K
Kaleah Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
K
Joined: Aug 2018
Posts: 6
Originally Posted By: maroon
Unless there's a need to differentiate between different messages having different color codes, just do a text match for the text within:

Code:
on *:TEXT:* has entered the battle!*:#:{
  set %enemy $1
  /os client join %enemy #battledome
}


Unless the /os alias contains code to verify that the text is being done by the correct gamebot, you should have code at the beginning of your event handler to make sure it's not me sending that message smile

Something like:
Code:
if ($nick != NameOfGameBot) return




Can you give me the exact textmatch for it the names are not the same the text with the Name bee was an example

but it can be another Name

To understand the matter better I try to explain it again ....

The Gamebot reads the names from a folder these names are databases where different things are in there ... but that's not important ..

It should be noted that it is not always the same name but the formatting of the text remains see first post.

So if the Gamebot writes now eg: Dirt_Eater has entered the battle!

You see it's a different name than Bee.

Then another Bot should join the bot client of Botserv using the command /os client join %enemy #battledome

into the room we get the variable %enemy with set %enemy $1 law.

Can you now understand what I want to achieve?


sry for bad english

Last edited by Kaleah; 16/08/18 08:39 AM.
Re: Colortext in on Text Event [Re: Kaleah] #263541 16/08/18 08:39 AM
Joined: Jul 2006
Posts: 3,620
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,620
Code:
on *:TEXT:*:#:{
 if (* has entered the battle!* iswm $strip($1-)) {
  set %enemy $1
  /os client join %enemy #battledome
 }
}


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: Colortext in on Text Event [Re: Wims] #263542 16/08/18 08:47 AM
Joined: Aug 2018
Posts: 6
K
Kaleah Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
K
Joined: Aug 2018
Posts: 6
thx wims but the bot sets the wrong variable

%enemy Bee


so the other bot cannot run the command while the var has a colored content

Re: Colortext in on Text Event [Re: Kaleah] #263543 16/08/18 08:50 AM
Joined: Jul 2006
Posts: 3,620
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,620
you can use $strip like I did
Code:
set %enemy $strip($1)


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: Colortext in on Text Event [Re: Kaleah] #263544 16/08/18 08:51 AM
Joined: Jan 2004
Posts: 1,276
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,276
I was not talking about the "Bee" or "Dirt_Eather" of either of your examples. The way you presented your code, it would be taking action without making sure the message was by "GameBot" or whatever was the name of your gamebot.

If your script replies to "has entered the battle" spoken by anyone, you could find your script is replying to someone else who is not the gamebot. So that was what my example was trying to do.

Re: Colortext in on Text Event [Re: Wims] #263545 16/08/18 08:55 AM
Joined: Aug 2018
Posts: 6
K
Kaleah Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
K
Joined: Aug 2018
Posts: 6
i test it but the variable is %enemy is empty

frown

so
Quote:
set %enemy $Strip($1)
dont work

Re: Colortext in on Text Event [Re: maroon] #263546 16/08/18 08:59 AM
Joined: Aug 2018
Posts: 6
K
Kaleah Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
K
Joined: Aug 2018
Posts: 6
Originally Posted By: maroon
I was not talking about the "Bee" or "Dirt_Eather" of either of your examples. The way you presented your code, it would be taking action without making sure the message was by "GameBot" or whatever was the name of your gamebot.

If your script replies to "has entered the battle" spoken by anyone, you could find your script is replying to someone else who is not the gamebot. So that was what my example was trying to do.



So is the main script now correct?

Code:

on *:TEXT:*:#:{
  if ($nick != Battledome) return
  if (* has entered the battle!* iswm $strip($1-)) {
    set %enemy $stip($1) <--- Dont work variable is empty
    /os client join %enemy #battledome
  }
}

Last edited by Kaleah; 16/08/18 09:00 AM.
Re: Colortext in on Text Event [Re: Kaleah] #263547 16/08/18 09:10 AM
Joined: Jan 2004
Posts: 1,276
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,276
Your example mis-spells $strip($1) as $stip($1)

Re: Colortext in on Text Event [Re: maroon] #263548 16/08/18 09:11 AM
Joined: Aug 2018
Posts: 6
K
Kaleah Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
K
Joined: Aug 2018
Posts: 6
no it takes the same effect

the variable is empty when i use set %enemy $strip($1)
in my Code


//edit - Works reason:

Oh sorry I did not know that one must pay attention to upper and lower case ..


Thanks vor Quickhelp tread closed


Last edited by Kaleah; 16/08/18 09:15 AM.
Re: Colortext in on Text Event [Re: Kaleah] #263549 16/08/18 09:32 AM
Joined: Jan 2004
Posts: 1,276
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,276
I'm not sure what you changed to make it work, if spelling strip correctly didn't solve it, because mIRC defaults to matching upper and lower case versions of the same word. It's possible the %enemy just *looks* empty because $1 may have been only a color code. You could make sure $1 is not empty by beginning your event handler with code that changes $1 into a version of the original message without having colors:

tokenize 32 $strip($1-)