Help - Search - Members - Calendar
Full Version: Lists Plugin
StealthBot.net > StealthBot > Scripting and Plugins > Plugin Projects
SmokeDaCaliDoja
So I was thinking about the idea of a lists plugin (got the idea from Hero.A tongue.gif.) Like a plugin that stores each list inside a separate text file that you can manually edit or use commands to modify:

Example commands:
CODE
   mYnAmEsCoOl: .createlist hosts Holds a list of known hosts.
   Bot: A hosts list has been created.
   mYnAmEsCoOl: .additem hosts mYnAmEsCoOl
   Bot: 'mYnAmEsCoOl' has been added to the hosts list.
I also have this idea of a config file that holds information and settings for each list.

So I'll see what you guys post and see if this is worth creating and if anybody would like to help or contribute some ideas.
Hero.A
Jacker!!!! tongue.gif

I already started it. It was a disaster. I might work together with you to redo it. Just doing my dota script gets endlessly boring (Only doing my dota script as in my only stealthbot project .. I am making ads for a company (flash ones!!) $25 each!!! and other shit such as websites and of course those normal teen things (-Girls!-))

Yeah yeah yeah. If you read all that you are a fool. I will help though -- thoughts
CODE

.addlist <list name>
Adds a list
.list <listname> --mcount <max count>
The list cannot have more than max count valuies
.list <listname> --clear
Clears a list
.remlist <listname>
Removes a list -- Diferent than clearing
.additem <listname> <item>
Adds an item
.item <listname> <item> --value <value>
allows you to add values
.ll <item> --add
Adds an item to the last list used
.ll <item> --rem
Removes an item from the last list used
.ll --clear
Clears last list used
.ll --del
Deletes last list used
.ll <item> <value> --set
Sets an item on the last list to value


I would be delighted! to do all the settings and command input. You can start writing some sexy code.
SmokeDaCaliDoja
Well it may be the same concept but I had a bit more in mind! smile.gif
CODE
[List:testList]
Description=List for testing.
TimeCreated=4/2/2008 2:08:56 PM
LastAction=created
LastActionTime=4/2/2008 2:08:56 PM
LastActionBy=[inbot]
MaxItems=0
RemoveAtMax=False
CaseSensitive=False
DuplicateItems=True

Plus you said I could use your idea once. biggrin.gif
Hero.A
1. Duplicate Items ?
2. Those look good. So INI for info on list? Then a seperate INI for each list. Or do you want to store each list in a txt
SmokeDaCaliDoja
Duplicate items like you can have the same item on one list.

And I was thinking maybe one config file that stores the info on the lists and each list is stored in a seperate text file.
Hero.A
Sounds good to me, Ill start working on some of that stuff tonight.
SmokeDaCaliDoja
QUOTE(Hero.A @ Apr 2 2008, 05:54 PM) *

Sounds good to me, Ill start working on some of that stuff tonight.

What stuff you gonna do again so we can start on it? smile.gif
Hero.A
Updated Code - Removed older stuff
With Indents -- http://pastecode.com/?show=f1524d3c1
CODE

'ls
'0.2
'&List System:Hero.A and SmokeDaCaliDoja:Manages lists in advanced ways
'&
'&32345
'&Makes use of -- commands.:Thanks to people who gave ideas!

Public Const ls_col = "FFCC77"
Public ls_lists_path, ls_ls_path, ls_listinfo_path
Public lsFSO

Set lsFSO = CreateObject("Scripting.FileSystemObject")

ls_lists_path = BotPath() & "LS\Lists"
ls_ls_path = BotPath() & "LS"
ls_listinfo_path = BotPath() & "LS\ListInfoandOptions.INI"

'*********
'To Smoke
'*********
'Added ability to Enabled/Disable lists


'*********
'TO DO -
'*********
'Lots

'**********
'CHANGELOG -
'**********
'Not doing this yet


