the best script request ever made in the world

Which hub software is the best? Where can I find script XXX? Discuss it here...(no, this is not for advertising your hub...)

Moderator: Moderators

Locked
InnerCity
Posts: 105
Joined: 2003-05-17 00:35

the best script request ever made in the world

Post by InnerCity » 2003-07-08 18:46

po zi, mas o menos :lol: :lol: :lol:
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

Paul_Don
Posts: 146
Joined: 2003-01-29 06:41
Location: uk
Contact:

Post by Paul_Don » 2003-07-08 20:46

ask gadget nicely :P i think he probably might be updatin it with feature for the nmdc but im not sure

but the

+message <user> <msg> leaves a message to a specific user when he/she logs on


command works fine for me jsut dont restart ya comp all the time

InnerCity
Posts: 105
Joined: 2003-05-17 00:35

Post by InnerCity » 2003-07-09 20:50

found the MemoBot, time to run it
Hi hi hoo

InnerCity
Posts: 105
Joined: 2003-05-17 00:35

Post by InnerCity » 2003-07-09 21:32

shit, only works with registered users, if i register my users the general bot don't test connection settings and file list conditions, so i would have to modify it

what is the problem of sending messages non-registered users ¿any hacking question¿?¿?¿?¿?¿?
Hi hi hoo

InnerCity
Posts: 105
Joined: 2003-05-17 00:35

Post by InnerCity » 2003-07-10 00:01

'''''''''''''''''''''''''''''''''''
'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 :D :D :D :D :D
don't look me so, i don't know about scripting :roll: :roll: :roll:
Hi hi hoo

InnerCity
Posts: 105
Joined: 2003-05-17 00:35

Post by InnerCity » 2003-07-10 02:56

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
Hi hi hoo

Gadget
Posts: 62
Joined: 2003-01-11 06:24
Location: Finland
Contact:

Post by Gadget » 2003-07-10 04:54

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
That function returns always the value "True". This could be faster:

Code: Select all

Function CheckRegUser(sUser)
If frmHub.lstOps.FindItem(CStr(sUser)) Is Nothing Then CheckRegUser=True
End Sub
InnerCity wrote:it seems that the logic operator "or" doesn't exist in vbscript
It does exist, but you cant use it like "Sub NewUserConnected(curUser) Or OpConnected(curUser)" =)
InnerCity wrote:can use only one "sub" for all kind of users??????
No, NewUserConnected triggers on unregistered users and OpConnected triggers on reg users.
InnerCity wrote:is there any better way than repeat the "sub"?
Well you could call another sub when other is called:

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

InnerCity
Posts: 105
Joined: 2003-05-17 00:35

Post by InnerCity » 2003-07-10 06:03

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
Hi hi hoo

InnerCity
Posts: 105
Joined: 2003-05-17 00:35

Post by InnerCity » 2003-07-10 06:53

Gadget wrote:

Code: Select all

Function CheckRegUser(sUser)
If frmHub.lstOps.FindItem(CStr(sUser)) Is Nothing Then CheckRegUser=True
End Sub
non-registered users can't send memos to registered users
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

InnerCity
Posts: 105
Joined: 2003-05-17 00:35

Post by InnerCity » 2003-07-10 06:57

:D Function CheckRegUser(sUser)
CheckRegUser=True
End Function :D
Hi hi hoo

HaArD
Posts: 147
Joined: 2003-01-04 02:20
Location: Canada http://hub-link.sf.net
Contact:

Post by HaArD » 2003-07-10 17:11

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

Gadget
Posts: 62
Joined: 2003-01-11 06:24
Location: Finland
Contact:

Post by Gadget » 2003-07-10 17:14

InnerCity wrote:Function CheckRegUser(sUser)
CheckRegUser=True
End Function
So actually you dont need the whole function =)
InnerCity wrote:the invalid newuserconnected (like mldc) are stopped by the initial conditions
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 help :twisted:
InnerCity wrote:you have a txt, with the messages of the senders, the senders and adressees
/adresse1/sender1/message1/time1
/adresse2/sender2/message2/time2
I would rather use a database, so that i could save other information too... Thinking about it.

InnerCity
Posts: 105
Joined: 2003-05-17 00:35

Post by InnerCity » 2003-07-10 19:07

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
Hi hi hoo

Locked