mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
#138772 06/01/06 10:52 AM
Joined: Feb 2005
Posts: 344
B
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Feb 2005
Posts: 344
Hi,

Code:
 On 1:text:Bartender*:*: { 
if (cola isin $1-) { $read(bar\cola.txt,t) }
}
 

What i want to know is when I triggers this with:
Bartender do you have a cola for me and coolguy
How to let the name coolguy get back in the respond.
So the respond would lok like this:
Bartender slides a cola to bullseye and coolguy

My guess is let it check if $1- contains a name from the nicklist and ifso use it again in the respond but I have no idea howto do that.
Thanks for helping out

Greetzz

#138773 06/01/06 11:39 AM
Joined: Nov 2005
Posts: 105
D
Vogon poet
Offline
Vogon poet
D
Joined: Nov 2005
Posts: 105
Code:
on 1:TEXT:Bartender*:#:{ if (cola isin $$1-) && ($8 == me) describe $chan slides a cola to $nick and $remove($10,?) }

I'm not completly sure what you have saved in your cola.txt, but I'm pretty sure this is what you're asking for. But you must ensure that the syntax used is:
Quote:

Bartender do you have a cola for me and coolguy?

Where everything except for the "coolguy" is the same. The question mark is optional, if it's added, it's removed with the reply. The morning is early though, so if it isn't what you're wanting, explain yourself a little bit more, and let us know what you have stored in cola.txt. Thanks.

Last edited by drc4; 06/01/06 11:52 AM.
#138774 06/01/06 03:13 PM
Joined: Feb 2005
Posts: 344
B
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Feb 2005
Posts: 344
not exactly what i had i mind.
the one who triggers the on text and the other nick(coolguy in the example) can be on random places in $1-.
The purpose is that someone can order a cola in multiple way's
For example:
Bartender 1 cola please will return 1 cola coming up $nick
or
Bartender do you have a cola for me and give .......... one also will return a cola for $nick and a cola for .......... are on the way
or
Bartender give ......... and .......... and .......... a cola on my tab please will return oke $nick a cola for ........, ......... and .......... on your tab.

The ......... place can be any name in the nicklist so the ...... places are not on scpecific place like $4 they could be anywhere so one time the ........ place is $4 and the next it is $7 or $3.
hope this is a better explenation of what i had in mind.

Greetzz

#138775 07/01/06 02:58 AM
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
Unless you can program some AI into your mIRC, I think the best you can do is a bunch of if cases.

-genius_at_work

#138776 07/01/06 04:54 AM
Joined: Oct 2005
Posts: 122
O
Vogon poet
Offline
Vogon poet
O
Joined: Oct 2005
Posts: 122
you COULD try to think of common words that will be before and after the nick, though this will not work accurately, for example in your examples, make the nicks it replies to in

"Bartender do you have a cola for me and give .......... one also will return a cola for $nick and a cola for .......... are on the way"

make the script make the "2nd nick"t he word after give


or for this one "Bartender give ......... and .......... and .......... a cola on my tab please will return oke $nick a cola for ........, ......... and .......... on your tab.
"

the words before and, this wont work accurately, however the way your saying it is there could be a million variations on how you say it, the elseif statements would be more accurate, but would be less flexible with what you type

#138777 07/01/06 06:35 AM
Joined: Mar 2005
Posts: 212
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Mar 2005
Posts: 212
this looks like a job for regex
how many names do you want it to be able to catch

maybe i could hammer something out
although even then you know someones gonna ask for a coke for himslef and a pepsi for such and such

Last edited by NeUtRoN_StaR; 07/01/06 06:36 AM.
#138778 07/01/06 06:54 AM
Joined: Mar 2005
Posts: 212
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Mar 2005
Posts: 212
Code:
On 1:text:Bartender *:#:{
  if (cola isin $1-) {
    var %nicknum = $nick($chan,0)
    var %nick1 = 1
  }
  while (%nicknum >= %nick1) {
    if ($nick($chan,%nick1) isin $1-) {
      describe $chan $read(cola.txt,t) $nick($chan,%nick1)
    }
    inc %nick1
  }    
  describe $chan $read(cola.txt,t) $nick
}

