mIRC Home    About    Download    Register    News    Help

Print Thread
mIRC Script to PHP Command for IRC Bot #233245 25/07/11 01:19 PM
Joined: Jun 2011
Posts: 10
Z
ZGoldsmith92 Offline OP
Pikka bird
OP Offline
Pikka bird
Z
Joined: Jun 2011
Posts: 10
Hi guys.

I am not sure if this qualifies to be in this section, but - I've also posted this on Hawkee. If someone could help, that'd be awesome.

Below, if the script I am currently using for mIRC. I have the PHP bot from http://wildphp.com. I checked the following website out trying to figure the stuff out needed for IRC, but - i couldn't convert what they had on the website to IRC talk.. www.tizag.com/phpT/index.php


Code:
on 5:INPUT:#:{
  if ($1 == !updatecb) { 
    write -c orders.txt 2Current Battle: $2- 
    .timermsg 1 1 msg $chan 2Battle Updated Successfully. Thank You, $nick   
    msg $me Current Battle link updated by: $nick at $time(h:nnTT) EST.
  } 


  on *:INPUT:#:{
    if ($1 == !cb) { .timermsg 1 1 msg $chan $read(orders.txt,nt)
    }




So.. Basically.....

I want certain people able to use the !updatecb command (Including Me.) - everyone to use the !cb command. (Including Me.)

The !updatecb command updates a text file on my computer while deleting any existing data that was in that file.

The !cb shows what is in the text file.

Im a noob at PHP and I Hope someone can help me!

Thanks,

ZG


Quote:
Oh.

I already have the base of the bot. So, I just need it in a command format similar below:



Code:
case (strcasecmp($command, ':!command') == 0): 
                     if ($this->ex[2] == "#Channel1" || $this->ex[2] == "#Channel2" || $this->ex[2] == "#Channel3" || $this->ex[2] == "#Channel4"); { 
                                $message = ""; 
                                for($i=4; $i <= (count($this->ex)); $i++) 
                                { 
                                        $message .= $this->ex[$i]." "; 
                                } 
                          
                        $send = 'Current Battle - Link'; 
                        $this->send_data2('PRIVMSG '.$this->ex[2].' :', $send); } 
                        unset($this); 
                        unset($name); 
                        unset($send); 
                                break;




Also, The functions is separate so, don't include them in the script - but, in a different code so I can add them.

Thanks

Re: mIRC Script to PHP Command for IRC Bot [Re: ZGoldsmith92] #233246 25/07/11 06:19 PM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
It definitely does not qualify for this section, IMO. You should ask on a PHP forum, specifically wildphp's forum. I'm sure they can easily decode the mIRC script you quoted and tell you how to properly implement it in PHP.

PS: your mIRC script is missing closing brackets and won't even work as an mIRC script. You should probably have working mIRC code before asking anybody to translate it to PHP. That way, whoever is helping you translate it at least knows that you've tested it in the original language, and it works.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Re: mIRC Script to PHP Command for IRC Bot [Re: ZGoldsmith92] #233247 25/07/11 07:30 PM
Joined: Jun 2011
Posts: 10
Z
ZGoldsmith92 Offline OP
Pikka bird
OP Offline
Pikka bird
Z
Joined: Jun 2011
Posts: 10
Right...

I actually fixed that right after I posted this..


Last edited by ZGoldsmith92; 25/07/11 07:32 PM.
Re: mIRC Script to PHP Command for IRC Bot [Re: ZGoldsmith92] #233248 25/07/11 07:56 PM
Joined: Jul 2011
Posts: 5
G
Grant7 Offline
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
G
Joined: Jul 2011
Posts: 5
Just letting you know, you didn't fix the bracket mis-matches of your original post, don't know if that's what you were aiming at for "fixed"..

Re: mIRC Script to PHP Command for IRC Bot [Re: Grant7] #233250 25/07/11 08:44 PM
Joined: Jun 2011
Posts: 10
Z
ZGoldsmith92 Offline OP
Pikka bird
OP Offline
Pikka bird
Z
Joined: Jun 2011
Posts: 10
Well,

When I closed off the script properly, it didn't work at all..

So, I'll leave it as is - Since its working 100% fine.

Thanks for your input though smile

Re: mIRC Script to PHP Command for IRC Bot [Re: ZGoldsmith92] #233252 25/07/11 11:30 PM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
You should never argue when someone tells you to fix an error in your script regardless if you think it works with the error. You did that in your last thread as well and if you keep arguing with people who do know what they are talking about, then you are not likely to get much more help.

Your second on input won't work because it's not separate from the previous on input.

Other errors:
1) on input only handles YOUR text. If it's your text, you don't exactly need a user level (the 5 in the first on input event).

2) If you want this to trigger when others type the commands, you need to use on text event(s) and THEN it makes sense to have a user level.

3) If the first event is triggered, the second event will not trigger because only the first matching event will trigger.


Fixed:
Code:
on *:INPUT:#:{
  if ($1 == !updatecb) { 
    write -c orders.txt 2Current Battle: $2- 
    .timermsg 1 1 msg $chan 2Battle Updated Successfully. Thank You, $nick   
    msg $me Current Battle link updated by: $me at $time(h:nnTT) EST.
  } 
  elseif ($1 == !cb) { .timermsg 1 1 msg $chan $read(orders.txt,nt) }
}

on *:TEXT:*:#:{
  if ($1 == !updatecb && $ulevel == 5) { 
    write -c orders.txt 2Current Battle: $2- 
    .timermsg 1 1 msg $chan 2Battle Updated Successfully. Thank You, $nick   
    msg $me Current Battle link updated by: $nick at $time(h:nnTT) EST.
  } 
  elseif ($1 == !cb) { .timermsg 1 1 msg $chan $read(orders.txt,nt) }
}


Now that your script is fixed, you can find someone willing to convert it for you. Your best bet there will be on their forum.


Invision Support
#Invision on irc.irchighway.net
Re: mIRC Script to PHP Command for IRC Bot [Re: Riamus2] #233253 26/07/11 02:53 AM
Joined: Jun 2011
Posts: 10
Z
ZGoldsmith92 Offline OP
Pikka bird
OP Offline
Pikka bird
Z
Joined: Jun 2011
Posts: 10
Wow..

Thanks a lot.

Listen, I'm sorry the issues I've put you guys through.... frown