Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ VBscript ➜ Suggestions for improvement

Suggestions for improvement

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Greven   Canada  (835 posts)  Bio
Date Sat 13 Aug 2005 05:25 AM (UTC)

Amended on Sat 13 Aug 2005 05:26 AM (UTC) by Greven

Message
I was bored and decided to mess around with some of mushclients scripting for the first time. I decided to make a winamp script to mess around with, and this is eventually what I came up with:
set winamp = createObject("WinampCOM.Application")
call winampstatus

sub winampstatus
'  Set the status bar in MUSHclient to display winamp info12/08/2005

'Checks the global variable each time
if StrComp(world.GetVariable("songname"),winamp.CurrentSongTitle) <> 0 then
    call update_song
End if

'The time returns for current is in milliseconds, so convert and round to seconds
	world.SetVariable "songseconds", Round(winamp.CurrentPos/1000)
'We don't want to actually round the minute, just to get rid of any decimal places, so fix instead of round
    world.Setvariable "songminutes", fix(world.GetVariable("songseconds") / 60)
    world.SetVariable "songseconds", world.GetVariable("songseconds") mod 60
'This is just to produce a "0:07" type look instead of "0:7"
	if world.GetVariable("songseconds") < 10 then
        world.SetVariable "songseconds", "0" + world.GetVariable("songseconds")
    End if
'Just format the current string
    world.SetVariable "songtime", world.GetVariable("songminutes") + ":"
    world.SetVariable "songtime", world.GetVariable("songtime") + world.GetVariable("songseconds")



    world.SetVariable "statstring", world.GetVariable("songname") + " ("
    world.SetVariable "statstring", world.GetVariable("statstring") + world.GetVariable("songtime")
    world.SetVariable "statstring", world.GetVariable("statstring") + "/"
    world.SetVariable "statstring", world.GetVariable("statstring") + world.GetVariable("songtimetotal")
    world.SetVariable "statstring", world.GetVariable("statstring") + ")"


    world.setstatus world.GetVariable("statstring")
end sub

sub update_song
'  Update the song info

    world.SetVariable "songname", winamp.CurrentSongTitle
    DoAfterSpecial 1,"call update_song_name", 12 

end sub 

sub update_song_name
'  Update the song info

    world.SetVariable "songlength",  winamp.CurrentSongLength
    world.SetVariable "songsecondstotal", world.GetVariable("songlength") mod 60
    world.Setvariable "songminutestotal", fix(world.GetVariable("songlength") / 60)

    if world.GetVariable("songsecondstotal") < 10 then
        world.SetVariable "songsecondstotal", "0" + world.GetVariable("songsecondstotal")
    End if
    world.SetVariable "songtimetotal", world.GetVariable("songminutestotal") + ":"
    world.SetVariable "songtimetotal", world.GetVariable("songtimetotal") + world.GetVariable("songsecondstotal")

end sub
It is probably really redundant and in poor scripting style, but I am very unfamiliar with vbscript and mushclient scripting in general. Any comments would be great, thanks.

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


8,029 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.