mIRC Home    About    Download    Register    News    Help

Print Thread
#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?

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
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

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.
Joined: Jul 2006
Posts: 4,149
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
Code:
on *:TEXT:*:#:{
 if (* has entered the battle!* iswm $strip($1-)) {
  set %enemy $1
  /os client join %enemy #battledome
 }
}


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
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

Joined: Jul 2006
Posts: 4,149
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
you can use $strip like I did
Code:
set %enemy $strip($1)


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
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.

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

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.
Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
Your example mis-spells $strip($1) as $stip($1)

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.
Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
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-)


Link Copied to Clipboard