IPB

Welcome Guest ( Log In | Register )

1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 
Reply to this topicStart new topic
> Complex Scrim List Request, Help please!
PhyzX
post May 16 2009, 02:12 AM
Post #1


Jr. Member
**

Group: Members
Posts: 54
Joined: 13-February 09
Member No.: 46,777



Could someone help me write up a script that does the following:

- allows user with 60 access to add Clans to the scrim list
- allows user with 60 access to specify preferred contact person(s) for the clan immediately after add then to the scrim list
- allows user with 70 access to edit (add/remove) preferred contact person(s) for each clan
- allows user with 70 access to remove clan from scrim list
- allows user with 50 access to view all clans on the scrimlist
- allows user with 50 access to view preferred contact
- when user with 60 access type .scrim <tag>, bot will whispers the preferred contact person that we want a scrim and ask them to reply to the person using the command
- allows other clan members clan add themselves to the scrim list

Example 1:
Userx: .scrimme
Bot: /w Userx You are not in a clan.
User0 <tag>: .scrimme
Bot: Clan <tag> has been added to the scrim list.
Bot: Preferred contact: User0
User0 <tag>: .scrimme
Bot: /w Your clan is already on the scrim list.
User1 <tag>: .scrimme
Bot: Preferred contact: User0, User1
User: .scrimadd <tag> username
Bot: This Clan has already been added on the scrim list.
User: .scrimlist
Bot: Clans on scrim list: <tag>, <tag1>, <tag2>
User: .scriminfo <tag>
Bot: Clan <tag> - Preferred contact: User0
User: .scrim <tag>
Bot: /w usernamex Clan j2m would like to scrim your team, contact User for more info.
Bot: usernamex recieved the message.
Bot: /w usernamey Clan j2m would like to scrim your team, contact User for more info.
Bnet error: usernamey is offline
Bot: usernamey is currently offline.

Example 2:
User .scrimadd <tag> username1, username2
Bot: Clan <tag> has been added on the scrim list.
Bot: Preferred contacts: username1, username2
User: .scrimedit <tagx> username
Bot: Clan <tagx> is not on the scrim list.
User: .scrimedit <tag> username2, username3
Bot: username2 removed
Bot: Clan <tag> - Preferred contact: username1, username3
User: .scrimedit <tag> username2
Bot: Clan <tag> - Preferred contact: username1, username2, username3


I've been looking around on the forum but haven't found scrim list near as complex as this.
Hope someone can help me!
I think a lot of people would want to have this.

*please make sure that when a clan is added to the list, it is case sensitive
and displayed with case sensitive (i.e. .scrimadd HaN ; Bot: Clan HaN....)
but when you use commands, it is not case sensitive (i.e. .scrimedit han ; Bot: Clan HaN...)
*could you also make it script-noob-friendly to modify the access levels required?
kinda like black-ninja's recruit script

Thanks A Lot!
~PhyzX

Can someone please help?
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
The-Black-Ninja
post May 16 2009, 07:18 AM
Post #2


Pure Sex
********

Group: Moderators
Posts: 7,756
Joined: 13-August 06
Member No.: 7,372



Can you not bump?


--------------------
IPB Image

-My Plugins :: Thanks Pyro :)
IPB ImageIPB Image
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
PhyzX
post May 18 2009, 08:42 PM
Post #3


Jr. Member
**

Group: Members
Posts: 54
Joined: 13-February 09
Member No.: 46,777



Okay i've been looking at codes after codes,
i have a few questions:

1. how does the Split function work? (it is possible to add more than 1 username to preferred contact?)
2. how do i edit a line in an .ini file? (do i just erase and rewrite?)
3. how do i whisper to each of usernames that i've added to the preferred contact? (incase there is more than 1)

if no one have time, i'll attempt to write something
but hopefully someone can write this for me instead! tongue.gif

Thanks for any help i can get.
~PhyzX

This post has been edited by PhyzX: May 18 2009, 08:50 PM
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Sui(C)ide
post May 18 2009, 09:04 PM
Post #4


SuI[C]IdE's DotA Leage Plugin Author
***

Group: Members
Posts: 766
Joined: 23-April 09
From: Australia
Member No.: 49,768



QUOTE(PhyzX @ May 19 2009, 12:42 PM) *

