mIRC Homepage
Posted By: ZGoldsmith92 mIRC Script to PHP Command for IRC Bot - 25/07/11 01:19 PM
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
Posted By: argv0 Re: mIRC Script to PHP Command for IRC Bot - 25/07/11 06:19 PM
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.
Right...

I actually fixed that right after I posted this..

Posted By: Grant7 Re: mIRC Script to PHP Command for IRC Bot - 25/07/11 07:56 PM
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"..
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
Posted By: Riamus2 Re: mIRC Script to PHP Command for IRC Bot - 25/07/11 11:30 PM
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.
Wow..

Thanks a lot.

Listen, I'm sorry the issues I've put you guys through.... frown
© mIRC Discussion Forums