scripting color

hue shift

Saturday, June 14, 2008 by PuterDudeJim | Discussion: DesktopX Tutorials

Hello all. I am trying to create an object that will control the hue of 5 other objects. I have a script that will allow me to change each objects color individually. But I need to change them all at once. Can anyone help me? I will post the script I am using below.      Thanx.
'Called when L-click is released
Function Object_OnLButtonUp(x, y, dragged)
 If Not dragged Then
  'Store the current hue in variable
  hueshift = Object.hue
  'If current hue is equal to or greater than 255
  'reset to 0
  If hueshift => 255 Then
   hueshift = 0
  'If hue is not yet 255, keep adding
  Else
   hueshift = hueshift + 7
  End If
  'Set the object hue
  object.hue = hueshift
 End If
End Function
First Previous Page 2 of 2 Next Last
Vad_M
Reply #21 Tuesday, June 17, 2008 5:27 AM
Hey friends! I think that this way is erroneous... So try this Jim:

1. Create new object and name it like "sound".

2. Create a few states in this object:

disable <-- The first state. Do nothing here!

Add your *.wav files to the other states: tab "States" --> tab "Sound" --> button "Browse" --> button "Apply"
Restore <-- Windows Restore.wav
LowBattery <-- Windows Battery Low.wav
CriticalStop <-- Windows Critical Stop.wav
Logon <-- Windows Logon Sound.wav
Minimize <-- Windows Minimize.wav
Now you have a special object with all of the necessary sounds.

3. Coppy this code to your button:

Function Object_OnLButtonUp(x, y, dragged)
If Not dragged Then
Dim sfx : sfx = desktopx.object("sound").state
Select Case sfx
Case "disable" '<== Silent (no sound)
sfx = "Restore"
Case "Restore" '<== Windows Restore.wav
sfx = "LowBattery"
Case "LowBattery" '<== Windows Battery Low.wav
sfx = "CriticalStop"
Case "CriticalStop" '<== Windows Critical Stop.wav
sfx = "Logon"
Case "Logon" '<== Windows Logon Sound.wav
sfx = "Minimize"
Case "Minimize" '<== Windows Minimize.wav
sfx = "disable"
End Select
desktopx.object("sound").state = sfx : Set sfx = nothing
End If
End Function

Press your button again and again to hear each of your sounds one after another.

4. Now you just need to write a simple code which will control your sounds...

Have a nice day with DesktopX.   


PuterDudeJim
Reply #22 Tuesday, June 17, 2008 10:15 AM
Reply #21 is awesome, but it did not work, I clicked the button and got no sounds. Even though I added the sounds to the states and applied the script. I have decided not to worry about turning off sounds, that is why there is a volume button on the PC. Thanx for all the work.
Vad_M
Reply #23 Tuesday, June 17, 2008 12:06 PM
This code should work because I tested it before sending here. More than I have used the similar method in the all of my projects. So I think that you do something wrong...
PuterDudeJim
Reply #24 Tuesday, June 17, 2008 8:55 PM
So I think that you do something wrong...


Probably. It's a bit too complicated for me. Thanx tho.

Please login to comment and/or vote for this skin.

Welcome Guest! Please take the time to register with us.
There are many great features available to you once you register, including:

  • Richer content, access to many features that are disabled for guests like commenting on the forums and downloading skins.
  • Access to a great community, with a massive database of many, many areas of interest.
  • Access to contests & subscription offers like exclusive emails.
  • It's simple, and FREE!



web-wc01