Shoutbox

Help to a newbie? - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Forum: Plug-Ins (/forumdisplay.php?fid=28)
+------ Thread: Help to a newbie? (/showthread.php?tid=38266)

Help to a newbie? by Fröt on 02-11-2005 at 07:51 PM

Hi!

I am a experienced Visual Basic 6 programmer.Yesterday,my friends asked me to do a Messenger Plus Plug-In that automaticly changes display name of user...

They asked for calculation of dates between two dates and change display name to this :

OrginalNick - (78 days left)

(so a countdown)

I  did the necessary function but i am very very confused about plug-in part ^o)

Please somebody tell me what must i do for make plug in.


RE: Help to a newbie? by Plik on 02-11-2005 at 07:54 PM

Get the documentation from http://www.msgplus.net/pluginsdb/down/?action=file&id=5

That will show you how to structure your plugin. Then use the SetNewName function to change the users display name.


RE: Help to a newbie? by Fröt on 02-11-2005 at 07:58 PM

hmm

i downloaded and examined it but even now i cant say i understand.

i will use setnewname func but where?

mu func must at least one time in a day.how can i do this?


sorry for endless questions.


RE: Help to a newbie? by Plik on 02-11-2005 at 08:02 PM

You could either have a loop to check if the time has changed and update it from there. And you could start that loop from the initialise function.

Or you could check to see if the day has changed in the intialise function then exit the plugin.

Or you could have a command to update it.


RE: Help to a newbie? by Fröt on 02-11-2005 at 08:07 PM

i think i am starting to understand madman66 thank you : )

so the plug in have a func "initialise"..

so lets say i want to make a command for user..

how can do this?

ie: /changenik


RE: Help to a newbie? by Plik on 02-11-2005 at 08:12 PM

In the parsecommand funtion of the documentation there should be an example of handling commands.


RE: Help to a newbie? by Fröt on 02-11-2005 at 08:26 PM

code:

Function DiferenciaEnFechas(pdFechaBase As Date, pdFecha As Date) As String
    Dim dFechaAux As Date
    Dim iYear As Integer, iMes As Integer, iDia As Integer
    Dim iYearFinal As Integer
    Dim iMesFinal As Integer
    Dim iDiaFinal As Integer
    Dim sTiempo As String, sAux As String
    iDia = DatePart("d", pdFecha)
    iMes = Month(pdFechaBase)
    iYear = Year(pdFechaBase)
    dFechaAux = DateSerial(iYear, iMes, iDia)
    iDiaFinal = DateDiff("d", dFechaAux, pdFechaBase)
    iMes = DateDiff("m", pdFecha, pdFechaBase)
    Select Case iMes
        Case Is > 0
        iYearFinal = iMes \ 12
        iMesFinal = iMes Mod 12
        If iDiaFinal < 0 Then
            If Month(dFechaAux) <> Month(pdFechaBase) Then
                iDiaFinal = 31 - (DatePart("d", DateAdd("d", -1, DateSerial(iYear, Month(dFechaAux), 1))))
                dFechaAux = DateAdd("m", -1, dFechaAux)
                dFechaAux = DateAdd("d", -iDiaFinal, dFechaAux)
            Else
                dFechaAux = DateAdd("m", -1, dFechaAux)
            End If

            iDiaFinal = DateDiff("d", dFechaAux, pdFechaBase)


            If iMesFinal > 0 Then
                iMesFinal = iMesFinal - 1
            Else


                If iYearFinal > 0 Then
                    iYearFinal = iYearFinal - 1
                    iMesFinal = 11
                End If

            End If

        End If

        sTiempo = "Pasado: "
        Case Is = 0
        iYearFinal = 0
        iMesFinal = 0


        If iDiaFinal < 0 Then 'Futuro
            iDiaFinal = DateDiff("d", pdFechaBase, dFechaAux)
            sTiempo = "Futuro: "
        ElseIf iDiaFinal = 0 Then 'HOY
            sTiempo = "HOY: "
        Else 'Pasado
            sTiempo = "Pasado: "
        End If

        Case Else 'Futuro
        iMes = DateDiff("m", pdFechaBase, pdFecha)
        iYearFinal = iMes \ 12
        iMesFinal = iMes Mod 12
       


        If iDiaFinal > 0 Then
            dFechaAux = DateAdd("m", 1, dFechaAux)
           
            iDiaFinal = DateDiff("d", pdFechaBase, dFechaAux)


            If iMesFinal > 0 Then
                iMesFinal = iMesFinal - 1
            Else


                If iYearFinal > 0 Then
                    iYearFinal = iYearFinal - 1
                    iMesFinal = 11
                End If

            End If

        Else
            iDiaFinal = DateDiff("d", pdFechaBase, dFechaAux)
        End If

        sTiempo = "Futuro: "
    End Select

