The online racing simulator
Insim command that will show text only to me
I've written a song spammer in PHP that reads the current song from an online radio station's website every so often and sends to my LFS screen as a MsgTypePack. The problem is is it appears as if I've said that, i.e. it spams the song to everyone. Is there an InSim command that will allow the script to send a message only I will see, and will work on all servers, including those I'm not an admin on?

I thought of /msg and the /rcm commands but they need admin rights on the server to work, which is annoying.

Cheers
Try /echo
Use the
Quote :struct MsgToConn // 64 chars - send to LFS and on to a chosen connection (0 = host)
{
char Id [4]; // MTC + zero
byte Conn; // connection
byte UniqueId; // destination player UniqueId : if set, Conn is ignored
byte Sp2;
byte Sp3;
char Msg [64]; // text message or /command, must end with zero
};

With conn = 0 if I remember correctly
hmm...I thought that sending an MsgToConn with conn=0 would send the message to the host
Yeah, I'd imagine I'd have to send the MTC to my own UniqueID so others wouldn't get it. But, thank you all very much for your replies. TAA's suggestion works perfectly for me because it works with my existing struct

*edit: oh shit, lol. I read through the docs several times and didn't see it Should not be coding this stuff till 4 in the morning.. Cheers from the noob again!
Yup /echo does the trick.

I actually solved this by making a car radio app. It works with Winamp. Before /echo it couldn't print song titles when visiting on a server (worked but didn't print them). Good in it is that net radio or any local files which Winamp plays works (and the song name printing). And on the plus side you can control the car radio from LFS (on/off, next track). ...anyway sorry, no intension to hijack this thread
#7 - Stuff
I was going to mention /mso but it seems it was replaced by /echo. Don't see it in commands.txt and haven't tried it in-game either. Well, good you found a solution.
Hi, it's me again with a different problem. The script works fine, even better now that I'm using /echo, with one exception. Occasionally LFS throws an "unknown packet (xxbytes)" error upon receiving the MST packet from the script. The only thing that changes in the packet is the song name read from the site (http://www.klf.fi/). It's not much of an issue, but I'd like to know why it happens.

Code excerpt which fetches the song name from the site:

<?php 
if($status) { // pause flag
    
$klf file("http://www.klf.fi/");
    
$foo explode(" "$klf[56]); // line with song name
    
if($song != $foo[2]) { // don't send if song hasn't changed
        
$msg->msg "/echo ^3Now playing : $foo[2]";
        
$msg->send($sock_out);
    } else {
        
$ack->send($sock_out); // keepalive
    
}
        
$song $foo[2];
        
$sleep(60);
} else {
?>

Code excerpt from the insim base class the radio script uses:

<?php 
class mst_pack extends packet {
    var 
$msg;
    
    function 
send($sock_out) {
        
fwrite($sock_out"MST\0".str_pad($this->msg64"\0"));
    }
}
?>

Any ideas why (apparently) some song name strings cause this problem?
#9 - Stuff
Hrm.. I'm no php expert but I think you want something like..

<?php 
if(strlen($msg) > 63) { 
  
$msg substr($msg063) . "\0"
}
?>

Probably a better way to do that. I say that because on the php page for str_pad says "If the value of pad_length (64) is negative or less than the length of the input string, no padding takes place." Which would mean your $msg doesn't get trimmed to 63 characters if it is longer than that, therefore making your packet bigger than 68 bytes.
Oo yeah I had completely forgotten about the length Cheers, that does indeed make sense
Aight, I think I've fixed that now. I send a "prefix" string that says "/echo Now Playing :", and then the song name in 63 byte chunks. It does mean if the song name spans more than one packet it will be multiline, but hey, it works!
Just for the benefit of anyone (who??) who is interested. This is what I ended up with:


<?php 
if(strlen($current) > 52 strlen($prefix)) { // use multiple packets
    
for($i 0$i ceil(strlen($current) / 52); $i++) {
        
$msg_base[$i] = substr($current52 $i52);
    }
    
$msg->msg $prefix;
    
$msg->send($sock_out);
    foreach(
$msg_base as $msg_split) {
        
$msg->msg "/echo ^3$msg_split";
        
$msg->send($sock_out);
    }
    
$msg_base ""// clear so that the msg splits aren't sent if the next name is shorter
} else {
    
$msg->msg "$prefix $current";
    
$msg->send($sock_out);
}
?>


FGED GREDG RDFGDR GSFDG