Wednesday, December 15, 2010

Setup a "Sit on prim" Action

Actorbots can be programmed to perform specific actions when a given trigger condition is met. For instance, if an Actorbot is paid 250L that could trigger an action. Actions can be any one of instant message, chat, send group invitation, give object, wear outfit, play animation, stop animation, or sit on prim. This post describes how to setup that last action, sit on prim, and details the following steps:
  • Receive 250L or more -> Sit on prim
  • Configure prim
  • Receive 250L or more -> IM avatar with thanks
  • Receive 250L or more -> Wear a specified outfit folder
  • Receive 250L or more -> Chat to Actorbot to setup timer
  • Receive IM contains _Wear Default Outfit -> Wear an outfit
Go to the Sine Wave website, login, click on "My Actorbots", click on the Actorbot you want to program, then click on "Advanced settings". Here is where you will program your Actorbot.

First, decide what your Actorbot's trigger for the action will be. Triggers can be either an instant message or payment. Let's choose payment for this example and we'll set the condition to "Receive money" with "Amount greater equals 250". This specifies a trigger condition of payment to the Actorbot's avatar of 250L or more.

Next, specify the action and execution level for this trigger. Select "Sit on prim" from the pull down menu of actions and "Concurrent" from the pull down menu of execution levels. We want a concurrent action in this example because we are going to want this condition (payment of 250L) to trigger more than one action, all of which should be performed.

Now that we have a trigger with condition and associated action and execution level we can configure the prim on which we want the Actorbot to sit. Click the "Save" button just below the "Sit on prim" field and copy the resulting red string (usually your Actorbot's avatar name followed by a number). You may have to scroll down to see the red string  which will be part of the action description in your list of triggers.

Log in to Second Life and edit the prim you are going to pay the Actorbot to sit on. Right click the object the prim is in, select "Edit", select "Edit linked parts", and click on the prim you wish to edit. Now paste the red string you copied into the Description field of the General tab. Now we need to populate the prim with a couple of scripts and a notecard.

Click the "Content" tab of the edit window and drag the following from your inventory to the edit window Content tab:
  • Actorbot Location script
  • TimedSitAndNotify
  • Configure_Key
You can obtain the Actorbot Location script from Sine Wave Island. The TimedSitAndNotify script and Configure_Key notecard are included with the Pandorabot Actorbot Add-On. After dragging these three items into the prim contents you need to edit the Configure_Key notecard to add your Actorbot's avatar key. Right click Configure_Key in the Content tab, select Open. Insert a line at the top of the notecard that specifies your bot's key. You can find the key by viewing the avatar's profile - it's at the top of the 2nd Life tab. The line should look something like:
    BOTKEY = your-actorbot's-key-goes-here

While you're here you can set a number of other parameters like what strings get used in instant messages, duration of the Actorbot's time on this prim, and the channel number used to communicate with the script. For the purposes of this example we will just need to set the BOTKEY parameter. BOTKEY always needs to be set. Click "Save" and close the notecard editing window.

While still in the prim editing window click Tools -> Recompile Scripts in Selection -> Mono from the viewer toolbar. Finally, click Tools -> Reset Scripts in Selection from the viewer toolbar and close the edit window. Your prim is now setup for the Actorbot to sit on it when paid 250L or more.

However, we're not done yet! Go back to the Sine Wave website where we are programming the Actorbot. We need to add more actions. First, add another "Receive money", "Amount greater equals 250" condition and this time select "Instant message" and "Concurrent" for the action. Enter a message in the Content field to be sent to the avatar that paid you. Something like "Thanks {avatar name}! Give me a minute to get undressed :)". Click "Save".

Next, add another action for "Receive money", "Amount greater equals 250". Again, use "Concurrent" and this time select "Wear outfit". In the "Outfit name" field, enter the name of a subfolder in the Actorbot avatar's Clothing folder that you want it to wear when paid 250L or more. For this example, enter "Nude". Click "Save".

Add another "Receive money", "Amount greater equals 250" condition and this time select "Chat". In the Content field enter "{avatar key} paid me to get naked". In the Channel field enter the Actorabot script's channel (default 25 or whatever you set it to be in the Actorbot base prim Actorabot_Config). Select the Concurrent execution level and click "Save".

Add one final action for "Receive instant message", "Message contains _Wear Default Outfit". Select "Wear outfit" and enter the name of a subfolder of the Clothing folder you want your Actorbot to wear when done with the paid action. Let's use the Outfit name "Blue Dress". Select the "Exclusive" execution level and click "Save".

Log into Second Life as the Actorbot's avatar and create a subfolder of the Clothing folder called "Nude" (for this example). Populate the Nude subfolder with all the items you want your Actorbot to wear for this action. Include hair, shoes, attachments, etc. Create another subfolder of the Clothing folder called "Blue Dress" and populate it with all the items you want your Actorbot to wear when the paid 250L or more action completes.

Log out of Second Life and start the Actorbot. Log in to Second Life as another resident (not the Actorbot's avatar) and pay the Actorbot's avatar 250L. It should now sit on the prim, perform whatever animations are in that prim, and wear the outfit folder "Nude". After the duration set in the Configure_Key notecard (15 minutes default) the Actorbot will leave the prim, return to its base prim and wear the outfit folder "Blue Dress".

No comments:

Post a Comment