i made this; it seems to work

i did some pretty limited testing
you might want to add a check that the person giving the order doesnt list their name but thats easy enough

($nick($chan,%nick1) != $nick)

not that it would hurt anything but it'd make you look silly

and we dont want that

i took the liberty of making it in any channel ideally ud specify
the channel in the event with it being * they would need to
specify the target for the response blah blah blah

umm i think that about does it

oh yeah i made bartender*
bartender * if they cant seperate
the words in their sentences they dont need a drink smile

hope this helps

#138779 07/01/06 08:26 AM
Joined: Feb 2005
Posts: 344
B
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Feb 2005
Posts: 344
thank this does the trick with one random name.
I'll try to let it work on more then one name.
if I do I'll post it again.
If you can before I do pleasa post also that would save me a lot of pain smile

Neutron you said regex ... what would the script be like ?
more complex then the one you post I think but would that create the option of ordering a drink for 4,5 or 6 persons ?

GreetZZ

Last edited by Bullseye; 07/01/06 08:32 AM.
#138780 07/01/06 08:36 AM
Joined: Mar 2005
Posts: 212
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Mar 2005
Posts: 212
mine alredy does that
ive tested it with myself and 2 others

ill run and see if i can test it on a larger group
but the one i put should be able to handle the entire channel

as far as regex i dont even really know if that would be helpful but with some of the stuff you mentioned before you would need a dynamic paradigm around the names since if the number of names increases so would the number of ands

anyways like i said what i have there should do the job for a indefinite number of nicks

#138781 07/01/06 08:43 AM
Joined: Mar 2005
Posts: 212
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Mar 2005
Posts: 212
one thing i did catch is if they order drinks for others and not themself but other than that it worked fine with 3 names not including the one who made the order

so ill need to throw in a check for me myself or i
or rather smile you will need to throw ina check for me myself or i and then predicate the last describe firing to that being true
sorta like this
Code:
On 1:text:Bartender *:#:{
  if (cola isin $1-) {
    var %nicknum = $nick($chan,0)
    var %nick1 = 1
  }
  while (%nicknum >= %nick1) {
    if ($nick($chan,%nick1) isin $1-) {
      describe $chan $read(cola.txt,t) $nick($chan,%nick1)
    } 
    inc %nick1
  }
  if (((i isin $1-) || (me isin $1-) || (myself isin $1-))) {  
    describe $chan $read(cola.txt,t) $nick
  }
}



Last edited by NeUtRoN_StaR; 07/01/06 08:48 AM.
#138782 07/01/06 08:49 AM
Joined: Feb 2005
Posts: 344
B
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Feb 2005
Posts: 344
oke got it working .. don't know what was wrong but .........
it gives every nick it's own line.
my option was to have all the nicks said in the trigger line to all come back in one respond line.

#138783 07/01/06 08:54 AM
Joined: Mar 2005
Posts: 212
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Mar 2005
Posts: 212
and having worked on it you can appreciate what a massive pain in the ass that is
i tried myself for quite a while and no matter what i tried i just couldnt make it happen

#138784 07/01/06 09:04 AM
Joined: Feb 2005
Posts: 344
B
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Feb 2005
Posts: 344
to bad ...
THANK YOU very muck for trying
If anything should happen and somehow i'll get it working i'll post it.

#138785 07/01/06 09:27 AM
Joined: Mar 2005
Posts: 212
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Mar 2005
Posts: 212
i got it to do them in one line like you wanted
but its pretty glitchy
if your real attached to the idea il show you
otherwise ill keep it to me self

#138786 07/01/06 10:02 AM
Joined: Feb 2005
Posts: 344
B
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Feb 2005
Posts: 344
I also got it working whit some help from u4ia from www.mirc-helpdesk.

This is what i have now:
Code:
 On 1:text:Bartender *:#:{