Okay i've been looking at codes after codes,
i have a few questions:

1. how does the Split function work? (it is possible to add more than 1 username to preferred contact?)
2. how do i edit a line in an .ini file? (do i just erase and rewrite?)
3. how do i whisper to each of usernames that i've added to the preferred contact? (incase there is more than 1)

if no one have time, i'll attempt to write something
but hopefully someone can write this for me instead! tongue.gif

Thanks for any help i can get.
~Rich


You can find info on the split function at... http://w3schools.com/vbscript/func_split.asp
An example is
JoeUser: Hello world!

Split(Message)(0)
That would return "Hello"

Split(Message(1)
That would rerutn "world!"

For .ini files, there's 2 function. WriteConfigEntry, and GetConfigEntry
WriteConfigEntry("Section", Username, "Is a user" , iniFilePath)

That would write to an .ini
[Section]
Joe=Is a user

As for GetConfigEntry
EntryName = GetConfigEntry("Section", Username, iniFilePath)

That would return: Is a user

To /w everyone on your friends list.
It's /f l
E.g. /f l hello everyone

Anything else?


--------------------
IPB Image
Interested in joining an Aus/Nz DotA League? Come by Clan AIDL today, on UWEST.
You may visit our website Here.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
The-Black-Ninja
post May 18 2009, 09:39 PM
Post #5


Pure Sex
********

Group: Moderators
Posts: 7,756
Joined: 13-August 06
Member No.: 7,372



PhyzX, I'm guessing by your questions that you're wanting to make this yourself? If I'm wrong, I can do this tomorrow.


--------------------
IPB Image

-My Plugins :: Thanks Pyro :)
IPB ImageIPB Image
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
PhyzX
post May 18 2009, 10:05 PM
Post #6


Jr. Member
**

Group: Members
Posts: 54
Joined: 13-February 09
Member No.: 46,777



@Wotl.Zexen
i meant how do you make bot whisper the ppl listed on the ini file?

@Black-Ninja
it'd be nice if you can make this for me tomorrow.
I kinda wanna learn how to write scripts for the stealthbot too
thats why i was asking
Thanks wink.gif
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Sui(C)ide
post May 18 2009, 11:46 PM
Post #7


SuI[C]IdE's DotA Leage Plugin Author
***

Group: Members
Posts: 766
Joined: 23-April 09
From: Australia
Member No.: 49,768



QUOTE

@Wotl.Zexen
i meant how do you make bot whisper the ppl listed on the ini file?


I'm not quite sure on how that's set-up... Ninja is gonna have to do it, sorry.



--------------------
IPB Image
Interested in joining an Aus/Nz DotA League? Come by Clan AIDL today, on UWEST.
You may visit our website Here.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
The-Black-Ninja
post May 19 2009, 04:26 PM
Post #8


Pure Sex
********

Group: Moderators
Posts: 7,756
Joined: 13-August 06
Member No.: 7,372



How bout you both stop arguing?

QUOTE(PhyzX @ May 19 2009, 12:05 AM) *
@Black-Ninja
it'd be nice if you can make this for me tomorrow.
I kinda wanna learn how to write scripts for the stealthbot too
thats why i was asking
Thanks wink.gif
Okay, I'll start this tonight since this request has been unfulfilled for a few weeks.


Edit: I'm a bit lost by your examples, I appreciate the effort, but could you list the commands like so:
QUOTE
.scrimme = Adds the username's clan to the list. If not in a clan, say "you aren't in a clan, douchebag!". Access needed: 60
.scrimadd <clan> = Adds the specified tag to the list....

etc.
I'll use the error messages you put in your examples so you won't have to type all those out again. I'm just wanting some clarity on the command names and access for them smile.gif


--------------------
IPB Image

-My Plugins :: Thanks Pyro :)
IPB ImageIPB Image
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
PhyzX
post May 19 2009, 09:18 PM
Post #9


Jr. Member
**

Group: Members
Posts: 54
Joined: 13-February 09
Member No.: 46,777



QUOTE(The-Black-Ninja @ May 19 2009, 03:26 PM) *


I'll use the error messages you put in your examples so you won't have to type all those out again. I'm just wanting some clarity on the command names and access for them smile.gif


Okay heres the commands that i would like:

.scrimme
>Adds username's clan to the scrim list, adds username's to the clan's preferred contact
>If user's clan is on the scrim list and their name is not on the preferred contact, add them to the preferred contact

.scrimadd <clan> <username1> <username2> 60 access
>Adds the Clan to the scrim list
>Adds the usernames to that clan's preferred contact
*one clan should be able to have more than 1 preferred contact

.scrimrem <clan> 70 access
>Removes the clan from the scrim list

.scrimedit <clan> <username> 70 access
>Add username to the clan's preferred contact
>If username is already on the preferred contact, then remove the username from the list

.scrimlist 50 access
>Displays all the clans on the scrim list

.scriminfo <clan> 50 access
>Displays the preferred contact(s) of the clan

.scrim <clan> 70 access
>bot whispers to all the preferred contact of the clan
>confirms whether or not the contacts recieved the message

Thanks Ninja!

This post has been edited by PhyzX: May 19 2009, 09:18 PM
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
The-Black-Ninja
post May 19 2009, 09:33 PM
Post #10


Pure Sex
********

Group: Moderators
Posts: 7,756
Joined: 13-August 06
Member No.: 7,372



QUOTE
.scrimadd <clan> <username1> <username2> 60 access
>Adds the Clan to the scrim list
>Adds the usernames to that clan's preferred contact
*one clan should be able to have more than 1 preferred contact
Do you want the plugin to automatically check if that username is in the clan or no just incase you run into situations where someone is part of another clan, but still maintains part control over another clan?


--------------------
IPB Image

-My Plugins :: Thanks Pyro :)
IPB ImageIPB Image
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
PhyzX
post May 19 2009, 10:12 PM
Post #11


Jr. Member
**

Group: Members
Posts: 54
Joined: 13-February 09
Member No.: 46,777



QUOTE(The-Black-Ninja @ May 19 2009, 08:33 PM) *

QUOTE
.scrimadd <clan> <username1> <username2> 60 access
>Adds the Clan to the scrim list
>Adds the usernames to that clan's preferred contact
*one clan should be able to have more than 1 preferred contact
Do you want the plugin to automatically check if that username is in the clan or no just incase you run into situations where someone is part of another clan, but still maintains part control over another clan?


I dont quite understand what you mean but
it would be great if the pluggin can check if the user who enters the command is already on the preferred contact list of another clan
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
The-Black-Ninja
post May 20 2009, 05:50 PM
Post #12


Pure Sex
********

Group: Moderators
Posts: 7,756
Joined: 13-August 06
Member No.: 7,372



All done. I'm using a database for this, in case you want to add more information later. Do you want me to test it or do you want to test it and let me know the bugs? I'm not sure if you're wanting this like, 4 days ago or if you're willing to wait a bit lol

This post has been edited by The-Black-Ninja: May 20 2009, 07:07 PM


--------------------
IPB Image

-My Plugins :: Thanks Pyro :)
IPB ImageIPB Image
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
PhyzX
post May 20 2009, 09:37 PM
Post #13


Jr. Member
**

Group: Members
Posts: 54
Joined: 13-February 09
Member No.: 46,777



QUOTE(The-Black-Ninja @ May 20 2009, 04:50 PM) *

All done. I'm using a database for this, in case you want to add more information later. Do you want me to test it or do you want to test it and let me know the bugs? I'm not sure if you're wanting this like, 4 days ago or if you're willing to wait a bit lol


I m fine with waiting
Its probably better if you gave it a test since I wouldnt be able to find out whats wrong if anything did come up

Thanks again Ninja!
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
The-Black-Ninja
post May 21 2009, 07:36 PM
Post #14


Pure Sex
********

Group: Moderators
Posts: 7,756
Joined: 13-August 06
Member No.: 7,372



Rawr. There's really no way for the bot to tell if the user received that whisper or not, the only message you will get is if they're not online or the green/grey text indicating the whisper went through. You could use some public variables and the server_error sub to find out who didn't get the message, but the problem with that is that the script will want to give you that list immediately, even before the bot has a chance to whisper each user. You could use timers to account for this, but if your bot is being bogged down, the timer could run out before the bot has a chance to whisper everyone. That's the only thing I couldn't do.

