Auto changing color
Sunday, June 22, 2008 by superman | Discussion: DesktopX Tutorials
'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
What i want to auto change the color slowly... without clicking it.....
Thanks in advance
Reply #2 Sunday, June 22, 2008 12:16 PM
I never learnt vbscript.
So please revise it and post it. Thank you
Reply #3 Sunday, June 22, 2008 1:09 PM
http://w3schools.com/vbscript/vbscript_intro.asp
http://w3schools.com/vbscript/vbscript_ref_functions.asp
have you considered just using an animation that changes colors?
So please revise it and post it. Thank you
please, I can't even spell bvscritp
Reply #4 Sunday, June 22, 2008 1:20 PM
I don't know about that first guy you mentioned.


Reply #5 Sunday, June 22, 2008 1:28 PM
- Dim Speed,Duration
- Speed=100 ' This is the time in milliseconds between changing colors
- Duration=2000 ' This is the time in milliseconds before ending the automatic color changing
- 'Called when L-click is released
- Function Object_OnLButtonUp(x, y, dragged)
- If Not dragged Then
- Object.SetTimer 1, Speed
- Object.SetTimer 2, Duration
- End If
- End Function
- Sub Object_OnTimer1
- '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 Sub
- Sub Object_OnTimer2
- Object.KillTimer 1
- Object.KillTimer 2
- ' Uncomment Next line if you want to reset color when done
- 'Object.hue=0
- End Sub
Reply #6 Sunday, June 22, 2008 1:31 PM
I don't even read my textbooks!
Ok, i won't ask bvscript to u.
I wonder!
Any great coder there!
Just revise that code dear!
And bring me my beer!
Reply #7 Sunday, June 22, 2008 2:41 PM
Just revise that code dear!
And bring me my beer!
real world test:
put demands in one hand
crap in the other
slap your hands together and see which you get
Reply #9 Sunday, June 22, 2008 7:56 PM
I praise you highly
For you are the real coder
My heart would ever aspire
Thanks for your boon
I'll check the code soon
And tell you if it works
And if my widget spurts
Reply #10 Sunday, June 22, 2008 9:29 PM
.......................................................
Uncomment Next line if you want to reset color when done'Object.hue=0End Sub
It did work but i want to change the color automatically once it starts....
That is, i clicked the widget, it starts and keeps changing the color and changing and changing and....
What it did was, i ran it, then it need to be clicked to change the color once clicked it changed for few seconds.... i don't want this...
I want to change the color automatically since the widget starts till it runs....
Sorry but i don't know vbscript...
Thank you very much for the previous script and thank u very much for the next one......

Reply #11 Sunday, June 22, 2008 9:33 PM
Violets are blue
Some poems are needed
but these aren't.

Reply #12 Sunday, June 22, 2008 9:54 PM
crap in the other
slap your hands together and see which you get




Reply #13 Sunday, June 22, 2008 9:55 PM
I changed 'Called when L-click is released with 'Called when the script is executed...
but no change in behaviour After running it needed to be clicked..
I changed timer to a very large digit but it gave an error. and option to disable script. once i disabled and edited...but no gain.
Again i continued the script, although it worked but then there was an error and my widget will become buggy.....
So please give me a script for automatic color changing from the time the objects runs/starts till it is stopped...
It will be really a great help for me. As for till now i use animations to change color etc.
If i get this, my widgets will become resource friendly.




Reply #14 Sunday, June 22, 2008 10:09 PM
Timer's are meant to run for a specific period of time to complete a routine/function and then end.
Here ya go with a Left click function to enable/disable it.
- Dim Speed, blnActive
- Speed=1000 ' This is the time in milliseconds between changing colors
- blnActive=True ' Indicates to start color change on Script Enter
- 'Called when L-click is released
- Function Object_OnLButtonUp(x, y, dragged)
- If Not dragged Then
- If blnActive Then
- blnActive=False
- Object.KillTimer 1
- ElseIf Not blnActive Then
- blnActive=True
- Object.SetTimer 1, Speed
- End If
- End If
- End Function
- 'Called when the script is executed
- Sub Object_OnScriptEnter
- If blnActive Then Object.SetTimer 1, Speed
- End Sub
- Sub Object_OnTimer1
- '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 Sub
- 'Called when the script is terminated
- Sub Object_OnScriptExit
- Object.KillTimer 1
- End Sub
Reply #15 Sunday, June 22, 2008 10:45 PM
Thank you SirSmiley
I praise you highly
For you are the real coder
My heart would ever aspire
Thanks for your boon
I'll check the code soon
And tell you if it works
And if my widget spurts



Reply #17 Monday, June 23, 2008 4:25 AM
Thank you very much
Reply #18 Monday, June 23, 2008 10:40 AM
Reply #20 Monday, June 23, 2008 12:24 PM
put demands in one hand
crap in the other
slap your hands together and see which you get
Now there's a quote I'll be remembering and using whenever someone's being naggy and rude.
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!
Reply #1 Sunday, June 22, 2008 11:55 AM