sAux = Str(iYearFinal)


If iYearFinal = 1 Then
    sAux = sAux & " Ańo, "
Else
    sAux = sAux & " Ańos, "
End If

sAux = sAux & Str(iMesFinal)


If iMesFinal = 1 Then
    sAux = sAux & " Mes, "
Else
    sAux = sAux & " Meses, "
End If

sAux = sAux & Str(iDiaFinal)


If iDiaFinal = 1 Then
    sAux = sAux & " Día"
Else
    sAux = sAux & " Dia"
End If



DiferenciaEnFechas = sTiempo & sAux

Dim a, b, c As Integer
a = Left(Right(DiferenciaEnFechas, 6), 2)
b = Left(Right(DiferenciaEnFechas, 16), 1)
If Left(a, 1) = " " Then
a = Right(a, 1)
End If
If b = " " Then
b = 0
End If

c = a + (b * 30)


DiferenciaEnFechas = c
End Function




my function is above!

can anybody send the plugin code for me to understand at last?


i think i wanted very much things.:^)
RE: Help to a newbie? by Jip on 02-11-2005 at 11:53 PM

U will have to include the 2 files as part as the API, then u need to make ur own

u need the initalize function and uninitalize ones

configures functions
and GetPublishCommandInfo

which needs the name of the command ur going to use in msn e.g(/xchangename) U MUST USE X BEFORE YOUR COMMAND

then u will need  ParseCommand

there u need to put

If (StrComp(LCase(sCommand), "/xsamplevb", vbTextCompare) = 0) Then

sResult = DiferenciaEnFechas(blahhfgh)

/xsamplevb, to be replaced with the name of ur plugin command

then its just time for testing :)))


RE: RE: Help to a newbie? by Fröt on 02-12-2005 at 12:37 AM

quote:
Originally posted by Jip
U will have to include the 2 files as part as the API, then u need to make ur own

u need the initalize function and uninitalize ones

configures functions
and GetPublishCommandInfo

which needs the name of the command ur going to use in msn e.g(/xchangename) U MUST USE X BEFORE YOUR COMMAND

then u will need  ParseCommand

there u need to put

If (StrComp(LCase(sCommand), "/xsamplevb", vbTextCompare) = 0) Then

sResult = DiferenciaEnFechas(blahhfgh)

/xsamplevb, to be replaced with the name of ur plugin command

then its just time for testing :)))





thank you very much!

you let me see it :P

alright,do you know a command to get the current nickname of user.
RE: Help to a newbie? by Plik on 02-12-2005 at 12:43 AM

That cant be done with the Plus API but you can use the messenger API. Which is passed in initialise.

code:
oMessenger.Myfriendlyname()
gets the current users nickname
RE: RE: Help to a newbie? by Fröt on 02-12-2005 at 12:48 PM

quote:
Originally posted by madman66
That cant be done with the Plus API but you can use the messenger API. Which is passed in initialise.
code:
oMessenger.Myfriendlyname()
gets the current users nickname


When i use
code:
oMessenger.Myfriendlyname()
in Initialise the MSN doesn't see my plugin?

Is there other ways to take the current nick of user?
RE: Help to a newbie? by (CyBeRDuDe) on 02-12-2005 at 01:09 PM

Option Explicit
Public objMessenger

Public Function Initialize(ByVal nVersion As Long, ByVal sUserEmail As String, ByVal oMessenger As Object) As Boolean
Set objMessenger = oMessenger
MsgBox objMessenger.MyFriendlyName
Initialize = True
End Function


Just an example... :D..


RE: Help to a newbie? by Fröt on 02-12-2005 at 01:22 PM

No it dosn't work

but thanks.


RE: Help to a newbie? by taz030485 on 02-19-2005 at 12:38 PM

Hey Fröt I was wandering what the progree son this plugin is going? If u'd like me to I'd be more than happy to test it for u as I've been wanting a plugin like this for some time but the best code I've ever written is a Pascal proram the randomly puts together letters till it matches a word enterd by the user and I don't think that'll help here:P