Passing Constants or Variables as Command Params

pink nabble at mad.pink
Fri Oct 14 10:51:58 EDT 2016


is this your actual script? if it is, here are a few comments that
immediately pop into my mind:

1. Constants should be declared before your handler, in this case, they
should be above "on mouseUp"
2. Your "assignColor" command will not work because you are declaring those
variables as locals, they will only be available within that handler. What
you want is to declare "script locals" which need to be declared outside of
any handlers, at the top.


Try a script structured like this:

constant kPureWhite= "255,255,255" 
constant kPureBlack= "0,0,0" 
constant kDefaultStart= "0.00000" # left stop 
constant kDefaultEnd= "1.00000" # right stop 
constant kDefaultOpacity= "255" # 100% opaque 
constant kSoftGreen = "88,246,27" 
constant kSoftRed = "255,6,23" 

local sSoftGreen, sSoftRed 

on mouseUp 
    assignColors 
    setRamp "","","",sSoftRed,"",""   
end mouseup 

command assignColors
    put "88,246,27" into sSoftGreen 
    put "255,6,23" into sSoftRed 
end assignColors 





--
View this message in context: http://runtime-revolution.278305.n4.nabble.com/Passing-Constants-or-Variables-as-Command-Params-tp4709379p4709390.html
Sent from the Revolution - User mailing list archive at Nabble.com.




More information about the use-livecode mailing list