the best script request ever made in the world
Moderator: Moderators
the best script request ever made in the world
po zi, mas o menos
i have general bot script, and it has a command to leave messages to users that are not connected, when they just connect they receive the message, ok, but it only works for opers and if you restart the hub you lost? the message (i didn't test it, but i think it occurs), i also have the bulleting script, it save messages in a txt and they are never lost.
isn't it a good idea to join this functions? an script for leaving messages users to users, and a txt to keep/save this messages until it is received (one day, one week or one month later, no matter when)
my users use the bulletin to leave messages to other, but that messages are not private, this script would solve this question and facilitate comunications
i have general bot script, and it has a command to leave messages to users that are not connected, when they just connect they receive the message, ok, but it only works for opers and if you restart the hub you lost? the message (i didn't test it, but i think it occurs), i also have the bulleting script, it save messages in a txt and they are never lost.
isn't it a good idea to join this functions? an script for leaving messages users to users, and a txt to keep/save this messages until it is received (one day, one week or one month later, no matter when)
my users use the bulletin to leave messages to other, but that messages are not private, this script would solve this question and facilitate comunications
Hi hi hoo
'''''''''''''''''''''''''''''''''''
'Check if user is in hub registry
''''''''''''''''''''''''''''''''''''
Function CheckRegUser(sUser)
CheckRegUser = True
For Each oItem In frmHub.lstOps.listItems
If lcase(oItem.Text) = Lcase(sUser) then
CheckRegUser = True
End IF
Next
End Function
that's my dirty way of doing all
don't look me so, i don't know about scripting
'Check if user is in hub registry
''''''''''''''''''''''''''''''''''''
Function CheckRegUser(sUser)
CheckRegUser = True
For Each oItem In frmHub.lstOps.listItems
If lcase(oItem.Text) = Lcase(sUser) then
CheckRegUser = True
End IF
Next
End Function
that's my dirty way of doing all
don't look me so, i don't know about scripting
Hi hi hoo
sorry, i am writting a monologue, but i am modifying memobot to work with no registered users, i have a question, it seems that the logic operator "or" doesn't exist in vbscript,
can use only one "sub" for all kind of users??????is there any better way than repeat the "sub"?
'Registered User Logs in, Checks if User has new messages
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub NewUserConnected(curUser)
If CheckFile(sMainDir + Lcase(CStr(curUser.sName)) + "\new.txt") = False Then
Exit Sub
End If
iNumLines = CountMemo(curUser.sName)
curUser.PrivateMessage CStr(sBotName), "You have " & iNumLines & " memos waiting for you, type " & sCmdReadMemo & " to read them now."
End Sub
Sub Opconnected(curUser)
If CheckFile(sMainDir + Lcase(CStr(curUser.sName)) + "\new.txt") = False Then
Exit Sub
End If
iNumLines = CountMemo(curUser.sName)
curUser.PrivateMessage CStr(sBotName), "You have " & iNumLines & " memos waiting for you, type " & sCmdReadMemo & " to read them now."
End Sub
can use only one "sub" for all kind of users??????is there any better way than repeat the "sub"?
'Registered User Logs in, Checks if User has new messages
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub NewUserConnected(curUser)
If CheckFile(sMainDir + Lcase(CStr(curUser.sName)) + "\new.txt") = False Then
Exit Sub
End If
iNumLines = CountMemo(curUser.sName)
curUser.PrivateMessage CStr(sBotName), "You have " & iNumLines & " memos waiting for you, type " & sCmdReadMemo & " to read them now."
End Sub
Sub Opconnected(curUser)
If CheckFile(sMainDir + Lcase(CStr(curUser.sName)) + "\new.txt") = False Then
Exit Sub
End If
iNumLines = CountMemo(curUser.sName)
curUser.PrivateMessage CStr(sBotName), "You have " & iNumLines & " memos waiting for you, type " & sCmdReadMemo & " to read them now."
End Sub
Hi hi hoo
That function returns always the value "True". This could be faster:InnerCity wrote:'''''''''''''''''''''''''''''''''''
'Check if user is in hub registry
''''''''''''''''''''''''''''''''''''
Function CheckRegUser(sUser)
CheckRegUser = True
For Each oItem In frmHub.lstOps.listItems
If lcase(oItem.Text) = Lcase(sUser) then
CheckRegUser = True
End IF
Next
End Function
Code: Select all
Function CheckRegUser(sUser)
If frmHub.lstOps.FindItem(CStr(sUser)) Is Nothing Then CheckRegUser=True
End Sub
It does exist, but you cant use it like "Sub NewUserConnected(curUser) Or OpConnected(curUser)" =)InnerCity wrote:it seems that the logic operator "or" doesn't exist in vbscript
No, NewUserConnected triggers on unregistered users and OpConnected triggers on reg users.InnerCity wrote:can use only one "sub" for all kind of users??????
Well you could call another sub when other is called:InnerCity wrote:is there any better way than repeat the "sub"?
Code: Select all
Sub NewUserConnected(curUser)
If CheckFile(sMainDir + Lcase(CStr(curUser.sName)) + "\new.txt") = False Then
Exit Sub
End If
iNumLines = CountMemo(curUser.sName)
curUser.PrivateMessage CStr(sBotName), "You have " & iNumLines & " memos waiting for you, type " & sCmdReadMemo & " to read them now."
End Sub
Sub OpConnected(curUser)
Call NewUserConnected(curUser)
End Sub
thanks again, working ok, but i think memobot is...
think about this:
a "sub" inside a multi bot, your general-bot script, for example
the invalid newuserconnected (like mldc) are stopped by the initial conditions,
so the subroutine will not work with invalid users (no waste of cpu)
you have a txt, with the messages of the senders, the senders and adressees
/adresse1/sender1/message1/time1
/adresse2/sender2/message2/time2
the script verify with a ¿curl?(bucle in spanish) if the name of the newuserconnected
is written in the txt as an adresee, if that is true
then send a private message to the adresse with the sender-message and erase the message of the txt.
the messages are never lost if you restart the hub,
can add a period of time until erase them automatically,
can decide if it works with registered user or non-registered users,
so don't need to register users if you want,
don't need a directory and a txt for everyone like memobot (only need one txt),
the message is received, the communication occurs,
it works, it's simple, it´s fast, it´s usefull
think about this:
a "sub" inside a multi bot, your general-bot script, for example
the invalid newuserconnected (like mldc) are stopped by the initial conditions,
so the subroutine will not work with invalid users (no waste of cpu)
you have a txt, with the messages of the senders, the senders and adressees
/adresse1/sender1/message1/time1
/adresse2/sender2/message2/time2
the script verify with a ¿curl?(bucle in spanish) if the name of the newuserconnected
is written in the txt as an adresee, if that is true
then send a private message to the adresse with the sender-message and erase the message of the txt.
the messages are never lost if you restart the hub,
can add a period of time until erase them automatically,
can decide if it works with registered user or non-registered users,
so don't need to register users if you want,
don't need a directory and a txt for everyone like memobot (only need one txt),
the message is received, the communication occurs,
it works, it's simple, it´s fast, it´s usefull
Hi hi hoo
non-registered users can't send memos to registered usersGadget wrote:Code: Select all
Function CheckRegUser(sUser) If frmHub.lstOps.FindItem(CStr(sUser)) Is Nothing Then CheckRegUser=True End Sub
finally used
Code: Select all
Function CheckRegUser(sUser)
If frmHub.lstOps.FindItem(CStr(sUser)) Is Nothing Then CheckRegUser=True
CheckRegUser=True
End Function
Hi hi hoo
-
- Posts: 147
- Joined: 2003-01-04 02:20
- Location: Canada http://hub-link.sf.net
- Contact:
There are a lot of things in MemoBot that could be done "better"
It's really important to understand the goals of that script.
1. The functionality it provides.
2. A collaborative script development by Users on DC++ The New Decade (http://dc.ww-ei.com/)
3. A teaching script for n00b's to watch the development/progression of with lots of comments so they can see how to create a vbScript from beginning to end. There were about 10 versions before development stopped in between each version there was a discussion of features and approaches... go look for the thread....
If ManicDepressiveSanta and I were coding this strictly based on the functional requirements we may have done things a lot differently.
HaArD
It's really important to understand the goals of that script.
1. The functionality it provides.
2. A collaborative script development by Users on DC++ The New Decade (http://dc.ww-ei.com/)
3. A teaching script for n00b's to watch the development/progression of with lots of comments so they can see how to create a vbScript from beginning to end. There were about 10 versions before development stopped in between each version there was a discussion of features and approaches... go look for the thread....
If ManicDepressiveSanta and I were coding this strictly based on the functional requirements we may have done things a lot differently.
HaArD
So actually you dont need the whole function =)InnerCity wrote:Function CheckRegUser(sUser)
CheckRegUser=True
End Function
Cant really say if it's mldc until it sends $MyINFO, so upload bandwidth is wasted anyway if hub doesn't use delayed entry (cpu is not usually a problem). Automatic banning of all mldc users could helpInnerCity wrote:the invalid newuserconnected (like mldc) are stopped by the initial conditions
I would rather use a database, so that i could save other information too... Thinking about it.InnerCity wrote:you have a txt, with the messages of the senders, the senders and adressees
/adresse1/sender1/message1/time1
/adresse2/sender2/message2/time2
didn't want to criticize memobot
very well explained all the script
i have learned a lot of vb just watching it
it's a beautiful and usefull script
only was looking for the most simple way of doing something, sorry
there is a typo in the script i downloaded from dc++ the new decade
http://dc.ww-ei.com/index.php?&act=vbscripts
line 278
curUser.PrivateMessage CStr(sBotName), "You have " & iNumLines & " memos waiting for you, type " & sCmdRead & " to read them now."
must be sCmdReadMemo
very well explained all the script
i have learned a lot of vb just watching it
it's a beautiful and usefull script
only was looking for the most simple way of doing something, sorry
there is a typo in the script i downloaded from dc++ the new decade
http://dc.ww-ei.com/index.php?&act=vbscripts
line 278
curUser.PrivateMessage CStr(sBotName), "You have " & iNumLines & " memos waiting for you, type " & sCmdRead & " to read them now."
must be sCmdReadMemo
Hi hi hoo