Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Adding text above vendor displaying item info.

Satai Diaz
Humble Bounty Hunter
Join date: 9 Aug 2003
Posts: 133
06-11-2005 11:27
This is the script I currently use for my vendor. I do not want to get a new vendor system since I am very familiar with this one. All I want to do is add something in the script that would show the item name, price, and position (i.e. 3/20) in text right above the vendor and have it change per item viewed. I see them on other vendor systems I just haven't figured out how to put it in my system.

Any help on this would be great. Thank you.

CODE

integer index;
integer max;
integer price;
string texture;
string object;
string info;


default
{
state_entry()
{
max = 0;

llRequestPermissions( llGetOwnerKey( llGetKey() ), PERMISSION_DEBIT );
llWhisper( 0, "Getting setup");
llGetNotecardLine( "MultiVend.inf", 0 );
}

dataserver( key requested, string data )
{
if( ((integer)data) == 0 ) {
state running;
}
else {
max = max + 1;
llGetNotecardLine( "MultiVend.inf", max );
}
}

link_message(integer sender_num, integer num, string str, key id)
{
llWhisper( 0, "Still setting up, Please wait....");
}
}

state running
{
state_entry()
{
llListen( 0, "", llGetOwnerKey(llGetKey()),"reset machine");
llWhisper( 0, "Found " + (string) max + " items, Ready for use" );
llGetNotecardLine( "MultiVend.inf", 0);
}

touch_start(integer total_number)
{
llSay( 0, "To use me, simply cycle though the items by touching");
llSay( 0, "the arrows in the bottom corners of the screen.");
llSay( 0, "The price is in the lower center of the screen. ");
llSay( 0, "To purchase any item, simply click the ");
llSay( 0, "right mouse button over the screen and select pay.");
llSay( 0, "Product:" + info);
}

listen(integer channel, string name, key id, string message)
{
state default;
}

dataserver( key requested, string data )
{
list information;

information = llCSV2List( data );
price = llList2Integer( information, 0 );
texture = llList2String( information, 1 );
object = llList2String( information, 2 );
info = llList2String( information, 3 );

if( price == 0 )
{
return ;
}

if ( price < 10 )
{
llMessageLinked( LINK_ALL_OTHERS, price % 10, "100", "" );
llMessageLinked( LINK_ALL_OTHERS, 10, "10", "" );
llMessageLinked( LINK_ALL_OTHERS, 10, "1", "" );
}
else if (price < 100)
{
llMessageLinked( LINK_ALL_OTHERS, price / 10 % 10, "100", "" );
llMessageLinked( LINK_ALL_OTHERS, price % 10, "10", "" );
llMessageLinked( LINK_ALL_OTHERS, 10, "1", "" );
}
else
{
llMessageLinked( LINK_ALL_OTHERS, price / 100 % 10, "100", "" );
llMessageLinked( LINK_ALL_OTHERS, price / 10 % 10, "10", "" );
llMessageLinked( LINK_ALL_OTHERS, price % 10, "1", "" );
}

llSetTexture( texture, 2 );
llSay( 0, "Product:" + info);
}

link_message( integer sender_num, integer num, string str, key id)
{
if( str == "move" )
{
index = (index + num + max) % max;
}
llGetNotecardLine("MultiVend.inf",index);
}

money( key giver, integer amount )
{
if ( amount < price )
{
llSay( 0, "This item costs L$" + (string) price );
llSay( 0, "You did not pay enough" );
llGiveMoney( giver, amount );
}
else
{
llSay( 0, "Thank you for shopping with us");
llSay( 0, "Enjoy your " + object );
llGiveInventory( giver, object );
llGiveMoney( giver, amount - price );
}
}
}
_____________________
Satai Diaz
Owner of SD Designs
DJ for Crystal Blue @ Cafe Hailey
Producer of Digital Paradise Studios & Cinema
Admiral of Kazenojin
Owner of SLRA
Cid Jacobs
Theoretical Meteorologist
Join date: 18 Jul 2004
Posts: 4,304
06-11-2005 11:52
i cant get in world atm, but maybe try :

CODE
llSetText(object +(string)price + "Lindens "+ "number " + (string)((integer)index + 1) + " of " + (string)max,<1,1,1>,1.0);


under the llSay( 0, "Product:" + info); line.
_____________________
Satai Diaz
Humble Bounty Hunter
Join date: 9 Aug 2003
Posts: 133
06-11-2005 12:07
Wow Cid worked perfectly. Thanks for your help!
_____________________
Satai Diaz
Owner of SD Designs
DJ for Crystal Blue @ Cafe Hailey
Producer of Digital Paradise Studios & Cinema
Admiral of Kazenojin
Owner of SLRA