CODE
'cscrim
'1.0
'&Complex Scrim List:The-Black-Ninja
'&scrimset <setting name> <numerical value>=Sets the access for the setting, which will correspond to the actual command; eg set_access is the scrimset command, info_access is the scriminfo command:scrimme=Add's a user's clan to the scrim list with their name as a contact:scrimadd <clan> <username>=Adds a clan to the scrim list with the usernams as contacts:scrimrem <clan>=Removes a clan from the list:scrimedit <clan> <username>=Adds/removes a user from the clan's contact list:scriminfo <clan>=Displays the contacts for the clan:scrimlist=Displays all clans on the list:scrim <clan>=Whispers all contacts of the clan that you want to scrim
'&41544
'&Be sure to set your pertinent info at the top of the plugin file.


Private Const scrimSet_cmd = "scrimset" '// Command that will allow you to change the access of the commands
Private Const scrimMe_cmd = "scrimme" '// Adds user's clan to the scrim list
Private Const scrimAdd_cmd = "scrimadd" '// Adds a clan to the scrim list, followed by a username of that clan's as a preferred contact
Private Const scrimRem_cmd = "scrimrem" '// Removes a clan from the list
Private Const scrimEdit_cmd = "scrimedit" '// Removes a username from the clan's preferred contact
Private Const scrimInfo_cmd = "scriminfo" '// Displays preferred contact of that clan
Private Const scrimList_cmd = "scrimlist" '// Displays clans on the list
Private Const scrim_cmd = "scrim" '// Whispers all preferred contacts of that clan
Private Const scrim_myClan = "j2m" '// Your clan name
Private Const scrim_myRealm = "Azeroth" '// Realm you play on
Private Const scrim_myProd = "TFT" '// Product you play on; TFT = Frozen Throne, ROC = Reign of Chaos
Private Const scrim_myUser = "Someone" '// User from your clan that will recieve an answer from the users when using the .scrim command

Private cscrimConn '// Our connection variable to the database
Private cscrimDB_FP '// Our database file location - defined in Event_Load


Sub cscrim_Event_Load()

cscrimDB_FP = BotPath & "plugins\cscrim_DB.mdb"

Set FSO = CreateObject("Scripting.FileSystemObject")
If Not FSO.FileExists(cscrimDB_FP) Then
AddChat vbYellow, "CScrim - Creating scrim database for first-time use. (" & cscrimDB_FP & ")"
cscrim_MakeDB
End If

SetSetting "cscrim", "set_access", 200, "Access needed to use the command that will change accesses of the scrim commands.", False
SetSetting "cscrim", "add_access", 60, "Access needed to use the scrimadd command.", False
SetSetting "cscrim", "rem_access", 70, "Access needed to use the scrimrem command.", False
SetSetting "cscrim", "edit_access", 70, "Access needed to use the scrimedit command.", False
SetSetting "cscrim", "list_access", 50, "Access needed to use the scrimlist command.", False
SetSetting "cscrim", "info_access", 50, "Access needed to use the scriminfo command.", False
SetSetting "cscrim", "scrim_access", 70, "Access needed to use the scrim command.", False
End Sub

Sub cscrim_Event_PressedEnter(Text)

cscrim_ProcessRequest BotVars.Username, Text, 4
End Sub

Sub cscrim_Event_WhisperFromUser(Username, Flags, Message)

cscrim_ProcessRequest Username, Message, 3
End Sub

Sub cscrim_Event_Usertalk(Username, Flags, Message, Ping)

cscrim_ProcessRequest Username, Message, 1
End Sub


Sub cscrim_ProcessRequest(Username, Message, dspId)

If NOT (Left(Message, 1) = BotVars.Trigger Or Left(Message, 1) = "/") Then Exit Sub
If Len(Message) < 2 Then Exit Sub

cmd = Split(Mid(LCase(Trim(Message)), 2), " ", 2)
GetDBEntry Username, A, F

Select Case cmd(0)
Case LCase(scrimSet_cmd)
If A < Int(GetSetting("cscrim", "set_access")) AND Username <> BotVars.Username Then Exit Sub
If UBound(cmd) > 0 Then
cscrimSet_command Username, Message, dspId
Else
Dsp dspId, "Invalid syntax. Proper usage: " & BotVars.Trigger & scrimSet_cmd & " set_access 40", Username, vbGreen
End If

Case LCase(scrimMe_cmd)
cscrimMe_command Username, Message, dspId

