Need help with DesktopX scripting.
Wednesday, August 6, 2008 by nimbletongue | Discussion: DesktopX
I just started to mess around with widgets/objects. I'm made this wallpaper with hearts that look like gems surrounded by what looks like gold metal. Looks nice and what not but it needed more, so I decided to make widgets/objects to sit over the hearts (made from a screen shot of the desktop so it blends in perfectly) so when you mouse over them the gemmed heart would slide to the side like an elevator door to reveal pictures of loved ones behind it. Ok got that, works nice, I run my mouse over and the door opens and the picture shows, then returns to the static image as soon as its done unless my mouse stays on it. What I want it to do now is if you mouse over (or click it, if thats needed) it, is to have it run the anamaition of the "door" opening then stay on the picture of the person. Then the next time you mouse over (or click) it runs the anaimation in reverse closing the "door" and leaving it as the gemmed heart. Is there a script for doing this?
Reply #2 Wednesday, August 6, 2008 11:32 PM
Are you just using two images, the heart and the picture? Or is your door an animated png?
Reply #3 Thursday, August 7, 2008 2:06 AM
Well, kinda both. The mouse away is a picture of the door closed. Then the mouse over picture is a animated png consisting of the door closed all the way to the picture. I'm sure there are better ways to do what I want it to do, I plan on tweeking as I go along.
Reply #4 Thursday, August 7, 2008 11:53 PM
1. open
2. closed
3. aniopen
4. aniclosed
Set "aniopen" state to your animated png and set to forward(assuming forward means open)
Set "aniclosed" state to your animated png and set to backward(assuming backward means close)
Set "open" state to the image when open.
Set "closed" state to the image when closed.
*Note: This could be done with two or three states but, trying to keep this simple.
Here's the script:
The speed of the timers on line 15 and 19 is the speed of your animation. For example this script use a 19 frame png with 25ms per frame for a total of 475ms.
- Dim blnOpen
- 'Called on selected object state changes
- Function Object_OnStateChange(state)
- If state= "Mouse up" Then
- Call Animation(state)
- ElseIf state="open" Then
- Object.KillTimer 1
- ElseIf state="closed" Then
- Object.KillTimer 2
- End If
- End Function
- Function Animation(state)
- If blnOpen Then
- Object.State="aniclosed"
- Object.SetTimer 2,480
- blnOpen=False
- ElseIf Not blnOpen Then
- Object.State="aniopen"
- Object.SetTimer 1,480
- blnOpen=True
- End If
- End Function
- 'Called when the script is executed
- Sub Object_OnScriptEnter
- Object.State="open"
- blnOpen=True
- End Sub
- Sub Object_OnTimer1
- Object.State="open"
- End Sub
- Sub Object_OnTimer2
- Object.State="closed"
- End Sub
Reply #5 Friday, August 8, 2008 4:37 AM
My open state png

My closed state png

My closed state png

Ok, with the above script, 1st time I click it does this.

This is what happens on 2nd click.

Hope this helps me explain better, and thanks again with all the help so far.
This is what I want it to do.

Reply #6 Friday, August 8, 2008 4:44 AM
Reply #7 Friday, August 8, 2008 3:21 PM
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 Wednesday, August 6, 2008 9:59 PM