Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

If i fix this problem my script will be complete...

Kyle Kamachi
Registered User
Join date: 4 Feb 2007
Posts: 16
06-20-2007 22:38
So here's the last problem with my raffle machine, down in the llhttprequest i have one on a timer, to check the database and see how many people are currently in the raffle, and another one which is not on a timer and that one adds the player's name into the database

Now if you load my code up into SL you will see that something is terribly wrong yet i just dont know what it is...the way it looks to me the code should be fine yet there is this problem....heres the code


key req_id1;
key req_id2;
string lname;
integer lplaycount;
default
{

state_entry()
{
integer lplaycount = 0;
llSetTimerEvent(1.0);
}

timer() {
req_id1 = llHTTPRequest("http://kklouzal.awardspace.com/secondchk.php", [HTTP_METHOD, "POST"], "";);
}

touch_start(integer total_number) {
lname = llDetectedName(0);
req_id2 = llHTTPRequest("http://kklouzal.awardspace.com/secondcom.php", [HTTP_METHOD, "POST"], "name=" + lname);
++lplaycount;
}

http_response(key request_id, integer status, list metadata, string body) {
if (request_id = req_id2) {
llSay(0, body);
llSetText("Current Local Players: " + (string)lplaycount + "\nLatest Local Player: " + lname + "\n-------------------------\n Current Global Players: " + "\nLast Global Player: ", <0.0,1.0,0.0>, 1);
}
if (request_id = req_id1) {
llSay(0, body);
llSetText("Updating Machine...", <0.0,1.0,0.0>, 1);
}
llSetTimerEvent(1.0);
}
}
Prospero Frobozz
Astronerd
Join date: 10 Feb 2006
Posts: 164
06-21-2007 11:24
From: someone
if (request_id = req_id2) {


Did you mean:

if (request_id == req_id2) {

?
_____________________
---
Prospero Frobozz (http://slprofiles.com/slprofiles.asp?id=6307)
aka Rob Knop (http://www.pobox.com/~rknop)
Kyle Kamachi
Registered User
Join date: 4 Feb 2007
Posts: 16
06-21-2007 14:08
it does not matter whatever i do the script just ignores the if then statement and repeats itself over and over again
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
06-21-2007 15:38
If the repeating isn't desired you want to add llSetTimerEvent(0.0) in the timer() event handler, otherwise the timer will just keep expiring every second.
Kyle Kamachi
Registered User
Join date: 4 Feb 2007
Posts: 16
06-21-2007 15:58
no see i want the repeating to happen, but down at the bottom where the two if statements are, the script just ignores them and goes through both...
Elsewhere Essex
Registered User
Join date: 8 Sep 2006
Posts: 50
06-21-2007 16:17
From: Prospero Frobozz
Did you mean:

if (request_id == req_id2) {

?

above poster is exactly correct, you need to use == for comparison.
by using "=" you are telling the script that the request is = to the request_id# and the if will always be true.

use
if (request_id == req_id1) {

and

if (request_id == req_id2)

respectively and your problem "should" be solved
Kyle Kamachi
Registered User
Join date: 4 Feb 2007
Posts: 16
06-21-2007 18:15
ahh! thank you ever so much it fiinally works =]