06-18-2007 04:25
Sorry about that, here you go. Once used as public access, the Teleporter was turned back to default, awaiting payment. I fixed this by making the script a heck of a lot easier, eliminating an extra variable after leaving the script for a while, coming back to it, and seeing the error of my ways ;) -- I'll post it over in the library also. Take care all and thanks again for helping me through it!

Please pay attention to notes following script!!

-------------------------

CODE

vector gTargetPos;
integer cost;
string desc;
string hovertext;
key agent;
key gAvatarID=NULL_KEY;
integer gReturnToStartPos=TRUE;
vector gStartPos;
integer paid = 1;
integer access=0;
integer public_access;

warpPos( vector destpos)
{ //R&D by Keknehv Psaltery, 05/25/2006
//Additions by Strife, Talarus Luan
//and final cleanup by Keknehv Psaltery
integer jumps = (integer)(llVecDist(destpos, llGetPos()) / 10.0) + 1;
if (jumps > 100 )
jumps = 100;
list rules = [ PRIM_POSITION, destpos ];
integer count = 1;
while ( ( count = count << 1 ) < jumps)
rules = (rules=[]) + rules + rules;
llSetPrimitiveParams( rules + llList2List( rules, (count - jumps) << 1, count) );
}

default
{
dataserver(key query_id, string desc){
list desc_list = llParseString2List(desc, [";"], []);
gTargetPos = (vector)llList2String(desc_list, 0);
cost = (integer)llList2String(desc_list, 1);
hovertext = llList2String(desc_list, 2) + "\n" +
llList2String(desc_list, 3) + "\n" +
llList2String(desc_list, 4) + "\n" +
llList2String(desc_list, 5) + "\n" +
llList2String(desc_list, 6);
public_access = (integer)llList2String(desc_list, 7);
}

money (key id, integer amount){
paid=amount;

if (paid < cost){
llSay(0,"Sorry, but this class costs " + (string)cost + ". Full amount is required before access.");access=0;
llGiveMoney(id,paid);
llUnSit(llAvatarOnSitTarget());
}
else if (paid > cost){
integer refund = paid - cost;
llSay(0,"This class only costs " + (string)cost + "! Refunding you L$" + (string)refund );
llSay(0,"Access Granted!");
llSetSitText("Teleport");
llGiveMoney(id,refund);
}
else{
llSay(0,"Access Granted!");
llSetSitText("Teleport");
}

}
state_entry(){
llRequestPermissions(llGetOwner(),PERMISSION_DEBIT);
desc = llGetNotecardLine("TPInfo",0);
llSitTarget(<0,0,1>,ZERO_ROTATION);
gStartPos = llGetPos();
}

touch_start(integer touched){
llSetSitText("\n");
llSetText(hovertext, <0,1,0>, 1);
if (public_access == 1){
llSay(0,"Access Granted!");
llSetSitText("Teleport");
}
}

changed(integer change){
if(change & CHANGED_LINK)
gAvatarID = llAvatarOnSitTarget();
if(public_access == 0){llUnSit(gAvatarID);}
if(gAvatarID != NULL_KEY & public_access == 1) {
{
warpPos(gTargetPos);
llSleep(.5);
llUnSit(gAvatarID);
llSleep(.5);

if (gReturnToStartPos) {
warpPos(gStartPos);
if (public_access == 1){
llSetSitText("Teleport");}
else {llSetSitText("\n");}
}
paid=0;
}
}}
}


------------------------------

As you can see in the script, you will need to create a notecard called "TPInfo" (no quotes). It must contain the following information, IN THE FOLLOING ORDER.

<destination vector>;price to charge;text line1;line2;line3;line4;line5;public access switch

EXAMPLE:

<1,2,3>;100;WELCOME!;Right Click And;Pay L$100 to;Teleport to Island!; ; ;0

vector = <1,2,3>
price = 100
text =
WELCOME!
Right Click And
Pay L$100 to
Teleport to Island!

(note the two spaces, we didn't use them, but we still need to have them to keep the format of the notecard. just put blank spaces if you don't need a spot, or to space out stuff)

charge people = 0 (0=yes / 1=no or public access)

That's IT!!!

Enjoy!

- Haplo