$this->ircClass->sendRaw problem

Back to Module Development

Page: 1  
From User Message Body
Skeeve
Post #730
Member
Date: 8:56 pm, May 26 2008
Posts: 2


$this->ircClass->sendRaw() does not want to send anything to the server. Need to figure out what I am doing wrong for future modules.

sendRaw() is commented out for now, until I can figure things out. Then notice() will be pulled from the code.

$this->ircClass->notice() surprisingly sends what I want send, but prefer the information not be sent privately.

Have tried:
$this->ircClass->sendRaw("NOTICE ".$line['fromNick'].": ".$sendRange);
as suggested in IRC, but still sends nothing.

Oh, sendRaw() information does show in the shell console, but not on the IRC server.

Any suggestions / help is very much appreciated.

Code

<?php
/**
 * Utohelp is a mod created to give user help with Utopia (http://games.swirve.com/utopia/)
 * To be used with php-irc 2.2.1 (http://phpbots.org) 
 *   
 * @author Kenneth Gray
 * @license GNU General Public License
 * 
 * Commands:
 *     !attack <Providence Networth> : Displays the NW range a providence should be hunting     
 */

class utohelp_mod extends module {

    public $title = "Utopia Help";
    public $author = "Skeeve";
    public $version = "0.1 alpha";
    
    public function init()
    {
    }

    public function destroy()
    {
    }

/**
 * public function attack
 * @param $line: array that holds a parsed version of the raw line sent to the server (php-irc created)
 * @param $args: a simple array created from the $line['text'] variable (php-irc created)
 * @param $attack: Is an array of results to send back to the server
 * @param $send: String to sent to server, if error
 * @param $sendRange: string to send to server of total range
 * @param $sendDetail: string to send to server, $sendRange broken down 
 * */
     
    public function attack($line, $args) 
    {
        if($args['arg1'] != "") {     // need to write a function to check if integer. is_int() and is_numeric() still has issues
            
            $nw = $args['arg1'];
            $i = 0;
            $percent = .8;
            
            while ($percent <= 1.3)
            {
                $attack[$i] = $nw * $percent;
                $i++;
                $percent = $percent + .1;
            }
            
            $sendRange = "Your target range is ".$attack[0]." to ".$attack[4];
            $sendDetail = $attack[0]." = 80%, ".$attack[1]." = 90%, ".$attack[2]." = 100%, ".$attack[3]." = 110%, ".$attack[4]." = 120%";
            
            $this->ircClass->notice($line['fromNick'], $sendRange);
            $this->ircClass->notice($line['fromNick'], $sendDetail);
//            $this->ircClass->sendRaw($sendRange);
//            $this->ircClass->sendRaw($sendDetail);            
            return;
        }
        else{
            $send = "Command is !attack YourNetWorth";
            $this->ircClass->notice($line['fromNick'], $send);
//            $this->ircClass->sendRaw($send);
        }        
        return;
    }
}

?>




Mad_Clog
Post #735
user avatar
Member
Date: 5:12 pm, Jun 3 2008
Posts: 176


What's your reason for wanting to use sendRaw() instead of notice() to send a notice out to someone?

And the correct syntax using sendRaw would be:
NOTICE <nick> :<message>
Note the space after the nick, before the :

Example:
NOTICE Mad_Clog :Hi there


But still I don't see any reason not to use the notice() function here...

   

Back to Module Development