Case LCase(scrimAdd_cmd)
If A < Int(GetSetting("cscrim", "add_access")) AND Username <> BotVars.Username Then Exit Sub
If UBound(cmd) > 0 Then
cscrimAdd_command Username, Message, dspId
Else
Dsp dspId, "Invalid syntax. Proper usage: " & BotVars.Trigger & scrimAdd_cmd & " " & GetInternalDataByUsername(Username, 0) & " " & Username, Username, vbGreen
End If

Case LCase(scrimRem_cmd)
If A < Int(GetSetting("cscrim", "rem_access")) AND Username <> BotVars.Username Then Exit Sub
If UBound(cmd) > 0 Then
cscrimRem_command Username, Message, dspId
Else
Dsp dspId, "Invalid syntax. Proper usage: " & BotVars.Trigger & scrimRem_cmd & " " & GetInternalDataByUsername(Username, 0), Username, vbGreen
End If

Case LCase(scrimEdit_cmd)
If A < Int(GetSetting("cscrim", "edit_access")) AND Username <> BotVars.Username Then Exit Sub
If UBound(cmd) > 0 Then
cscrimEdit_command Username, Message, dspId
Else
Dsp dspId, "Invalid syntax. Proper usage: " & BotVars.Trigger & scrimEdit_cmd & " " & GetInternalDataByUsername(Username, 0) & " " & Username, Username, vbGreen
End If

Case LCase(scrimInfo_cmd)
If A < Int(GetSetting("cscrim", "info_access")) AND Username <> BotVars.Username Then Exit Sub
If UBound(cmd) > 0 Then
cscrimInfo_command Username, Message, dspId
Else
Dsp dspId, "Invalid syntax. Proper usage: " & BotVars.Trigger & scrimInfo_cmd & " " & GetInternalDataByUsername(Username, 0), Username, vbGreen
End If

Case LCase(scrimList_cmd)
If A < Int(GetSetting("cscrim", "list_access")) AND Username <> BotVars.Username Then Exit Sub
cscrimList_command Username, Message, dspId

Case LCase(scrim_cmd)
If A < Int(GetSetting("cscrim", "scrim_access")) AND Username <> BotVars.Username Then Exit Sub
If UBound(cmd) > 0 Then
cscrim_command Username, Message, dspId
Else
Dsp dspId, "Invalid syntax. Proper usage: " & BotVars.Trigger & scrim_cmd & " " & GetInternalDataByUsername(Username, 0), Username, vbGreen
End If
End Select
End Sub


Sub cscrimSet_command(Username, Message, dspId)

If Username = BotVars.Username Then VetoThisMessage

cmd = Split(Mid(LCase(Trim(Message)), 2), " ")

If UBound(cmd) < 2 Then Dsp dspId, "Invalid syntax. Proper usage: " & BotVars.Trigger & scrimSet_cmd & " set_access 40", Username, vbGreen:Exit Sub
If NOT IsNumeric(cmd(2)) Then Dsp dspId, "Access must be numeric.", Username, vbGreen:Exit Sub

SetSetting "cscrim", cmd(1), cmd(2), "", True
Dsp dspId, cmd(1) & "'s access is now set to " & cmd(2), Username, vbGreen
End Sub


Sub cscrimMe_command(Username, Message, dspId)

CT = GetInternalDataByUsername(Username, 0)
If LCase(CT) = LCase(scrim_myClan) Then Exit Sub
If Lcase(CT) = vbNullString Then Dsp dspId, "You are not in a clan.", Username, vbGreen:Exit Sub

cscrimConnect()
Set ns = cscrimConn.Execute("SELECT COUNT(*) FROM `clans` WHERE `clan` ='" & CT & "'")
If ns.Fields(0) = 0 Then
cscrimConn.Execute("INSERT INTO `clans` (`pref_contact`, `clan`) VALUES ('" & Username & "', '" & CT & "')")
cscrimConn.Close
Dsp dspId, "Clan " & CT & " has been added to the scrim list.", Username, vbGreen
Else
Set ns = cscrimConn.Execute("SELECT COUNT(*) FROM `clans` WHERE `pref_contact` ='" & Username & "' AND `clan` = '" & CT & "'")
If ns.Fields(0) = 0 Then
cscrimConn.Execute("INSERT INTO `clans` (`pref_contact`, `clan`) VALUES ('" & Username & "', '" & CT & "')")
cscrimConn.Close
Dsp dspId, "You have been added to Clan " & CT & "'s preferred scrim contact list.", Username, vbGreen
Else
Dsp dspId, "Your clan is already on the contact list and you are a preferred contact.", Username, vbGreen
End If
End If
End Sub


