Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llDialog Vending Machine

HeatherDawn Cohen
Who Me?!?!
Join date: 9 Aug 2004
Posts: 397
02-07-2005 10:49
I'm wanting to build a vendor that sells one thing, only different colors.

Is there a way to implement llDialog to do this?
Moleculor Satyr
Fireflies!
Join date: 5 Jan 2004
Posts: 2,650
02-07-2005 10:54
Certainly.
_____________________
</sarcasm>
HeatherDawn Cohen
Who Me?!?!
Join date: 9 Aug 2004
Posts: 397
02-07-2005 11:15
Well, thanks for the help....lol ;)

Guess I should have asked for help huh.. HELP!
Sitting Lightcloud
Registered User
Join date: 13 May 2004
Posts: 109
02-07-2005 11:20
Small sample on how you can do it... (Not tested in Editor)

CODE

key buyer;
integer listener;

state default
{

money(key giver integer amount)
{
if (amount==200)
{
buyer=giver;
state select_color;
}

}
}

state select_color
{
state_entry()
{
listener=llListen(23,"",buyer,"");
llSetTimerEvent(120);
//up to 12 different colors....
llDialog(buyer,"Please select color",["Blue","Red","Green", "Purple","White"],23)
}

timer()
{
//incase they hit ignore or fall asleep?
llGiveInventory(buyer, "Blue Shoes");
state default;
}

state_exit()
{
llSetTimerEvent(0);
llListenRemove(listener);
}

listen(integer channel, string name, key id, string msg)
{

if (msg=="Blue")
llGiveInventory(buyer, "Blue Shoes");
else if (msg=="Red")
llGiveInventory(buyer, "Red Shoes");
//etc

state default;
}
}

_____________________

HeatherDawn Cohen
Who Me?!?!
Join date: 9 Aug 2004
Posts: 397
02-07-2005 12:19
I'm getting a syntax error right here ***

default
{

money(key giver ***integer amount)
{
if (amount==200)
{
buyer=giver;
state select_color;
Sitting Lightcloud
Registered User
Join date: 13 May 2004
Posts: 109
02-07-2005 12:25
should be money(key giver, integer amount), sorry didn't test it in world as I have no ability to do so right now
_____________________

Sitting Lightcloud
Registered User
Join date: 13 May 2004
Posts: 109
02-07-2005 12:33
Just FYI it's far from a complete script that you can use but it shows you how you can use llDialog to do it. I assumed you had a vending script and were going to modify it. If you want a complete script and have no script experience I can help you with it when I get in world in about 3 hours....
_____________________

HeatherDawn Cohen
Who Me?!?!
Join date: 9 Aug 2004
Posts: 397
02-07-2005 12:39
DOH, I should have noticed that...lol

Anway, thank you so much. I think this is going to be perfect!
HeatherDawn Cohen
Who Me?!?!
Join date: 9 Aug 2004
Posts: 397
02-07-2005 12:44
From: Sitting Lightcloud
Just FYI it's far from a complete script that you can use but it shows you how you can use llDialog to do it. I assumed you had a vending script and were going to modify it. If you want a complete script and have no script experience I can help you with it when I get in world in about 3 hours....


No, I don't have a vending script. I was trying to build one from scratch. I'm very new when it comes to scripting but I can easily find my way around a script. Wiki is my friend :D

The script that you gave me seems to work exactly how I wanted it to. I modified it to my preferences and it works well. If you don't mind IMing me when you get in world so I can make sure I've done everything right, that would be awesome!

Thanks for all your help so far.