pop-up pm from the bot on startup

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
Gaborone
Posts: 13
Joined: 2003-02-27 16:34

pop-up pm from the bot on startup

Post by Gaborone » 2003-03-01 03:08

Hi,

I want to give all users a private message on login as a popup pm from the bot. This works when I test it locally with only me as user, but when i run the script globally, the message appears in the chat window, with a text explaining that it is a pm from the bot.

I've also tried to put it in later in the login sequence, by doing it in the dataarrival procedure, filtering for $MyInfo, and that works.
The problem now is that the message is sent quite often to the users, I thought $MyInfo was only sent on login, and if any of the parameters in the message, such as share or slots had changed, but it seems as if it is sent more on regular basis.

Is there anyway to force a privatemessage to be displayed in a pop-up window? I have the frhubs.doeventsforme command both before and after the pm command.

Regards, Gaborone

ButterflySoul
Posts: 210
Joined: 2003-01-23 17:24
Location: Nevada
Contact:

Post by ButterflySoul » 2003-03-01 04:24

Using the PrivateMessage method of a user will send a private message. So will using the SendData method, if you want to directly send the command already formated as a typical private message.
This will "force" the client to pop up a PM window.

However, in the options of the DC++ client, you can choose to pop-up or not pop-up private messages; and you can force users not showing online to pop up, or even go as far as ignoring them. I would suggest starting by giving an eye there, to see if the options used by your client are indeed the ones you would like it to.

Also, many people install the NeoModus Client, then the Hub, then DC++.. and somewhere down the road un-install the NeoModus client, since they don't use it =) And then, they end up with real strange and unusual symptoms, like the one you are describing... because the NeoModus Hub needs the NeoModus client to run properly. That's the second possible cause for your trouble, aside from an option issue in DC++

-----

$MyInfo is indeed sent on a regular basis, even the share doesn't change. If you want to send a single PM on login, you can use the NewUserConnected Sub; or the "On Join Message" that can be setup in the "client interactions" section of the NMDC Hub software

By the time NewUserConnected is triggered, the sMyInfoString method of a user is still an empty string. That string only contains data after a $MyInfo is received.
If you want the message to be sent only once, but to include parts of the $MyInfo string (presumably the share size), you can keep track of users freshly connected. Add them to a dictionary when they trigger the NewUserConnected Sub, then when you receive a $MyInfo string, you can check if the user who sent it is still in the dictionary (i.e. waiting for a welcome message). If the user is in the dictionary, send them the welcome message, and delete them from the dictionary.
Entries in a dictionary are indexed, so you won't need to scan thru the whole list, like you would need to do with an array for example. Simply use the Exists method of the dictionary =)
[CoZ] Children of Zeus
-----
Shadows DC Hub - VBS and JS scripting at their best

TMM
Posts: 47
Joined: 2003-01-03 19:50
Location: leeds UK
Contact:

Post by TMM » 2003-03-01 15:50

in
sub newuserconnected

add curUser.privateMessage CStr(BotName), "welcome " & Cstr(curuser) & " there are " & CStr(ops) & " in here right now, type +commands for a list of helper functions"

thats basically it, and that is before sub Main() and the sub will all ready be in the script.

____________________________________________________________

to define a bot

you start with Dim BotName As String

then in sub Main()
define what the bot is called if u aint using a database with

Botname = "smellybot"
or any other name u have in mind.
ashes to ashes, dust to dust, if the dope dont get you. The acid must

Gaborone
Posts: 13
Joined: 2003-02-27 16:34

Re

Post by Gaborone » 2003-03-01 18:49

Ok,

I've already got a bot, and I do send a the private message from the Newuserconnected sub.

The problem is that when many users are connected to the hub, there is some kind of lag in the hub software (this is how i explain what's happening, but i havn't got any evidence that this is the case), so the private message from the bot is displayed in the chat window instead of as a pop-up pm from the bot.

/Gaborone

Sedulus
Forum Moderator
Posts: 687
Joined: 2003-01-04 09:32
Contact:

Post by Sedulus » 2003-03-01 22:37

I'd guess that the user hasn't gotten the NickList then,
(if a user isn't on the list, dc++ won't pop-up the message)
so what you could do before sending the pm, is send "$Hello <bot_name>|"
then the bot_name _should_ be known to the users' dc, and the following pm should pop-up
http://dc.selwerd.nl/hublist.xml.bz2
http://www.b.ali.btinternet.co.uk/DCPlusPlus/index.html (TheParanoidOne's DC++ Guide)
http://www.dslreports.com/faq/dc (BSOD2600's Direct Connect FAQ)

Gaborone
Posts: 13
Joined: 2003-02-27 16:34

Issue closed

Post by Gaborone » 2003-03-02 06:45

Hi,

Thanks for all the help.

I've solved th problem now using the VBscript dictionary feature.

By adding the user to the dictionary in the opconnected or newuserconnected sub, and checking if the user is in the dictionary in the dataarrival sub when the $Myinfo message arrives, and then remove the user from the dictionary, I manage to send the message i want as a pop-up pm to the user, and only do this once.

Thanks again for your help!

/Gaborone

Locked