[Orion ML] Re: A proposito di OrionScript

  • From: Simone Tellini <orion@xxxxxxxxxxxx>
  • To: orion@xxxxxxxxxxxxx
  • Date: Mon, 16 May 2005 21:42:52 +0200

On Mon, 16 May 2005 21:40:50 +0200
Simone Tellini <orion@xxxxxxxxxxxx> wrote:

ST> ST> Attached you can find a simple script I wrote as a test: it contains
ST> 
ST> err, I forgot to actually attach the file... :-)
ST> -- Binary/unsupported file stripped by Ecartis --
ST> -- Type: application/octet-stream
ST> -- File: Test2.ophp

tsk. Anyway, its content is:

---8<------8<------8<------8<---- CUT  ----8<------8<------8<-----
<?php

function testRelPath()
{
        printf( "%s\n", RelativePath( 'Test.php' ));
}

function getChan()
{
        global $channel;

        $channel = GetCurrentChannel();
}

function rndSlap()
{
        $chan = GetCurrentChannel();

        if( $chan !== null ) {

                $users = $chan->getUsers();

                $chan->Say( "I think I'll slap a random user..." );

                $idx = rand( 0, count( $users ) - 1 );

                Cmd( 'SLAP ' . $users[ $idx ]->getNick() );

        } else
                DisplayOnActiveWindow( 'Uh, not in a channel!' );
}

function action( $win, $origin, $msg )
{
        print( "win:\n" );
        print_r( $win );
        
        print( "\norigin:\n" );
        print_r( $origin );

        printf( "\nmsg:\n%s\n", $msg );

        return( strpos( $msg, 'ignorami' ) === false );
}

RegisterEvent( 'action', SE_ACTION );

?>
---8<------8<------8<------8<---- CUT  ----8<------8<------8<-----

-- 
Simone Tellini
http://tellini.info


-- 
Orion support mailing list - http://tellini.info/software/orion/
List archive: //www.freelists.org/archives/orion
Subscribe/Unsubscribe requests: <orion-request@xxxxxxxxxxxxx>

Other related posts: