OK, thanks to the help of Rob and others, I have a
"setGlobal" function that works

Here it is:
on setGlobal tname, tvalue
  set the tname of button "Button" of stack
"EZGlobals" to tvalue
end setGlobal

- When I hit a button on the calling stack, it creates
custom properties just fine in the button on my
library stack.

But when I ty to poll the values of these custom
properties (which I can see in the inspector), they
are empty but I get no error.

Here's the retrieving function in the library stack

function getGlobal tname
  return the customProperties[tname] of button
"Button" of stack "EZGlobals"
end getGlobal


So for example, I set a global called "myVar" to 144.
I can see it in the custom properties of the button on
my library stack. When I do "answer
getGlobal("myVar")" either from the calling stack or
the message box, it works without an error but I get
an empty value.

Any ideas?

Best

Gordon

--- Rob Cozens <[EMAIL PROTECTED]> wrote:

> Gordon,
> 
> >
> >Could you elaborate on the "gotcha" thing. I
> changed
> >my function from
> >
> >    "function setGlobal <params>"
> >
> >to
> >
> >    "on setGlobal <params>"
> >
> >and now I don't get the error message, but instead
> of
> >setting the cutom property "myVar" of the button to
> >23.6, it creates a cutom property called
> "myVar,23.6"!
> >
> >What's the difference between a command and a
> >function- I even tried setting "setGlobal" back to
> a
> >function and returning something, but then I got
> the
> >old "handler not found" error again. I am confused
> >about commands and functions - why are my functions
> >not seen and which should I use and when?
> 
> A command starts with "on"; a function starts with
> "function"
> When calling a function, the arguments to be passed
> are enclosed in 
> parens (); when calling a command they are
> not--though individual 
> arguments may contain ()..
> A function must return a value; a command may return
> a value.
> 
> The Rev script parser looks for the "(" in a handler
> call to 
> determine whether it is a function or command.  If
> it sees "setGlobal 
> params" it generates a "command message"; if it sees
> 
> "setGlobal(params)" it generates a "function
> message".
> 
> So if one had a command "setGlobals" and scripted
> "setGlobals (the 
> short name of the target)", one would get a "handler
> not found" 
> [expecting a function]; whereas scripting.
> 
>       "get the short name of the target
>       setGlobals it"
> 
> will work.
> 
> 
> >Here are the "setGlobal" and getGlobal functions
> >
> >on setGlobal tname, tvalue
> >   set the tname of button "Button" of stack
> >"EZGlobals" to tvalue
> >end setGlobal
> >
> >function getGlobal tname
> >   return the tname of button "Button" of stack
> >"EZGlobals"
> >end getGlobal
> 
> I don't see any obvious error.  How are tname &
> tvalue set before the 
> setGlobal command is called.
> -- 
> 
> Rob
> _______________________________________________
> use-revolution mailing list
> [EMAIL PROTECTED]
>
http://lists.runrev.com/mailman/listinfo/use-revolution
> 


=====
:::::::::: Gordon Webster ::::::::::
_______________________________________________
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to