Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Money event during script delay...?

Adman Drake
Registered User
Join date: 9 Feb 2006
Posts: 96
02-21-2006 11:15
I'm scripting a casino game, and the last step of the game is to IM the player whether they won or lost the game.

Then the script goes back to the default state.

What I've discovered is that if someone tries to pay the machine to play again after that final IM, the game accepts the payment, but doesn't run.

What I'm guessing is that the automatic script delay built into IM'ing the user is swallowing the Pay/money event. Can anyone confirm this?

What I've done to get around this is create another script in an unused linked prim in my object. That script listens for a linkmessage with a number of 1000 (or whatever), as well as a key and a message. When it goes notifed, THAT script does the IM'ing (and incurs the time penalty). The parent script, instead of IM'ing the users directly, instead calls linkmessage to tell the child prim to make contact.

A little complicated, but seems to work.

Commets?

Adman
Jimmy Loveless
Hello, avatar!
Join date: 1 Oct 2004
Posts: 35
02-21-2006 12:01
Adman, offloading calls to delayed functions to a separate script with linkmessages is pretty standard practice when your main script needs to be responsive at all times (i.e. event processing).

Note the dire warning about using multi-threading in this wiki article http://secondlife.com/badgeo/wakka.php?wakka=multithreading - i think its true to a certain extent, depending on your methods and what you are doing, but having a separate script to send IMs isn't all that resource intensive.

Also note that when your main script sends multiple IMs in rapid succession via this method, the messages will queue nicely (tho I belive there is a limit to how many will queue up), and they will be sent 2 seconds apart.

Cheers,
JL
_____________________
============================
NEW Klub Kaili - World class casino gaming
Unique games you won't find anywhere else
Adman Drake
Registered User
Join date: 9 Feb 2006
Posts: 96
02-21-2006 12:57
Thanks for the info!