|
Rutherford Beresford
Registered User
Join date: 2 Sep 2007
Posts: 45
|
01-20-2009 11:37
I have an object I purchased that basically involves to avatars sitting on pose balls and the firing off a synchronized set of animations. As purchased, the object is mod but the pose scripts are no mod.
I will like to incorporate some functionality into the object to where, before anyone can "use" the object, a pop-up dialog box presents itself and asks for a nominal "donation" before proceeding.
I'm thinking I could write a script to do this but I'm not sure how the two scripts could or should interact. Which script executes first. Is there a way to ask for the money before the animations are envoked? I imagine the new script could test for someone on the sit target the way the first script does, but I have no clue how to code the new script so that it plays nicely with the first to accomplish what I want.
Any words of wisdom or explanations of scripting concepts related to how to do this would be greatly appreciated!
Sincerely, Rutherford Beresford
|
|
Sindy Tsure
Will script for shoes
Join date: 18 Sep 2006
Posts: 4,103
|
01-20-2009 11:56
Totally untested but this might be close.. integer PRICE = 50; // L$ needed to sit float SIT_TIME = 60.0; // time from being payed to unsitting
key gUser;
default { state_entry() { llSetPayPrice (PRICE, [PAY_HIDE, PAY_HIDE, PAY_HIDE, PAY_HIDE]); }
changed (integer mask) { if (mask & CHANGED_LINK) { key id = llAvatarOnSitTarget(); if (id != NULL_KEY) { if (id != gUser) { // somebody sat but not the person who paid us! llInstantMessage(id, "Oi! Cough up the cash, you cheapskate!"); llUnSit (id); } } else { // nobody sitting any more gUser = NULL_KEY; llSetTimerEvent(0.0); } } }
money(key from, integer amount) { llInstantMessage(from, "Have a seat!"); gUser = from; llSetTimerEvent(SIT_TIME); }
timer() { llSetTimerEvent(0.0);
key id = llAvatarOnSitTarget(); if (id != NULL_KEY) { llInstantMessage(id, "Times up! Insert another quarter!"); llUnSit (id); } } }
|
|
Rutherford Beresford
Registered User
Join date: 2 Sep 2007
Posts: 45
|
01-21-2009 14:32
Thank you for an actual scripting example! I was wondering, is there any rule of thumb in terms of the order in which multiple scripts within a single object get executed or are they all thrown into the mix at once and execute semi-concurrently as resources make themselves available?
|
|
Sindy Tsure
Will script for shoes
Join date: 18 Sep 2006
Posts: 4,103
|
01-21-2009 16:45
From: Rutherford Beresford ..are they all thrown into the mix at once and execute semi-concurrently as resources make themselves available? Pretty much, though I'd bet LL wouldn't describe it that way.
|