text on blackboard
|
|
Dominique Laville
Registered User
Join date: 24 Apr 2008
Posts: 84
|
05-12-2008 08:50
hello everybody,
i would like to program a dynamic blackboard displaying a sequence of questions.
The questions should be inserted on a web site and stored in order to be displayed on the blackboard.
Is it possible to display basic text on the prisms in second life ? should I render images (with text) instead of use basic text ?
ps. is it possible to display web pages on objects ?
thanks
|
|
Ollj Oh
Registered User
Join date: 28 Aug 2007
Posts: 522
|
05-12-2008 09:17
From: Dominique Laville hello everybody, i would like to program a dynamic blackboard displaying a sequence of questions. The questions should be inserted on a web site and stored in order to be displayed on the blackboard. Is it possible to display basic text on the prisms in second life ? should I render images (with text) instead of use basic text ? ps. is it possible to display web pages on objects ? thanks yes. http://rpgstats.com/wiki/index.php?title=XyTextxytext is an opensource script that displays 3x2=6 transparent or 5x2=10 nontransparent asciis on one skewed box or path-cut hollow prism. It can display longer strings on a linkset of multiple prims. The letters are stored on roughly onehundred textures to be displayed in letter-pairs on one face. since its opensource you may find many versions and many implementations all over sl. slscript can also read html plain text and use some website protocols for database access.
|
|
Dominique Laville
Registered User
Join date: 24 Apr 2008
Posts: 84
|
05-12-2008 10:33
thanks,
I'm interested in this last technique:
"slscript can also read html plain text and use some website protocols for database access."
i would appreciate any additional information about it.
|
|
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
|
05-12-2008 13:37
Look here, I know you want secure http too, so this is what you want. http://wiki.secondlife.com/wiki/Secure_HTTP_Post
|
|
Dominique Laville
Registered User
Join date: 24 Apr 2008
Posts: 84
|
05-13-2008 08:33
thank you. I'm interested in both retrieving data from the website and saving data to the website.
If you any suggestion or other links, please let me know!
|
|
Dominique Laville
Registered User
Join date: 24 Apr 2008
Posts: 84
|
05-16-2008 10:34
Hi, I finally installed an apache-php server and I would like to use the script you suggested me on this page: http://wiki.secondlife.com/wiki/Secure_HTTP_PostBy the way, I would like to use the apache server on my mac for testing. Is it ok if I use http://localhost/myscript.php in a script in a object in second life ? or should i use my ip instead ?
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
05-16-2008 13:09
From: Dominique Laville By the way, I would like to use the apache server on my mac for testing. Is it ok if I use http://localhost/myscript.php in a script in a object in second life ? or should i use my ip instead ? You'll have to use your external IP address. If you have some kind of router or a weird ISP that might not be the same as the IP address assigned to your network card. If you're not sure, visit http://whatismyipaddress.com/ to see. Keep in mind that your IP address may also change depending on how your ISP manages things (e.g. I get one dynamic IP address, so it may change every once in a while and I need a router to connect multiple computers, not just a switchbox). If you want to have a stable URL to keep in your scripts in this case, you might need dynamic domain hosting such as DynDNS. For temporary testing there's no reason you can't just use your IP address though. Make sure that Apache's port (usually 80) isn't blocked by your hardware or software firewalls. If you have a router, you may also have to map an incoming port to your specific internal address and port as well.
|
|
Dominique Laville
Registered User
Join date: 24 Apr 2008
Posts: 84
|
05-16-2008 13:24
ok I tried but I have some problems with the port 80 on the router i guess.
Because if I visit with my browser my local ip address, it works, but if i use the general one, it doesn't work...
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
05-16-2008 14:30
From: Dominique Laville Because if I visit with my browser my local ip address, it works, but if i use the general one, it doesn't work... What do you mean by "the general one?" If your internal and external IP addresses are different and you are trying to visit your external one from your local computer, it very well might not work (though yes, it COULD). You'll want to try it from outside your local network somewhere. From LSL if you have to, but better from a friend's computer or some other host on the internet to which you can SSH or something (wget can be useful in that case, so you don't need a graphical browser). It sounds like you are using a router on your local network. Most routers will NOT leave port 80 open by default. You may need support for your particular router, but most have an administrative web interface at address *.*.*.1 in the local address space (for example, if your computer has local address 192.168.2.54, the router's web interface will usually be available at http://192.168.2.1:80/ or https://192.168.2.1:80/). The most common firewall setting would be to map port 80 on the router's external interface to port 80 on your computer (continuing the above example, map port 80 to address 192.168.2.54; some will always use the same port number instead of giving you the option of a different one). If you don't administrate your local network, ignore all of this; you'll have to talk to your network administrator and see if you can get a port opened up for you.
|
|
Dominique Laville
Registered User
Join date: 24 Apr 2008
Posts: 84
|
05-16-2008 14:56
ok. Well, I tried to use my external ip address in the LSL script but it seems not working. I just received this answer:
"Object whisper: Web server said:"
there isn't the body of the httprequest.
I tried to change a number of the ip address and the result is the same. So there isn't connection between my apache server and second life..
if you have any suggestion, let me know please!
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
05-16-2008 15:55
Try printing out the HTTP status returned by the request. Something like: http_response(key requestId, integer status, list metadata, string body) { llOwnerSay("DEBUG - HTTP status "+(string)status); // ... }
|
|
Dominique Laville
Registered User
Join date: 24 Apr 2008
Posts: 84
|
05-16-2008 16:04
ok!
1) it gives "error 499". what does it mean ?
2) why did you divide status / 2 ?
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
05-16-2008 17:14
From: Dominique Laville 1) it gives "error 499". what does it mean ?
2) why did you divide status / 2 ? Hmm. 499 is a client error (see http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html), but the minor code seems to be custom. That's not very helpful. At first I divided the status by 100 to test the major code against 2 (HTTP 2xx codes indicate successful return), then I decided since you are debugging at this point anyway that spitting out the status unconditionally should be fine, so I edited it. Hmm. I would definitely check your router's firewall settings if you have admin access too it, and similarly for your computer's software firewall if it has one. Does the response come back very quickly (on the order of a second or two), or does it take a while (more like 10-30 seconds, probably indicating a timeout because the HTTP request is ignored by a firewall)?
|
|
Dominique Laville
Registered User
Join date: 24 Apr 2008
Posts: 84
|
05-17-2008 01:28
I forgot to mention that it takes around 30 seconds. I can't see the error 499 in the webpage you gave me. (417-->500)
I have a mac (leopard), and I'm using the built-in apache server . I have Airport express as wireless router.
If you can give me more information about it i would appreciate a lot!
|
|
Dominique Laville
Registered User
Join date: 24 Apr 2008
Posts: 84
|
05-17-2008 02:23
solved!
I configured the port 8000 -> 80 on my router to access with external ip.
|
|
Dominique Laville
Registered User
Join date: 24 Apr 2008
Posts: 84
|
05-17-2008 08:26
Hi,
Is it possible to use SL variables in the body of a llHTTPRequest function ?
i.e. integer nextquestion;
requestid = llHTTPRequest("url", [],"parameter1="+nextquestion);
i receive a syntax error instead. If it's not possible, how can I use my variable ? thanks
|
|
Dominique Laville
Registered User
Join date: 24 Apr 2008
Posts: 84
|
05-17-2008 10:32
if i have 2 different http_request functions in the same script and they refers to the same file.php, how can I handle separately the 2 requests ? Is there any example of multiple http_request functions in the same script ? Or maybe, should I separate each http_request on a different script in SL and a different php file on the web server ? key requestid1 key requestid2 function1() { requestid1 = llHTTPRequest("...page.php", [HTTP_METHOD, "POST", HTTP_MIMETYPE, "application/x-www-form-urlencoded"], ""  ; } function2() { requestid2 = llHTTPRequest("...page.php", [HTTP_METHOD, "POST", HTTP_MIMETYPE, "application/x-www-form-urlencoded"], ""  ; } default { touch_start(integer number) { function1() function2() } http_response(key request_id, integer status, list metadata, string body) { if (request_id == request1) llSay(0, body); } if (request_id == request2) llWhisper(0, body); } }
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
05-17-2008 10:57
Either approach should work. If you keep the same PHP destination script for both, you might change an HTTP parameter (or the request body for a POST or PUT request) to distinguish the different uses. For example: string SCRIPT_URL = "http://example.com/path/to/script.php?action="; string DO_THIS_ACTION = "doThis"; string DO_THAT_ACTION = "doThat"; ... request1 = llHttpRequest(SCRIPT_URL+DO_THIS_ACTION, [], ""); request2 = llHttpRequest(SCRIPT_URL+DO_THAT_ACTION, [], "");
Either keep track of which request is being answered (i.e. with request1 vs. request2 above) or include information about it in the HTTP response from your server script.
|
|
Dominique Laville
Registered User
Join date: 24 Apr 2008
Posts: 84
|
05-17-2008 11:21
oh ok, uhm, until now i didn't add any ACTION to the url, I just wrote string SCRIPT_URL = "http://example.com/path/to/script.php and I used the POST command and I passed the parameters. Should I use POST also if I added the action to the url ? How can I handle it in PHP ? Maybe it is better if I post in a php forum 
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
05-17-2008 12:56
Like I said, you can use the body for a POST request (the body of a application/x-www-form-urlencoded encoded POST looks just like the parameter values you would put after the question mark in a URL). I started writing my reply before you edited yours and added the code, so I gave a general answer. In your PHP, you'll get and test the value of the parameter you use. I would consult the PHP documentation for how to do this; I've used it plenty, but can't remember the exact syntax off the top of my head and you can look it up as easily as I. http://www.php.net/manual/en/
|
|
Dominique Laville
Registered User
Join date: 24 Apr 2008
Posts: 84
|
05-18-2008 10:06
ok, it works. But only if I use GET. For example: this is my call: script.php?link=Link1 and this is my code: if ($_GET['link']=="Link1"  { echo "Link 1 Clicked"; } else { echo "Link 2 Clicked"; } If I use POST instead, it doesn't work. Maybe it is correct, sorry my PHP-ignorance 
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
05-18-2008 13:36
Okay. See http://www.php.net/manual/en/language.variables.superglobals.php and note that you can use $_POST or even $_REQUEST to get parameters submitted using the POST method.
|