Sub cscrimAdd_command(Username, Message, dspId)

If Username = BotVars.Username Then VetoThisMessage

cmd = Split(Mid(LCase(Trim(Message)), 2), " ")

If UBound(cmd) < 2 Then Dsp dspId, "Invalid syntax. Proper usage: " & BotVars.Trigger & scrimAdd_cmd & " " & GetInternalDataByUsername(Username, 0) & " " & Username, Username, vbGreen:Exit Sub
sClan = cmd(1)
cCheck = cscrim_CheckClanExists(sClan)
If cCheck = 0 Then Dsp dspId, "That clan does not exist in " & scrim_myRealm & " on " & Split(cscrim_GetProd, "|")(1) & ".", Username, vbGreen:Exit Sub

text = vbNullString
cscrimConnect()
For i = 2 To Ubound(cmd)
Set ns = cscrimConn.Execute("SELECT COUNT(*) FROM `clans` WHERE `pref_contact` ='" & cmd(i) & "' AND `clan` ='" & sClan & "'")
If ns.Fields(0) = 0 Then
cscrimConn.Execute("INSERT INTO `clans` (`pref_contact`, `clan`) VALUES ('" & cmd(i) & "', '" & sClan & "')")
text = text & cmd(i) & ", "
End If
Next
cscrimConn.Close

If text <> vbNullString Then
Dsp dspId, "Clan " & sClan & "'s preferred contact list updated: " & Left(text, Len(text) -2), Username, vbGreen
Else
Dsp dspId, "Those names already exist in Clan " & sClan & "'s preferred contact list.", Username, vbGreen
End If
End Sub


Sub cscrimRem_command(Username, Message, dspId)

If Username = BotVars.Username Then VetoThisMessage

sClan = Split(Message)(1)

cscrimConnect()
Set ns = cscrimConn.Execute("SELECT COUNT(*) FROM `clans` WHERE `clan` ='" & sClan & "'")
If ns.Fields(0) <> 0 Then
Set ns = cscrimConn.Execute("SELECT `clan` FROM `clans` WHERE `clan` ='" & sClan & "'")
Do Until ns.EOF
cscrimConn.Execute("DELETE FROM `clans` WHERE `clan` ='" & sClan & "'")
ns.MoveNext
Loop

cscrimConn.Close
Dsp dspId, "Clan " & sClan & " has been removed from the scrim list.", Username, vbGreen
Else
Dsp dspId, "Clan " & sClan & " does not exist in the scrim list.", Username, vbGreen
End If
End Sub


Sub cscrimEdit_command(Username, Message, dspId)

If Username = BotVars.Username Then VetoThisMessage

cmd = Split(Mid(LCase(Trim(Message)), 2), " ")

If UBound(cmd) < 2 Then Dsp dspId, "Invalid syntax. Proper usage: " & BotVars.Trigger & scrimEdit_cmd & " " & GetInternalDataByUsername(Username, 0) & " " & Username, Username, vbGreen:Exit Sub

cscrimConnect()
Set ns = cscrimConn.Execute("SELECT COUNT(*) FROM `clans` WHERE `clan` ='" & cmd(1) & "'")
If ns.Fields(0) <> 0 Then
Set ns = cscrimConn.Execute("SELECT `pref_contact` FROM `clans` WHERE `pref_contact` ='" & cmd(2) & "' AND `clan` ='" & cmd(1) & "'")
If (ns.EOF OR ns.BOF) Then
cscrimConn.Execute("INSERT INTO `clans` (`pref_contact`, `clan`) VALUES ('" & cmd(2) & "', '" & cmd(1) & "')")
Dsp dspId, cmd(2) & " has been added to Clan " & cmd(1) & "'s prefered contact list.", Username, vbGreen
Else
cscrimConn.Execute("DELETE FROM `clans` WHERE `pref_contact` ='" & cmd(2) & "' AND `clan` ='" & cmd(1) & "'")
Dsp dspId, cmd(2) & " has been removed from Clan " & cmd(1) & "'s prefered contact list.", Username, vbGreen
End If
Else
cscrimConn.Execute("INSERT INTO `clans` (`pref_contact`, `clan`) VALUES ('" & cmd(2) & "', '" & cmd(1) & "')")
Dsp dspId, "Clan " & cmd(1) & " has been added to the scrim list with " & cmd(2) & " as the preferred contact.", Username, vbGreen
End If
cscrimConn.Close
End Sub


