mIRC Home    About    Download    Register    News    Help

Topic Options
#233245 - 25/07/11 02:19 PM mIRC Script to PHP Command for IRC Bot
ZGoldsmith92 Offline
Pikka bird

Registered: 28/06/11
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

Top
#233246 - 25/07/11 07:19 PM Re: mIRC Script to PHP Command for IRC Bot [Re: ZGoldsmith92]
argv0 Offline
Planetary brain

Registered: 13/10/03
Posts: 3918
Loc: Montreal, QC, Canada
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"

Top
#233247 - 25/07/11 08:30 PM Re: mIRC Script to PHP Command for IRC Bot [Re: ZGoldsmith92]
ZGoldsmith92 Offline
Pikka bird

Registered: 28/06/11
Posts: 10
Right...

I actually fixed that right after I posted this..



Edited by ZGoldsmith92 (25/07/11 08:32 PM)

Top
#233248 - 25/07/11 08:56 PM Re: mIRC Script to PHP Command for IRC Bot [Re: ZGoldsmith92]
Grant7 Offline
Nutrimatic drinks dispenser

Registered: 08/07/11
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"..

Top
#233250 - 25/07/11 09:44 PM Re: mIRC Script to PHP Command for IRC Bot [Re: Grant7]
ZGoldsmith92 Offline
Pikka bird

Registered: 28/06/11
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

Top
#233252 - 26/07/11 12:30 AM Re: mIRC Script to PHP Command for IRC Bot [Re: ZGoldsmith92]
Riamus2 Offline
Planetary brain

Registered: 13/10/04
Posts: 8327
Loc: MA, USA
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

Top
#233253 - 26/07/11 03:53 AM Re: mIRC Script to PHP Command for IRC Bot [Re: Riamus2]
ZGoldsmith92 Offline
Pikka bird

Registered: 28/06/11
Posts: 10
Wow..

Thanks a lot.

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

Top