StealthBot.net: [Script] Want To Buy - StealthBot.net

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[Script] Want To Buy v1.1 r8

#1 User is offline   Novynn Icon

  • Silver Member
  • PipPipPipPipPip
  • Group: Senior Members
  • Posts: 873
  • Joined: October-07 09

Posted September 07, 2010 - 12:13 AM

Want To Buy
Created by Neco - Version 1.1 Revision 8


Description:
Originally created for wormy at his request.
This script provides a database which stores items that can be bought and sold. At the moment, users themselves handle the actual transaction but this may change soon to incorporate other scripts (like using SNJTrivia's cash).

Commands:
  • wts [item name] [description] - Adds your item to the database. If no arguments are given, it will respond with the items you are selling currently.
  • wtb [item name / item id] - Adds you to the "interested" list and informs the seller. If no arguments are provided, it will respond with a list of items currently being sold.
  • update [item name / item id] - Changes the items description. Requires ownership.
  • moreinfo [item name / item id] - Provides more information about an item.
  • remove [item name / item id] - Removes a single item that you are selling or if used on someone elses item, it will remove you interest in their item.
  • removeall - Removes all the items that you are currently selling.
  • clearitems - Removes all the items from the database.


Customizable Settings:
At the top of the script, there are a series of customizable options. They all of descriptions of what they do above them, but here's a list so you don't get confused:

Quote

' = Adds a message to the "whois" command. If the user has any items, it will add them to the response.
' Boolean Value: true or false
Private Const WHOIS_ADDON = False

' = Notifies the seller immediately when someone buys their item.
' Boolean Value: true or false
Private Const NOTIFY_IMMEDIATE = False

' = Notifies the seller on channel join.
' Boolean Value: true or false
Private Const NOTIFY_ONJOIN = True

' = Sends a message to the channel saying which items are being sold.
' Boolean Value: true or false
Private Const NOTIFY_PERIODIC = True
' = Interval (in seconds).
' Integer Value: Any whole number
Private Const NOTIFY_INTERVAL = 15
' = Set to "false" to have it not say anything if the list is empty.
' Boolean Value: true or false
Private Const NOTIFY_NOITEMS = False

' Only change this if needed
' String Value: any string in quotation marks
Private Const ITEMS_PATH = "Items.dat"


Notes:
Suggestions are welcome. With this system I've used it's easy to implement new features.
If you have used a previous version, you must remove the old script and remove all the commands it created manually via the command manager. If you fail to do this the script will not work and it will error.

Download:
Attached File  WTB.txt (17.25K)
Number of downloads: 116

#2 User is offline   The-Black-Ninja Icon

  • The Sex
  • Icon
  • Group: Scripting Moderators
  • Posts: 2,526
  • Joined: August-01 09

Posted September 07, 2010 - 12:30 AM

I added Neco as an item to buy and I got the error:

Quote

Error 934: Requested item cannot be obtained: item currently not for sale.


I demand an explanation.

#3 User is offline   Novynn Icon

  • Silver Member
  • PipPipPipPipPip
  • Group: Senior Members
  • Posts: 873
  • Joined: October-07 09

Posted September 07, 2010 - 12:46 AM

You cannot buy me, since I already own myself.

However, I can buy you perfectly fine! Mawhahahaha!

#4 User is offline   AwaKening Icon

  • how do ya like me now
  • Icon
  • Group: Scripting Moderators
  • Posts: 977
  • Joined: August-20 09

Posted September 08, 2010 - 04:26 PM

Suggestion in your code. You have some functions that would be much neater as properties

Yours:
Public Function Description()
        Description = iDescription
End Function

Public Function UpdateDescription(Text)
        iDescription = Text
End Function


I would do something like this:
Public Property Get Description()
        Description = iDescription
End Property

Public Property Let Description(Text)
        iDescription = Text
End Property



Would also be a great idea to use the SNJ Money database. Make sure you include code to build the database though in case the user doesn't have SNJ. It would be more useful and popular for sure. I want to put it in the official scripts, but I think you should use SNJ money Posted Image

#5 User is offline   Novynn Icon

  • Silver Member
  • PipPipPipPipPip
  • Group: Senior Members
  • Posts: 873
  • Joined: October-07 09

Posted September 08, 2010 - 07:55 PM

Yeah, I was originally using properties for things like that but then I couldn't actually see any good point about then... rather use just a public variable and change it like that.

Which I probably should of done for that.





I've been looking up about databases and frankly, they seem like a really bad way to store data. You do so much work just to do such a simple thing. Almost making me think of making my own database API...

This post has been edited by Neco: September 08, 2010 - 07:55 PM


#6 User is offline   The-Black-Ninja Icon

  • The Sex
  • Icon
  • Group: Scripting Moderators
  • Posts: 2,526
  • Joined: August-01 09

Posted September 08, 2010 - 08:19 PM

If you're using them to store like...3 things, then yeah, it's a waste, but if you're storing things like money and items and who has what, databases are great because you can store lots of information, sort by highest to lowest for top 5 people, blah blah blah.

I would've made a database for this, too. It's cleaner...and besides, who cares, we're all fast typers anyway ;)

#7 User is offline   Novynn Icon

  • Silver Member
  • PipPipPipPipPip
  • Group: Senior Members
  • Posts: 873
  • Joined: October-07 09

Posted September 08, 2010 - 08:22 PM

View PostThe-Black-Ninja, on 09 September 2010 - 09:19 AM, said:

If you're using them to store like...3 things, then yeah, it's a waste, but if you're storing things like money and items and who has what, databases are great because you can store lots of information, sort by highest to lowest for top 5 people, blah blah blah.

I would've made a database for this, too. It's cleaner...and besides, who cares, we're all fast typers anyway ;)

I hate using SQL. So ugly.

But the sorting is a good point, damn.

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users