Sub ls_Event_Load()
AddChat ls_col, "Welcome to the List System Ver. " & ls_ver & " By Hero.A and SmokeDaCaliDoja"
If GetSetting("ls", "FirstLoad") = vbNullString Then
AddChat ls_col, "First time load detected..."
AddChat ls_col, "Creating base settings..."
'Blah blah blah
'All the commands here
'all the access here
SetSetting "ls", "Lists Folder Path", ls_lists_path
SetSetting "ls", "LS Folder Path", ls_ls_path
SetSetting "ls", "LS Lists Options and Info Path", ls_listinfo_path
AddChat ls_col, "Done adding base settings!"
AddChat ls_col, "Creating needed files..."
If Not lsFSO.FolderExists(ls_ls_path) Then
lsFSO.CreateFolder ls_ls_path
If lsFSO.FolderExists(ls_ls_path) Then
AddChat ls_col, "Created LS Folder"
Else
AddChat vbRed, "Failed to create LS Folder"
End If
End If
If Not lsFSO.FolderExists(ls_lists_path) Then
lsFSO.CreateFolder ls_lists_path
If lsFSO.FolderExists(ls_lists_path) Then
AddChat ls_col, "Created LS Lists Folder"
Else
AddChat vbRed, "Failed to create LS Lists Folder"
End If
End If
If Not lsFSO.FileExists(ls_listinfo_path) Then
lsFSO.CreateFile ls_listinfo_path
If lsFSO.FileExists(ls_listinfo_path) Then
AddChat ls_col, "Created List Info File"
Else
AddChat vbRed, "Failed to create List Info File"
End If
End If
AddChat ls_col, "Completed adding needed files"
End If
'Load all the settings
ls_ls_path = GetSetting("ls", "LS Folder Path")
ls_lists_path = GetSetting("ls", "Lists Folder Path"
ls_listinfo_path = GetSetting("ls", "LS Lists Options and Info Path")
AddChat ls_col, "Loaded settings successfully"
End Sub

Class ListManager
Private lmFSO

Private Sub Class_Initialize
Set lmFSO = CreateObject("Scripting.FileSystemObject")
End Sub

'Adds an item to a list
'0 Success
'-1 Not Enabled
'-2 Duplicate
Public Function AddItem(List_name, Item_name, Item_des, Adder)
If GetConfigEntry(List_name, "Enabled", ls_listinfo_path) <> "True" Then
AddItem = -1
Exit Sub
End If
Dim lmStream
Set lmStream = lmFSO.OpenTextFile(ls_lists_path & "\" & List_name & ".txt", 1)
Do While Not lmStream.AtEndOfStream
Dim line
line_s = Split(lmStream.ReadLine)
If line_s(0) = Item_name Then
If GetConfigEntry(List_name, "Duplicate Items", ls_listinfo_path) = "False" Then
AddItem = -2
Exit Sub
End If
End If
Loop
lmStream.Close
Set lmStream = lmFSO.OpenTextFile(ls_lists_path & "\" & List_name & ".txt", 8)
lmStream.WriteLine Trim(Item_name) & " = " & Trim(Item_des)
lmStream.Close
WriteConfigEntry List_name, "Last Action", "Added Item " & Item_name, ls_listinfo_path
WriteConfigEntry List_name, "LastActionTime", Now(), ls_listinfo_path
WriteConfigEntry List_name, "LastActionBy", Adder, ls_listinfo_path
AddItem = 0
End Function

'Removes a list
'0 Success
'-1 No such list
'-2 Not creator or bot
Public Function RemList(List_name, Deleter)
If GetConfigEntry(List_name, "Enabled", ls_listinfo_path) = vbNullString Then
RemList = -1
Exit Sub
End If
If Deleter <> BotVars.Usernamer AND Deleter <> GetConfigEntry(List_name, "Creator", ls_listinfo_path) Then
RemList = -2
Exit Sub
End If
If lmFSO.FileExists(ls_lists_path & "\" & List_name & ".txt") Then
lmFSO.Delete ls_lists_path & "\" & List_name & ".txt"
Else
RemList = -1
Exit Sub
End If

WriteConfigEntry List_name, "Description", Description, ls_listinfo_path
WriteConfigEntry List_name, "Creator", vbNullString, ls_listinfo_path
WriteConfigEntry List_name, "Time Created", vbNullString, ls_listinfo_path
WriteConfigEntry List_name, "Last Action", "Removed", ls_listinfo_path
WriteConfigEntry List_name, "LastActionTime", Now(), ls_listinfo_path
WriteConfigEntry List_name, "LastActionBy", Deleter, ls_listinfo_path
WriteConfigEntry List_name, "Max Items", vbNullString, ls_listinfo_path
WriteConfigEntry List_name, "Overwrite On Max", vbNullString, ls_listinfo_path
WriteConfigEntry List_name, "Case Sensitive", vbNullString, ls_listinfo_path
WriteConfigEntry List_name, "Duplicate Items", vbNullString, ls_listinfo_path
RemList = 0

End Function

'Adds a list
'0 New List Created
'1 Overwrote Old
Public Function AddList(List_name, Creator, Description)

If lmFSO.FileExists(ls_lists_path & "\" & List_name & ".txt") Then AddList = 1

lmFSO.CreateTextFile ls_lists_path & "\" & List_name & ".txt", True
'True to overwrite an old one!! Advised to do a listexists first!

WriteConfigEntry List_name, "Description", Description, ls_listinfo_path
WriteConfigEntry List_name, "Creator", Creator, ls_listinfo_path
WriteConfigEntry List_name, "Time Created", Now(), ls_listinfo_path
WriteConfigEntry List_name, "Last Action", "Created", ls_listinfo_path
WriteConfigEntry List_name, "LastActionTime", Now(), ls_listinfo_path
WriteConfigEntry List_name, "LastActionBy", Creator, ls_listinfo_path
WriteConfigEntry List_name, "Max Items", -1, ls_listinfo_path
WriteConfigEntry List_name, "Overwrite On Max", "True", ls_listinfo_path
WriteConfigEntry List_name, "Case Sensitive", "False", ls_listinfo_path
WriteConfigEntry List_name, "Duplicate Items", "False", ls_listinfo_path
If AddList <> 1 Then AddList = 0
End Function

'Does a list exist
'0 Found and Enabled
'-1 Not Found
'-2 Not Enabled
'-3 Not found but enabled
Public Function ListExists(List_name)
Dim lmFold, doc
ListExists = -1
Set lmFold = lmFSO.GetFolder(ls_lists_path)
For Each doc In lmFold.Files()
If Mid(Doc, Len(Doc) - 4) = List_name Then
ListExists = 0
End If
Next
Select Case GetConfigEntry(listname, "Enabled", ls_listinfo_path)
Case "False":
ListExists = -2
Case "True":
If ListExists <> 0 Then
ListExists = -3
End If
End Select
End Function
End Class
SmokeDaCaliDoja
Updated.
http://pastecode.com/?show=m3275eeca
SmokeDaCaliDoja
Small Update.
http://pastebin.com/m310255bc
SmokeDaCaliDoja
Ok, it appears Hero.A has stopped working on this, so in his absence I will continue to work on this. Does anybody have any feedback or ideas that could help improve this plugin.
Hero.A
Lol I was waiting for you. Then got bored and worked on it last night tongue.gif
http://pastebin.com/m32e821f2
DaRK_IMMoRTAL
wait a minute. this will store last known hosts who ran in channel? will you please add in a global message command to message last known runners? (good for reminders, or etc.) (bot should whisper people about hosting)

this would be extremely useful if this was compatible with bcp plugin. as in, when a user decides to host by typing ".login" and hosting a game (with names like chaos, baal, cow, trist, tomb etc)

major thanks in advance. and others im sure who would be using this plugin. happy.gif"
JPT
QUOTE(DaRK_IMMoRTAL @ Aug 19 2008, 02:28 AM) *

wait a minute. this will store last known hosts who ran in channel? will you please add in a global message command to message last known runners? (good for reminders, or etc.) (bot should whisper people about hosting)

this would be extremely useful if this was compatible with bcp plugin. as in, when a user decides to host by typing ".login" and hosting a game (with names like chaos, baal, cow, trist, tomb etc)

major thanks in advance. and others im sure who would be using this plugin. happy.gif"
I believe the goal of this was to create a list you could customize, manually edit, and manage through commands. The hosts' list was just an example of how it could have been used.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2019 Invision Power Services, Inc.