Category Archives: Plugins

Full screen scripting in LiveCode for Lion/Mountain Lion

When using LC on my ML MBPro I long for an immersive full screen scripting environment just like I use in Xcode. I thought that Jerry Daniels new Glass project might help but just like GLX it’s just too different for me to justify spending the time getting familiar with. The LC Script editor works and I have some integrated plugins etc that I can’t really do without. Anyway… to  cut a long story short I made just about the simplest plugin ever and it gives me 99% of what I want. HEre’s the script:
on preOpenStack
   set the style of stack "revMenubar" to "modeless"  -- stops the toolbar overlapping the SE
   set the windowBoundingRect to the working screenrect -- let's you maximise the SE
end preOpenStack
Put this in a stack script in the plugins folder and run it wen LC starts up.
Once run then
– edit a script
– 4 finger down swipe to bring up mission control
– drag the SE window to another space… over to the right on top of the + sign if you need a new one
– go to the space and maximise the SE
From then on you SE window will be in the other space and you can 4 finger swipe left/ right to get to it and anything that causes a script edit in the stack screen will switch you to the SE screen.
[Download not found]

LiveCode Growl Plugin

I spent an hour this afternoon having a play with the AppleScript commands for Growl and came up with a this little plugin toy for LiveCode. It notifies you when LiveCode is saving a standalone and when the standalone is saved. If anyone can think of anything else they might like notifications of I’m happy to add some more but this is really just a demo of the growl library which is a substack of the plugin.[Download not found]

revObjective 1.1 released!

A new behavior script and custom control manager plugin for Revolution.

Features include:

  • Adds an object placing menu button to the tools palette for both revObjective and standard Revolution object libraries.
  • Add, Delete, Clone, Place, Edit Script, Edit Controls, Name, Describe, Author, Version your custom controls.
  • Drag and drop objects onto your stacks from the object list.
  • Drag and drop revObjective files to and from the object list to share.
  • Searches stacks during standalone building and finds revObjective behaviors and copies over the behavior scripts in a way that is not file path dependant.
  • Packaged with revObjective are MacOS X Search Field, Integer Field, Decimal Number Field and Placeholder Text Field

[Download not found]

This plugin is donationware. If you decide it fits into your workflow then please consider donating to encourage further development. [mp:id=6]

Create a disabled version of an image

After a correction on my greyscale formula in my last post from Mark on facebook I reviewed the results of my code and decided the disabled look wasn’t quite right. What I wanted was a a washed out looking version. This code and plugin modifies the alphaData of the image to 33% of the original and greys the imageData 15% more. You can modify the constants in the button code if you want different ratios. Here’s the code:

<code>constant kTranslucencyRatio = 0.33
constant kGreyRatio = 0.15

on fadeImage pImageID
   local tAlphaData,tOffset,tWidth,tHeight,tAlpha
   lock screen
   put the width of pImageID into tWidth
   put the height of pImageID onto tHeight
   put the alphaData of pImageID into tAlphaData
   repeat with tOffset = 0 to tWidth *tHeight
      put charToNum(char tOffset of tAlphaData) into tAlpha
      -- handle cases of very low alpha for edge smoothing
      if round(tAlpha*kTranslucencyRatio) > 0 then
         put NumToChar(round(tAlpha*kTranslucencyRatio)) into char tOffset of tAlphaData
      end if
   end repeat
   set the alphaData of pImageID to tAlphaData
end fadeImage

on greyImage pImageID
   local tImageData, tRed, tGreen, tBlue, tGrey, tOffset,tWidth,tHeight
   lock screen
   put the width of pImageID into tWidth
   put the height of pImageID onto tHeight
   put the imageData of pImageID into tImageData
   repeat with tOffset = 0 to tWidth *tHeight * 4 step 4
      put charToNum(char tOffset + 2 of tImageData) into tRed
      put charToNum(char tOffset + 3 of tImageData) into tGreen
      put charToNum(char tOffset + 4 of tImageData) into tBlue
      put (30*tRed+59*tGreen+11*tBlue)/100 into tGrey
      put round(tGrey*kGreyRatio+tRed*(1-kGreyRatio)) into tRed
      put round(tGrey*kGreyRatio+tGreen*(1-kGreyRatio)) into tGreen
      put round(tGrey*kGreyRatio+tBlue*(1-kGreyRatio)) into tBlue
      put NumToChar(tRed) into char tOffset + 2 of tImageData
      put NumToChar(tGreen) into char tOffset + 3 of tImageData
      put NumToChar(tBlue) into char tOffset + 4 of tImageData
   end repeat
   set the imageData of pImageID to tImageData
end greyImage</code>

[dm]10[/dm]

Greyscale an image

Now that I’ve got all my icons into the image library (see my recursive image library creation post) I wanted to limit the number of times I need to go back to an image editor to mess with the original files to create variations. One of the most common variations for button icons is the greyed out disabled icon so I wrote a little rev plugin to greyscale the selected images.

The plugin uses the following command:

<code>on greyscale pImageID
   local tImageData, tRed, tGreen, tBlue, tGrey, tOffset,tWidth,tHeight
   lock screen
   put the width of pImageID into tWidth
   put the height of pImageID onto tHeight
   put the imageData of pImageID into tImageData
   repeat with tOffset = 0 to tWidth *tHeight * 4 step 4
      put charToNum(char tOffset + 2 of tImageData) into tRed
      put charToNum(char tOffset + 3 of tImageData) into tGreen
      put charToNum(char tOffset + 4 of tImageData) into tBlue
      --correction for better greyscale from Mark 
      --put (tRed+tGreen+tBlue) div 3 into tGrey
      put (tRed*30+tGreen*59+tBlue*11) / 100 into tGrey
      put NumToChar(tGrey) into char tOffset + 2 of tImageData
      put NumToChar(tGrey) into char tOffset + 3 of tImageData
      put NumToChar(tGrey) into char tOffset + 4 of tImageData
   end repeat
   set the imageData of pImageID to tImageData
end greyscale</code>

[dm]9[/dm]