Jump to content

Recommended Posts

Hi. I've started looking into PHP.....just today. I'm interested in using it with the game Second Life. So far, I've managed to have chat from Second Life be picked up by a listening object, sent to a php file, and turned into a txt file. Then I have the text file reverse it's lines and show up on a webpage. Above this chatlog, I want to have a square image generated with the gd library that displays the detected "sim" (think of it like a server) and the location (the x, y, z within that server).

 

I am able to get the square drawn and the text "X:  Y:  Z:  SIM:" to appear, but there's no information. Here's what I've got for the location info:

 

<?php

   

    $info = $_GET['info']; //gives "13|216|611|Xappen"

 

list($x, $y, $z, $sim) = split('|',$info);

//x=13 , y=216, z=611, sim=Xappen

 

 

$map = ImageCreate (256, 256) or die ("Cannot Create image");

 

$bg_color = ImageColorAllocate ($map, 20, 20, 20); //greyish

 

$txt_color = ImageColorAllocate ($map, 255, 255, 255); //white text

 

ImageString ($map, 3, 5, 5, "X: " .$x, $txt_color);

ImageString ($map, 3, 5, 20, "Y: " .$y, $txt_color);

ImageString ($map, 3, 5, 35, "Z: " .$z, $txt_color);

ImageString ($map, 3, 5, 50, "Sim: " .$sim, $txt_color);

 

 

 

header ("Content-type: image/png");

 

 

 

 

imagepng($map);

?>

 

Now I KNOW for a fact that the script is getting the info. Because when I added the command to write it to a text file, it added "13|216|611|Xappen" just fine. It just won't "echo" it (when I tried), nor draw it on the image.

 

Help appreciated...I'm completely new to this and probably frustrated over some stupid mistake... :D

 

 

 

Here's where the work in progress is: http://torrobinson.3host.biz/sllog.html

Have you tried echo-ing your $x $y $z and $sim strings, just to make sure they're actually getting set a value.  Do this before your ImageString()

 

Yeah... When i'd echo it with some text like "x is:"... ,just the text would come through and not any x value. I'm posting this from my ipod so cant try anything now...

You could try explode rather than split:

 

<?php 
list($x, $y, $z, $sim) = explode("|", $info);
?>

 

Or instead of using list you could assign them all individually

 

<?php


$temp = explode("|", $info);

$x = $temp[0];
$y = $temp[1];
$z = $temp[2];
$sim = $temp[3];

?>

Thanks for the reply. I tried both of those, and echoing before the imagestring again but nothing came up. And again I tried replacing the echo with saving it to a txt file and it DID work. It has the string...just won`t do anything but save with it so far...

*bump*

 

Still I'm having this problem. Basically I can save the string to a file, but I can't echo it or use it in other functions...

 

Anybody have this before?

 

Nevermind. For some reason, writing it and having another script read it worked fine.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.