Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Wh can I get scripting help.

CF Marvin
Registered User
Join date: 5 Feb 2007
Posts: 5
05-08-2007 09:31
I am helping a bunch of kids fund a summer camp project. Here 's what I want to do . I purchased a donation box but want to give out a couple of gifts like the AMVETS their PoPPy flowers. When a person donates a linden they get a poppy , 2 lindens they get a rose, 50 lindens a dozen roses. The students made the flowers so we have the gifts but have no Idea how to script it. When we check out all scripting logs, or anything like that or even ask anyone we either get no where or they want a lot of money. We know the kids wont make much.
Jacques Groshomme
Registered User
Join date: 16 Mar 2005
Posts: 355
05-08-2007 09:43
I'm not in world right now, but something like this should work.

CODE

state default()
{
state_entry() {
llResetScript();
}

money(key giver, integer amount) {
if(amount >= 1 && amount <= 1) {
llGiveInventory(giver, "Poppy");
}

if(amount >= 2 && amount <= 2) {
llGiveInventory(giver, "Rose");
}

if(amount >= 3 && amount <= 50) {
llGiveInventory(giver, "Dozen Roses");
}

if(amount >= 51 && amount <= 100) {
llGiveInventory(giver, "Something Else");
}

if(amount >= 101 && amount <= 200) {
llGiveInventory(giver, "Something Really Nice");
}

if(amount >= 201) {
llGiveInventory(giver, "Something Really Freakin Sweet");
}

llSay(0, "Thank you for your donation, " + llKey2Name(giver) + "!");
}
altic Plasma
Registered User
Join date: 15 Mar 2006
Posts: 118
05-08-2007 10:00
that one didnt work so i altered it slightly

CODE

default
{
state_entry() {
}

money(key giver, integer amount) {
llSay(0, "Thank you for your donation, " + llKey2Name(giver) + "!");
if(amount >= 1 && amount <= 1) {
llGiveInventory(giver, "Poppy");
}

if(amount >= 2 && amount <= 2) {
llGiveInventory(giver, "Rose");
}

if(amount >= 3 && amount <= 50) {
llGiveInventory(giver, "Dozen Roses");
}

if(amount >= 51 && amount <= 100) {
llGiveInventory(giver, "Something Else");
}

if(amount >= 101 && amount <= 200) {
llGiveInventory(giver, "Something Really Nice");
}

if(amount >= 201) {
llGiveInventory(giver, "Something Really Freakin Sweet");
}
}
}
Kerik Rau
Registered User
Join date: 8 Mar 2007
Posts: 54
05-08-2007 18:59
what the fsck is this?

if(amount >= 2 && amount <= 2) {

in the context you should use if(amount == 2)

/me shudders
Jacques Groshomme
Registered User
Join date: 16 Mar 2005
Posts: 355
05-08-2007 19:06
Sake of consistancy in the statements, geared toward somebody who doesn't know coding and could possibly get confused at the double-equal notation.

It ain't efficient but it works.