Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Cross Script Functions and Variables!

Chance Small
Linden PITA
Join date: 30 Jul 2003
Posts: 170
01-12-2004 03:04
Perfect example... My roullette table... It has to be able to hold a pretty big # of bets, for a pretty big # of players, and keep track of them all. I need to have 1 script keep track of all bets and payments, the other to handle how the bets are played and determine winners. To have both in 1 script causes a "Stack Heap" memory error.

In order to communicate between the 2 scripts on the 163 prim table (Trust me every singe prim is needed!) I have to have the script llMessageLinked it'self (object) and have the other script pick it up, and reply, yatta yatta yatta.

It would be EXTREMELY nice if I could have something like.

llScriptFunction["ScriptNameHere"].MyFunction(passed vars)

llScriptVariable["ScriptNameHere"].MyVariableName (To be able to be set, or to have the value returned)

Of course, then there may be huge scripts everywhere, but the script limit is just too small for my plans. Plus, if I have 1 work script, the other be a value/variable script, even as 2 seperate scripts, with the script limit, it'd still safe guard huge memory leaks, and endless loops.

Anyone get what I'm saying?
Oz Spade
ReadsNoPostLongerThanHand
Join date: 23 Sep 2003
Posts: 2,708
01-12-2004 17:05
I would like to have this too, could come in handy quite a bit.
_____________________
"Don't anticipate outcome," the man said. "Await the unfolding of events. Remain in the moment." - Konrad
Huns Valen
Don't PM me here.
Join date: 3 May 2003
Posts: 2,749
01-12-2004 17:31
It would be nice to have the possibility of public/private functions. All functions should be private by default, so as to close possible exploits against other peoples' scripts on modifiable objects. Public functions would be available for calls from other scripts. You could also have global variables.

// Visible to all scripts in link set
global integer gVar;

// Callable by all scripts in link set
public integer isActive() {
    // This lets the function see the global var
    global integer gVar;
    return val;
}

How to handle multiple scripts containing public functions with the same name? Hmm...
Garoad Kuroda
Prophet of Muppetry
Join date: 5 Sep 2003
Posts: 2,989
01-12-2004 23:28
This sounds similar to using #includes to include code from other scripts. As far as memory limitations, I don't know what the best solution is but I think a totally different method of divvying available memory is needed.
_____________________
BTW

WTF is C3PO supposed to be USEFUL for anyway, besides whining? Stupid piece of scrap metal would be more useful recycled as a toaster. But even that would suck, because who would want to listen to a whining wussy toaster? Is he gold plated? If that's the case he should just be melted down into gold ingots. Help the economy some, and stop being so damn useless you stupid bucket of bolts! R2 is 1,000 times more useful than your tin man ass, and he's shaped like a salt and pepper shaker FFS!
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
01-13-2004 01:34
From: someone
Originally posted by Huns Valen
How to handle multiple scripts containing public functions with the same name? Hmm...


Like Java does! :D

If you extend a class, you get all of its variables and methods. You can override these methods by declaring methods with the same name, the virtural machiene then uses the method you declared rather then the method that came from the class you extended.

So, if more then 1 script declares a same-name global var, some system needs to be worked out for which one all scripts in the linked set can access.

Perhaps explicit importing of scripts would be better then implicitly accessing every script in the linked set, that solves all your problems.

==Chris