if (cola isin $1-) { 
var %nicknum = $nick($chan,0) 
var %nick1 = 1 
} 
while (%nicknum >= %nick1) { 
if ($nick($chan,%nick1) isin $1-) { 
var %nicklijst = $+(%nicklijst,$chr(32),$nick($chan,%nick1)) 
} 
inc %nick1 
} 
$read(bar\cola.txt,t)  $+ %nicklijst
}
 


Tell me what do you have neutron ?

#138787 07/01/06 10:29 AM
Joined: Mar 2005
Posts: 212
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Mar 2005
Posts: 212
Code:
#barfailure on
On 1:text:Bartender*:#:{
  if (cola isin $1-) {
    set %nicknum $nick($chan,0)
    set %nick1 1
  }
  while (%nicknum >= %nick1) {
    if ($nick($chan,%nick1) isin $1-) {
      set $+(%,test,%nick1) $chr(44) and $nick($chan,%nick1)      
    } 
    inc %nick1
  }
  if (((i isin $1-) || (me isin $1-) || (myself isin $1-))) {  
    describe $chan $read(cola.txt,t) $+($nick,%test1,%test2,%test3)
  }
  else {
    describe $chan $read(cola.txt,t) $+(%test1,%test2,%test3)
  }
  unset %test*
}
#barfailure end


its 5:30 am so im thinking i should sleep and beat my head against it tomorrow

Last edited by NeUtRoN_StaR; 07/01/06 11:30 AM.
#138788 07/01/06 12:10 PM
Joined: Oct 2004
Posts: 72
C
Babel fish
Offline
Babel fish
C
Joined: Oct 2004
Posts: 72
So when I say: "bartender I hate cola", he gives me one! :tongue:

#138789 07/01/06 12:45 PM
Joined: Feb 2005
Posts: 344
B
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Feb 2005
Posts: 344
specialy for you i will include hate to it so it will ask you what the **** your doing in a barroom :P :P :P :P

But well said ... that is something that has to be solved.
And so on there will be alot of things to change to stop from letting the bot say somrthing when it doesn't have to.

Another thing is we're asuming the trigger bartender will only be used to order drinks not saying they hate it.

#138790 07/01/06 01:43 PM
Joined: Feb 2005
Posts: 344
B
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Feb 2005
Posts: 344
AAAAhhhhh stupid me.
in al the stress trying to get all the names in one line I overlooked one thing.
I thought it would be nice to have bartender as a trigger but you can only use on 1:text:Bartender *:#: { once in a script.
anyone any ideas on how to expand the script with more drinks......
My eyes hurt from staring crazy
This is what I have so far:
Code:
  On 1:text:Bartender *:#:{
if (cola isin $1-) { 
var %nicknum = $nick($chan,0) 
var %nick1 = 1 
} 
while (%nicknum >= %nick1) { 
if ($nick($chan,%nick1) isin $1-) { 
var %nicklijst = $+(%nicklijst,$chr(32),$nick($chan,%nick1)) 
} 
inc %nick1 
} 
if (((I isin $1-) || (me isin $1-) || (myself isin $1-))) { $read(bar\colaik.txt,t) 
}
else { $read(bar\colalijst.txt,t) 
}
else { $read(bar\cola.txt,t) 
}
}

#138791 07/01/06 02:47 PM
Joined: Feb 2005
Posts: 344
B
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Feb 2005
Posts: 344
So simple so simple ........
gave my eyes some rest and guess what .....
YESS I fixed it.
I just replaced bartender with the drinks and changed if (cola isin $1-) into if (bartender == $1).
Now it looks like this:
Code:
 On 1:text:*cola*:#:{
if (bartender == $1) { 
var %nicknum = $nick($chan,0) 
var %nick1 = 1 
} 
while (%nicknum >= %nick1) { 
if ($nick($chan,%nick1) isin $1-) { 
var %nicklijst = $+(%nicklijst,$chr(32),$nick($chan,%nick1)) 
} 
inc %nick1 
} 
if (((I isin $1-) || (me isin $1-) || (myself isin $1-))) { $read(bar\colaik.txt,t) }
else { $read(bar\colalijst.txt,t) 
}
else { $read(bar\cola.txt,t) 
}
}
 

Page 1 of 2 1 2

Link Copied to Clipboard