Sub cscrimInfo_command(Username, Message, dspId)

If Username = BotVars.Username Then VetoThisMessage

sClan = Split(Message)(1)

cscrimConnect()
Set ns = cscrimConn.Execute("SELECT COUNT(*) FROM `clans` WHERE `clan` ='" & sClan & "'")
If ns.Fields(0) <> 0 Then
text = vbNullString
Set ns = cscrimConn.Execute("SELECT `pref_contact` FROM `clans` WHERE `clan` ='" & sClan & "'")
Do Until ns.EOF
text = text & ns.Fields(0) & ", "
ns.MoveNext
Loop
Dsp dspId, "Preferred contacts for Clan " & sClan & ": " & Left(text, Len(text) -2), Username, vbGreen
Else
Dsp dspId, "Clan " & sClan & " does not exist in the scrim list.", Username, vbGreen
End If
cscrimConn.Close
End Sub


Sub cscrimList_command(Username, Message, dspId)

If Username = BotVars.Username Then VetoThisMessage

cscrimConnect()
Set ns = cscrimConn.Execute("SELECT COUNT(*) FROM `clans`")
If ns.Fields(0) <> 0 Then
text = vbNullString
Set ns = cscrimConn.Execute("SELECT DISTINCT `clan` FROM `clans`")
Do Until ns.EOF
text = text & ns.Fields(0) & ", "
ns.MoveNext
Loop
Dsp dspId, "Clans in the scrim list: " & Left(text, Len(text) -2), Username, vbGreen
Else
Dsp dspId, "There are no clans in the scrim list.", Username, vbGreen
End If
cscrimConn.Close
End Sub


Sub cscrim_command(Username, Message, dspId)

If Username = BotVars.Username Then VetoThisMessage

sClan = Split(Message)(1)

cscrimConnect()
Set ns = cscrimConn.Execute("SELECT COUNT(*) FROM `clans` WHERE `clan` ='" & sClan & "'")
If ns.Fields(0) <> 0 Then
Set ns = cscrimConn.Execute("SELECT `pref_contact` FROM `clans` WHERE `clan` ='" & sClan & "'")
Do Until ns.EOF
Dsp 3, "Clan " & scrim_myClan & " would like to scrim your team, contact " & scrim_myUser & " for more info.", ns.Fields(0), vbGreen
ns.MoveNext
Loop
Else
Dsp dspId, "Clan " & sClan & " does not exist in the scrim list.", Username, vbGreen
End If
cscrimConn.Close
End Sub


Sub cscrim_MakeDB()

Set Catalog = CreateObject("ADOX.Catalog")
Catalog.Create "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=5;Data Source=" & cscrimDB_FP

cscrimConnect()

cscrimConn.Execute("CREATE TABLE `clans` (`pref_contact` varchar(30), `clan` varchar(5))")
cscrimConn.Close
End Sub


Sub cscrimConnect()

Set cscrimConn = CreateObject("ADODB.connection")
connStringProperty = "Driver={Microsoft Access Driver (*.mdb)};Dbq=" & cscrimDB_FP
cscrimConn.ConnectionString = connStringProperty
cscrimConn.Open
End Sub


Private Function cscrim_GetProd()

If Lcase(scrim_myProd) = "tft" Then
cscrim_GetProd = "w3xp|Frozen Throne"
ElseIf Lcase(scrim_myProd) = "roc" Then
cscrim_GetProd = "war3|Reign of Chaos"
End If
End Function


Private Function cscrim_CheckClanExists(clan) '// 1 = exists, 0 = doesn't exist

