Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Help!

Abdullah Lemon
Lemons Estates
Join date: 2 Oct 2008
Posts: 56
12-17-2008 12:36
EDIT: UPDATED

Please check this script and tell me whats wrong.. i've been at it for couple of days now.. no luck finding whats' wrong with it..


CODE
 
list amount = ["<-- YES -->","<-- NO -->"];
list amount2 = ["<-- HUD -->","<-- POTION -->"];
string msg = "The user you spoke off was not found in the system, please select wheather you want to continue or not. If yes the user will be given a NULL key";
string msg2 = "Please select the the item you want";
string str_url = "http://www.domain.com/alt.php?";
string n2k_url = "http://w-hat.com/name2key";
integer HUD = 0;
integer POTION = 0;
integer PayThis;
string User;
string UserN;
string userName;
string body = "Crate";
vector white = <1.0,1.0,1.0>;
vector green = <0.0,1.0,0.0>;
key ToucherID;
key req1;
key req;
key clicker;
integer channel;
integer channel2;

integer listen_id;
integer listen_id2;
integer listen_id3;

default
{
state_entry() {
channel = ( -1 * (integer)("0x"+llGetSubString((string)llGetKey(),-5,-1)) );
llSetText("FUNDER V2.0 - READY",<0.0, 1.0, 0.0>,1);
}
on_rez(integer start_param) {
llResetScript();//added this so it resets the script on rez
}
touch_start(integer total_number) {
ToucherID = llDetectedKey(0);
if(llSameGroup(llDetectedKey(0))){
llWhisper(0,"+++++++++++++++++++++++++++++++++++++++++++++++");
llWhisper(0,"| Welcome to the funder machine V2.0");
llWhisper(0,"| I will listen for 30 seconds, Please speak");
llWhisper(0,"| the exact name of the chosen one.");
llWhisper(0,"| If you need any help, please contact Abdullah Lemon at");
llWhisper(0,"| abdullah.lemon@domain.com or on IM");
llWhisper(0,"+++++++++++++++++++++++++++++++++++++++++++++++");
llSetTimerEvent(30.0);
listen_id2 = llListen( 0, "", ToucherID, "");
}else{
llWhisper(0,"+++++++++++++++++++++++++++++++++++++++++++++++");
llWhisper(0,"| Sorry, You dont have the right to use this box.");
llWhisper(0,"+++++++++++++++++++++++++++++++++++++++++++++++");
}
}



Abdullah Lemon
Lemons Estates
Join date: 2 Oct 2008
Posts: 56
12-17-2008 12:38
CODE
 

listen(integer channel, string name, key id, string message) {
llListenRemove(listen_id2);
llSetTimerEvent(0.0);
llSetText("Fund will be made to "+(string)message,<1.0, 1.0, 0.0>,1);
req1 = llHTTPRequest(n2k_url+ "?terse=1&name=" +llEscapeURL(message),[],"");
//req1 = "00000000-0000-0000-0000-000000000000";
//body = "b77aa6db-34d9-46c2-84f4-92da99a10721";
//userName = llKey2Name(body);

}

http_response(key id, integer status, list meta, string chosenName)
{
llSay(0,"HTTP OK");
if(id != req1) return;
if(status == 499) llSay(0, "Request time out. Please try again.");
else if(status != 200) llSay(0, "An unknown error occured.");
else if(chosenName = "00000000-0000-0000-0000-000000000000")
{
state checkuser;
}
else
{
userName = llKey2Name(chosenName);
llSay(0,"Pay OK");
state Pay;
}
}
}

state checkuser
{
state_entry()
{
clicker = llDetectedKey(0);
llSay(0,"checkuser OK");
listen_id = llListen(0,"",clicker,"");
llDialog(ToucherID, msg,amount, channel);
}
listen(integer channel, string name, key id, string answer) {
llListenRemove(listen_id);
{

if (answer == "<-- YES -->")
{
//llSay(0, "The user you spoke off was not found in the system, a NULL key will be registered for him/her");
llSetText("Fund will be made to 00000000-0000-0000-0000-000000000000",<1.0, 0.0, 0.0>,1);
llResetScript();

}else{
llSay(0, "The payment was canceled");
llResetScript();
}

}
}
}
state Pay
{
state_entry()
{
channel2 = ( -1 * (integer)("0x"+llGetSubString((string)llGetKey(),-5,-1)) );
llSetText("Fund will be made to "+(string)userName+" key "+(string)body,<1.0, 1.0, 0.0>,1);
listen_id3 = llListen(0,"",ToucherID,"");
llDialog(ToucherID, msg2,amount2, channel2);
}
listen(integer channel2, string name, key id, string choice) {
llListenRemove(listen_id3);
if(choice == "<-- HUD -->")
{
PayThis = 599;
User = id;
UserN = llKey2Name(id);

}else{
PayThis = 249;
User = id;
UserN = llKey2Name(id);
}
req = llHTTPRequest(str_url+"addAmount=true&aviName="+llEscapeURL(UserN)+"&amount="+(string)PayThis+"&aviKey="+(string)User,[],"");
llSetText("",<0,0,0>,0);
}
on_rez(integer start_param)
{
llResetScript();
}
http_response(key id, integer status, list meta, string body)
{
if(id != req) return;
if(status == 499) llSay(0, "Request time out. Please try again later.");
else if(status != 200) llSay(0, "An unknown error occured.");
else if(body == "nomoney") llSay(0, "Sorry, the funder is empty.");
else if(body == "low") llSay(0, "Sorry, the funder is empty.");
else if(body == "unauthorized") llSay(0, "Sorry, you have been blocked from using the funder.");
else if(body != "authorized") llSay(0, "You have already been paid your maximum daily amount.");
else
{
//payed_amount = (integer)body;
integer pay_ = (integer)PayThis;
string avi = llKey2Name(id);
llGiveMoney(id, pay_);
llInstantMessage(id, "Thank you " + avi +", you've been payed '" + (string)pay_ + "'.");
llInstantMessage(id, "Please contact Abdullah Lemon on IMs or abdullah.lemon[AT]domain.com for any assistance");
state default;
}
}
}

Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
12-17-2008 13:57
A quick looks finds this:
CODE

state checkuser
{
state_entry()
{
clicker = llDetectedKey(0);


Can't use llDetectedStuff in state_entry..

More details on how it's behaving wrongly would be helpful if that doesn't solve the problem.
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!!
- Go here: http://jira.secondlife.com/browse/SVC-1224
- If you see "if you were logged in.." on the left, click it and log in
- Click the "Vote for it" link on the left