A Sweet Feeling of Accomplishment

:::: ^__^ :::::

Monday, September 11, 2006 by Cyberium | Discussion: DesktopX

In process of making a "minimalist" theme.. had the idea to put the currently playing track on screen.. but some titles were too long.. So I decided to attempt something I've never done before! A scrolling display! How was it done? Read on...

1. Make a base image i.e.
2. Make a 2nd image i.e.
3. Make a text object and assign it the DXPlayer ability - Clip Name

4. Parent the 2nd image to the base image
5. Parent the text object to the 2nd image
6. Get exact width of 2nd image (in this case it's 238 pixels)
7. Insert the following code into your text object:

'Called when the script is executed
Sub Object_OnScriptEnter
Object.SetTimer 1, 1
Object.Left = 2 'Aligns the text object 2pixels in from parent image
End Sub

Sub Object_OnTimer1
If Object.Left + Object.Width <= 236 Then ' Checks when the end of text is lined up with right edge of parent image - 2
Object.SetTimer 4, 2500 ' Pause timer
Object.KillTimer 1
Else
Object.Left = Object.Left - 1 ' if still not at right edge - carry on moving left
End If
End Sub

Sub Object_OnTimer3
Object.SetTimer 1, 1
Object.KillTimer 3
End Sub

Sub Object_OnTimer4
Object.SetTimer 2, 1
Object.KillTimer 4
End Sub

Sub Object_OnTimer2
If Object.Left => 2 Then ' Checks the text is back at starting position, 2 pixels in from left edge of parent image
Object.SetTimer 3, 2500
Object.KillTimer 2
Else
Object.Left = Object.Left + 1
End If
End Sub

'Called when the script is terminated
Sub Object_OnScriptExit
Object.KillTimer 1
End Sub
ZubaZ
Reply #1 Monday, September 11, 2006 1:43 PM
KiloKrash
Reply #2 Monday, September 11, 2006 1:48 PM
Thought about posting to http://scratchpad.wikia.com/wiki/DesktopX ?


I second that! It would be a great contribution to the wiki.
Cyberium
Reply #3 Monday, September 11, 2006 1:55 PM
Heh.. ;; I will do! Ta
RomanDA
Reply #4 Thursday, September 21, 2006 3:41 PM
Nice
BigDogBigFeet
Reply #5 Thursday, September 21, 2006 10:11 PM
Ditto
Cyberium
Reply #6 Sunday, October 1, 2006 9:42 AM
Oh my God! I've got a "Nice" from RomanDA! *Is honoured*

(not being sarcastic, you are regarded as a Script GOD!)
RomanDA
Reply #7 Monday, October 23, 2006 8:26 AM
Oh my God! I've got a "Nice" from RomanDA! *Is honoured*

(not being sarcastic, you are regarded as a Script GOD!)


.... waiting on some comment from Zu now..
ZubaZ
Reply #8 Monday, October 23, 2006 8:30 AM
I wish I had a eighth of the talent David has in graphic design or scripting. There are better and worse DX coders out there who give to the community, but David makes a real effort to reach out to the noobs.

However, that being said, he'll probably steal your code in a heartbeat if it's better than his and he can find a way to use it.

For the record, and not to dismiss the tutorials that David has written, most of the really good DX builders here comment their code very well and there's a lot you can learn from reading what they've done.
Vad_M
Reply #9 Tuesday, October 24, 2006 8:59 AM
It seems I can help you... Please look below:

'Note: The scrolling text must be longer than scroll area for this example!

Dim onscroll,sd,xb,xe,tp,xpath

Sub Object_OnScriptEnter
desktopx.object("scrolltext").text = "ENTER SOME LONG TEXT HERE...."
onscroll = False
sd = 20 '<== a small delay between the steps of scrolling
tp = 500 '<== delay between the cycles of scrolling
xb = 0 '<== "zero" position
xe = desktopx.object("scrollback").width '<== "end" position
xpath = desktopx.object("scrolltext").width - desktopx.object("scrollback").width
desktopx.object("scrolltext").left = xb
OnScrolling_Ex
End Sub

Sub OnScrolling_Ex()
object.SetTimer 1, tp
End Sub

Sub object_OnTimer1
object.KillTimer 1
onscroll = True
object.SetTimer 2, 1 '<== this timer is need to "wake" a sleeping object
End Sub

Sub object_OnTimer2 '<== SCROLLING CYCLE (the text object will move onward/backward)
object.KillTimer 2
If onscroll = True Then
If desktopx.object("scrolltext").left = xb Then
For i = 0 To xpath
If desktopx.object("scrolltext").right > xe - 1 Then
desktopx.object("scrolltext").left = desktopx.object("scrolltext").left - 1
object.sleep sd
End If
Next
desktopx.object("scrolltext").right = xe
onscroll = False
OnScrolling_Ex
Else
If desktopx.object("scrolltext").right = xe Then
For j = 0 To xpath
If desktopx.object("scrolltext").left < xb - 1 Then
desktopx.object("scrolltext").right = desktopx.object("scrolltext").right + 1
object.sleep sd
End If
Next
desktopx.object("scrolltext").left = xb
onscroll = False
OnScrolling_Ex
End If
End If
End If
End Sub

Before use this code you need only two things:
1. Create two objects: the "srollarea" and "scrolltext" which must be joined to the "scrollarea" (Parent/Qwner)
2. Add this code to the "srollarea" object and run.

Good Luck with DesktopX 
WickedDesktop
Reply #10 Tuesday, November 7, 2006 7:39 PM
i did the fist code here....and i cant make it scroll
i am going crazy....
Cyberium
Reply #11 Friday, November 24, 2006 6:02 AM
Well the specific numbers given for the left values (i.e. Object.Left = 2 & If Object.Left + Object.Width <= 236) are relevant to the width of the parent image - the image is 238 pixels in width - 2 for a border. You might need to adjust these values depending on the parent image you use.
ViperWorm
Reply #12 Thursday, May 10, 2007 10:36 PM
Well Cyberium's script could be repaired so instead of manually inserting numbers it would check what parent object width is ( pow = DesktopX.object("parent").width). Put that in Object_OnScriptEnter sub OR write "DesktopX.object("parent").width" instead of a number and it should make no problems
Otherwise it's a cool script

my modest opinion.
PuterDudeJim
Reply #13 Saturday, June 14, 2008 12:10 AM
Learning some good stuff here!!!   
zakai1369
Reply #14 Saturday, June 14, 2008 10:31 AM
One of those threads I'm sure I'll want to find someday when I have time.

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