Giver Script
Here's a handy script that implements a giver for any of my AI bots - good for a host at a club!
// this script implements a new controller function giveinv inventory-object-name
// an SRD that will give inventory looks like
// giverstim|ctrl giveinv name
// when the stimulus giverstim is received, inventory "name" will be given to the speaker
// if coupled to the sensor, the sensed av will be the recipient
// for example code for the ai nc for a giver at a club might look like
// sensornew|Hello there! Welcome to Club X and here is a notecard and a landmark! goto %give1
default
{
state_entry()
{
}
link_message(integer l, integer n, string t, key id)
{ if(n != -2000) return;
if(llSubStringIndex(t,"giveinv ") == 0)
{ llGiveInventory(id, llStringTrim(llGetSubString(t,7,-1),STRING_TRIM));
}
}
}
// an SRD that will give inventory looks like
// giverstim|ctrl giveinv name
// when the stimulus giverstim is received, inventory "name" will be given to the speaker
// if coupled to the sensor, the sensed av will be the recipient
// for example code for the ai nc for a giver at a club might look like
// sensornew|Hello there! Welcome to Club X and here is a notecard and a landmark! goto %give1
// give1|ctrl giveinv club-x-notecard goto %give2
// give2|ctrl giveinv club-x-landmark
// the inventory to be given should be in the ai prim along with this scriptdefault
{
state_entry()
{
}
link_message(integer l, integer n, string t, key id)
{ if(n != -2000) return;
if(llSubStringIndex(t,"giveinv ") == 0)
{ llGiveInventory(id, llStringTrim(llGetSubString(t,7,-1),STRING_TRIM));
}
}
}

Comments
Post a Comment