Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

ATM Help

Noah Aero
Registered User
Join date: 15 May 2007
Posts: 11
05-27-2007 07:35
Ok, why won't my script output the message when someone clicks Withdraw? Anyone see anything?

CODE

integer withdraw;
integer use;
key user;
integer ok2;
string pmode;
integer balance;
string server="abb4c132-6cfc-7b8e-89c7-20e5aa3590f6@lsl.secondlife.com";
default
{
state_entry()
{
withdraw=1;
use=FALSE;
llSay(0, "Welcome to TEST ATM SERVICE DO NOT PAY ME");
llRequestPermissions(llGetOwner(),PERMISSION_DEBIT);

}


run_time_permissions(integer perm)
{
if(perm && PERMISSION_DEBIT)
{
state ok;
}
else
{
llRequestPermissions(llGetOwner(),PERMISSION_DEBIT);
}
}
}

state ok
{
on_rez(integer num)
{
llResetScript();

}

touch_start(integer num)
{
if(llDetectedKey(0) != llGetOwner())
{
llDialog(llGetOwner(),"Please choose one option:\n1) Set withdraw payment\n--- Current withdraw payment: L$"+(string)withdraw+"\n2) Load your account",["1","2"],15);
}
else if(llDetectedKey(0) == llGetOwner() && use==FALSE)
{
user = llDetectedKey(0);
use = TRUE;
llWhisper(0,"Please hold. Checking account...");
llEmail(server,"check",llDetectedKey(0));
}
}
listen(integer channel,string name,key id,string message)
{
if(channel==15)
{
if(message == "2" &&channel==15)
{
user = id;
use= TRUE;
llWhisper(0,"Please hold. Checking account...");

}

else if(message == "1")
{
llDialog(id,"The withdraw amount, must be between 0 to 5.",["L$ 3","L$ 4","L$ 5","L$ 0","L$ 1","L$ 2"],15);
ok2 = TRUE;

llSetTimerEvent(15);
}

else if(ok2)
{
withdraw= (integer)llGetSubString(message,2,-1);
ok2 = FALSE;
llOwnerSay("Setting withdraw charge to L$"+(string)withdraw);

llSetTimerEvent(0);
}
}
if(message=="Withdraw" && channel==13)
{
llSay(0,"Please say the amount you would like to withdraw");
}
if(message=="Deposit" && channel==13)
{
llSay(0,"Please say the amount you would like to withdraw");
}

if(channel==0 &&id==user)
{
if((integer)message<=balance)
{
llSay(0,"Withdrawing L$"+message+" from your account.");
llEmail(server,"withdraw",message);
}
}
}
link_message(integer num,integer channel,string subj,key id)
{
if(subj=="create")
{
llDialog(user,"I'm sorry, but it seems you do not have an account. To open an account please pay me:\nPremium - L$10\nBetter Basic - L$7\nBasic - L$5",["Close"],1234412);
llSetPayPrice(10,[5,7,10]);
pmode = "create";
llSetTimerEvent(30);
}
else if(subj=="created")
{

string balance=(string)id;
llDialog(user,"Your balance: L$"+(string)id+". Please choose one of the following options:",["Deposit","Withdraw","Done"],13);
llListen(13, "", "", "");
}
}
listen(integer channel,string name,key id,string message)
{


if(message=="Withdraw")
{
llSay(0,"Please say the amount you would like to withdraw");
llListen(0,"",user,"");
}
if(message=="Deposit")
{
llSay(0,"Please say the amount you would like to withdraw");
llListen(0,"",user,"");
}
}
listen(integer channel,string name,key id,string message)
{

if(channel==0 &&id==user)
{
if((integer)message<=balance)
{
llSay(0,"Withdrawing L$"+message+" from your account.");
llEmail(server,"withdraw",message);
}
}
}

timer()
{
llSay(0,"TIME OUT");
use=FALSE;
user=NULL_KEY;

}
money(key giver, integer amount)
{
if(pmode=="create")
{
if(amount==5)
{
llSay(0,"Opening a basic account for "+llKey2Name(giver));
llEmail(server,"create",giver);
}
else
{
llSay(0,"Invalid.");
llGiveMoney(giver,amount);
}
}

}

}
Kode Forager
llDie();
Join date: 23 Nov 2006
Posts: 2
05-29-2007 11:15
From: Noah Aero
Ok, why won't my script output the message when someone clicks Withdraw? Anyone see anything?

CODE

touch_start(integer num)
{
if(llDetectedKey(0) != llGetOwner())
{
llDialog(llGetOwner(),"Please choose one option:\n1) Set withdraw payment\n--- Current withdraw payment: L$"+(string)withdraw+"\n2) Load your account",["1","2"],15);
}
else if(llDetectedKey(0) == llGetOwner() && use==FALSE)
{
user = llDetectedKey(0);
use = TRUE;
llWhisper(0,"Please hold. Checking account...");
llEmail(server,"check",llDetectedKey(0));
}
}


Before or after your llDialog from touch_start, you are forgetting to call llListen, so your dialog response never is heard.
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
05-29-2007 11:47
you are also at one point checking that its not the owner and then displaying the dialog to the owner!
_____________________
I'm back......