Jump to content

Simple status indicator (shop is open) sign to website.


Viggy Ruhig
 Share

You are about to reply to a thread that has been inactive for 1840 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

So I'd like to create prim with a menu through LSL that sends a signal to my website and tells people my cafe is open/closed.  I've worked on some simple scripts before, but never tried something like this that goes to a website.  I'm not sure where to start.  If I have to build the script, I'll try, but if anyone knows of any free ones, a tutorial, past posts related to this, or has any tips I would appreciate it.  My website supports php if needed.

 

Thanks!

Link to comment
Share on other sites

On your website, in your JS, you could do...

var queryString =  decodeURI( window.location.search );
 console.log("queryString is : " + queryString);

then use the variable to change your webpage info.

 

... so you would send an http GET request to your website with a search param...

i.e.  for your SecondLife get req url....

http://www.mywebsite.com?cafe-open

and in the above example, the queryString variable would end up being .... ?cafe-open

( here is a Codepen with an example .... )

https://codepen.io/XMODS/full/KYmxYz?cafe-open

 

( click "change view > editor view " .. to see the code )

for persistent storage of a variable, you would need a server, or google sheet,  mebbe php ?

 

Edited by Xiija
Link to comment
Share on other sites

string url = "your website url here";
string storestatus = "closed";
default {
	touch_end(integer n) {
		if (llDetectedKey(0) == llGetOwner()) {
			if (storestatus == "closed") {
				storestatus = "open";
			}else{
				storestatus = "closed";
			}
			llHTTPRequest(url+"?store="+storestatus, [HTTP_METHOD, "GET"], "");
		}
	}
}

simple quick way of doing it.

Link to comment
Share on other sites

Thanks for the responses!

3 hours ago, VenKellie said:

string url = "your website url here";
string storestatus = "closed";
default {
	touch_end(integer n) {
		if (llDetectedKey(0) == llGetOwner()) {
			if (storestatus == "closed") {
				storestatus = "open";
			}else{
				storestatus = "closed";
			}
			llHTTPRequest(url+"?store="+storestatus, [HTTP_METHOD, "GET"], "");
		}
	}
}

simple quick way of doing it.


Wouldn't both of these methods require an SQL database to save the status info so random viewers to my website who may not even play SL be able query the database to see the current status?   I guess I just don't see how the status information is remembered by the website.
I tried your method first, since I wasn't sure how to setup the LSL scripting with the first one, and it works in game, but doesn't seem to update on my website.  Is a simple <div id="store"></div> sufficient? 
 

Link to comment
Share on other sites

<?php
$store = $_GET['store'];
file_put_contents('storestatus.txt', $store);
?>

then just grab with file_get_contents
 

<?php
$storestatus = file_get_contents('storestatus.txt');
?>
<div id="whatever">Store is <B><?php echo $storestatus; ?></B></div>

 

Link to comment
Share on other sites

1 hour ago, Viggy Ruhig said:

Thanks for the responses!


Wouldn't both of these methods require an SQL database to save the status info so random viewers to my website who may not even play SL be able query the database to see the current status? 

Yes, it has no security code. Which is why an expert should write the code.

Link to comment
Share on other sites

5 minutes ago, Rolig Loon said:

OK, quit it, you two. If you don't, I'm going to have to stop this car and you'll both have to walk home.  🙄

Am from Africa, walking is normal. I was asking about the web site security issue or to be blunt the lack of.

Edited by steph Arnott
Link to comment
Share on other sites

8 minutes ago, steph Arnott said:

Am from Africa, walking is normal. I was asking about the web site security issue or to be blunt the lack of.

Yeah, I walk a lot too.  It's good exercise.  My empty threat was just a gentle reminder that maybe suggestions could be slightly less blunt, and the reactions to suggestions could be a bit less sarcastic.  We're here to learn something.  And I have a headache.  🤒

Link to comment
Share on other sites

Just now, Rolig Loon said:

Yeah, I walk a lot too.  It's good exercise.  My empty threat was just a gentle reminder that maybe suggestions could be slightly less blunt, and the reactions to suggestions could be a bit less sarcastic.  We're here to learn something.  And I have a headache.  🤒

Not English. It is the way my language works. BTW none of it is sarcasm, it is the way it translates.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1840 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...