If NOT scInet.StillExecuting Then
web = CStr(ScInet.OpenURL("http://classic.battle.net/war3/ladder/" & Split(cscrim_GetProd, "|")(0) & "-clan-profile.aspx?Gateway=" & scrim_myRealm & "&ClanTag=" & clan))
If InStr(web, "Creation Date:") > 0 Then
cscrim_CheckClanExists = 1
Else
cscrim_CheckClanExists = 0
End If
Else
Dsp 1, "Could not verify clan from Battle.Net.", BotVars.Username, vbGreen
cscrim_CheckClanExists = 0
End If
End Function


This post has been edited by The-Black-Ninja: May 21 2009, 07:38 PM


--------------------
IPB Image

-My Plugins :: Thanks Pyro :)
IPB ImageIPB Image
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
PhyzX
post May 21 2009, 10:15 PM
Post #15


Jr. Member
**

Group: Members
Posts: 54
Joined: 13-February 09
Member No.: 46,777



Wouldnt the bot get an error message saying that the user is not online or if the bot cannot whisper to the user currently. Otherwise just assume the user recieved the message.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
The-Black-Ninja
post May 21 2009, 10:22 PM
Post #16


Pure Sex
********

Group: Moderators
Posts: 7,756
Joined: 13-August 06
Member No.: 7,372



Here is all you get as far as knowing whether or not they got the message:
QUOTE
/w user message
'// Either
That user is not logged on.
'// OR
To user: message
What I was trying to say is that the way plugins work, if you want to whisper 4 people, the bot will whisper them as fast as possible, what spreads out the whisper is the bot's built-in flood protection. To the bot, if you say "whisper 5 people" the plugin says "okay *bam bam bam bam bam* i'm done, now what?", but in reality, the bot hasn't actually sent the whisper yet because of the queue system. If you have 5 clan reps that you need to whisper, the plugin will whisper all 5 reps and by the time the bot actually whispers them all, the plugin will already be wanting to display the message of who recieved it or not. Get what I'm saying? Unless you do some very tricky coding so that the plugin won't whisper the next person until it knows whether or not the previous person got the message or not, this isn't really worth the trouble.

This post has been edited by The-Black-Ninja: May 21 2009, 10:25 PM


--------------------
IPB Image

-My Plugins :: Thanks Pyro :)
IPB ImageIPB Image
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
PhyzX
post May 21 2009, 10:27 PM
Post #17


Jr. Member
**

Group: Members
Posts: 54
Joined: 13-February 09
Member No.: 46,777



ah, i get it now
will try out this plugin tonight!
Thanks Ninja, your the best wink.gif
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Sui(C)ide
post May 22 2009, 01:06 AM
Post #18


SuI[C]IdE's DotA Leage Plugin Author
***

Group: Members
Posts: 766
Joined: 23-April 09
From: Australia
Member No.: 49,768



If you want to learn how to do scripting, then I suggest do what i've been doing.
Go through each part of the script, and add small modifications and see what happens. Also, use the www.w3schools.com website for help with VBS.
All the best.


--------------------
IPB Image
Interested in joining an Aus/Nz DotA League? Come by Clan AIDL today, on UWEST.
You may visit our website Here.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
PhyzX
post May 28 2009, 05:39 AM
Post #19


Jr. Member
**

Group: Members
Posts: 54
Joined: 13-February 09
Member No.: 46,777



After trying out the script for a few days
I changed the following:

CODE

Dsp 3, "Clan " & scrim_myClan & " would like to scrim your team, contact " & username & " for more info.", ns.Fields(0), vbGreen
ns.MoveNext
Loop


so that it uses the username of the person using the command

and

i removed the Lcase from scrimadd and scrimedit
so that when ppl typed a clan name and username it records it properly

but how would change the scrimadd so that you can add a clan without a preferred contact?
(it can error when doing the scrim command saying theres no preferred contact)

Thanks
~PhyzX
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
The-Black-Ninja
post May 28 2009, 04:01 PM
Post #20


Pure Sex
********

Group: Moderators
Posts: 7,756
Joined: 13-August 06
Member No.: 7,372



It wouldn't be that easy, you would need to change how it looks to whisper the contacts when you want to scrim and when you want to ask it the preferred contacts for a clan. I'm not saying it can't be done, I'm just saying it's not a quick fix.


--------------------
IPB Image

-My Plugins :: Thanks Pyro :)
IPB ImageIPB Image
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 20th October 2014 - 06:29 PM
Skin by Andrea
Website Legal Information | Hosted by LunarPages