The Edge of Nowhere Forum Index
The Edge of Nowhere
Looking for a new game to play? Check out our Heroes of Newerth forum!
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Home | Forums | IRC | BHFiles

New Testing Core
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    The Edge of Nowhere Forum Index -> D2BS Help/Support
Author Message
lord2800
Section Leader
Section Leader


Joined: 05 Jul 2002
My Posts
Location: /sbin/
PostPosted: Tue May 20, 2008 2:45 pm    Post subject: New Testing Core Reply with quote

Well, after finally figuring out how to compile d2bs, and a several day coding spree, I've managed to fix a whole shitload of problems as well as add a few new nifty features.

Fixes:
  • The goddamn toolsthread stoppage in NTBot is finally fucking fixed. In fact, scripts randomly stopping in general has been fixed.
  • unit.fname and item-related-friends return undefined on units that aren't items. Finally.
  • All outstanding compiler errors with the latest SVN source are fixed.
  • print now outputs "undefined" if you call it with an undefined value, instead of printing nothing.
  • version(1) now returns the version number as a string, instead of attempting to cast it to an int.
  • Fixed minor misspellings in various warnings, removed some really stupid warnings that don't need to exist.


Additions:
  • Added local storage via SQLite. See below for the API.


TODO:
  • Convert all instances of JS_ReportWarning and JS_ReportError to JS_SetPendingException, so the script can handle the bad data instead of just dying.
  • Redesign the object model to take advantage of JS_InitClass instead of a set of functions to init classes.
  • Anything else?


The patch below applies cleanly to the latest SVN copy of d2bs. I won't be committing any of this to the repository just yet, I want to get Sheppard's approval before I do. This unofficial version changes the version number to 0.9.0.4-jh. If you see that in game, you're running my version.

Unofficial DLL: http://getirc.net/d2bs/d2bs.zip
Unofficial patch: http://getirc.net/d2bs/d2bs.patch

SQLite API:
  • SQLite object:
    This object is what you create to get at a database. Takes two parameters: The name of a database file, and a true/false indicating whether or not to automatically or wait for you to open the database.

    • Functions:
      • boolean SQLite.execute(string SQL)
        Execute a simple query and ignore the results. Takes just one parameter: The SQL to execute.
      • SQLiteStatement SQLite.query(string SQL, ...)
        Create a prepared statement and optionally bind parameters to it. Takes N parameters: The first must be the SQL to execute, and any parameters after that are automatically bound to their correspondingly numbered entries in the query.
      • boolean SQLite.open()
        Open the database, if not already opened.
      • boolean SQlite.close()
        Close the database, if not already closed.

    • Properties:
      • string SQLite.path
        The path to the current database file. Read only.
      • boolean SQLite.isOpen
        A boolean indicating whether or not the database is currently open.
      • array SQLite.statements
        An array of open SQLiteStatement objects.



  • SQLiteStatement object:
    The result of a call to SQLite.query. This represents some SQL that you can execute and get results from.

    • Functions:
      • boolean SQLiteStatement.bind(int column, variable value)
        Binds the specified parameter to the specified placeholder. Only numbered parameters are currently bound, name parameters will come later. Takes two arguments: the number of the placeholder to bind to, and the value to bind to it.
      • boolean SQLiteStatement.go()
        Execute the query and immediately close it. This is useful if you want to have bound parameters, which means you can't call SQLite.execute.
      • boolean SQLiteStatement.next()
        Move to the next result. This function must be called before any of the get* functions.
      • int SQLiteStatement.getColumnCount()
        Gets the number of columns in the resulting query. Must be called after SQLiteStatement.next or SQLiteStatement.skip.
      • string SQLiteStatement.getColumnName(int column)
        Gets the name of the specified column. Takes a single int argument specifying the column number. Must be called after SQLiteStatement.next or SQLiteStatement.skip.
      • variable SQLiteStatement.getColumnValue(int column)
        Gets the value of the specified column. Takes a single int argument specifying the column number. Must be called after SQLiteStatement.next or SQLiteStatement.skip.
      • int SQLiteStatement.skip(int numResults)
        Skip the specified number of results. Returns the number of actual records skipped. If the number skipped is less than the number specified, you've reached the end of the results (and you can't call any of the get* functions).
      • boolean SQLiteStatement.reset()
        Reset the results back to the beginning. After calling this, you must call SQLiteStatement.next to get to the first result.
      • boolean SQLiteStatement.close()
        Close the results handle. This also sets the object to null.

    • Properties:
      • string SQLiteStatement.sql
        The SQL string this statement represents.
      • boolean SQLiteStatement.ready
        A boolean indicating whether or not the statement has been executed and results are available.



  • Global functions:
    • string sqlite_version()
      Returns the version number of the SQLite library (currently 3.5.9).



As an example, here's the script I used to test the library:
Code:
function main() {
   print('opening and inserting values into db');

   var mydb = new SQLite(":memory:");
   mydb.execute("CREATE TABLE IF NOT EXISTS temp (id INTEGER PRIMARY KEY AUTOINCREMENT, val TEXT NOT NULL);");
   mydb.query("INSERT INTO temp (val) VALUES (?);", me.name).go();

   var res = mydb.query("SELECT id, val FROM temp;");
   res.next();
   print('printing the result');
   print('number of columns: ' + res.getColumnCount());
   for(var i = 0; i < res.getColumnCount(); i++)
      print(res.getColumnName(i) + ": " + res.getColumnValue(i));

   var obj = res.getObject();
   print('result object: '+obj.toSource());
   for(var i in obj)
      print(i + ': ' + obj[i]);
   res.close();

   res = mydb.query("UPDATE temp SET val = ? WHERE id = 1;");
   res.bind(1, "test");
   res.next();

   print("printing the new result");
   print('result object: ' + res.getObject().toSource());

   print('closing stuff');
   res.close();
   mydb.close();

   print('done');
}


Last edited by lord2800 on Tue May 20, 2008 8:29 pm; edited 2 times in total
Back to top
ario
User
User


Joined: 30 Dec 2002
My Posts

PostPosted: Tue May 20, 2008 3:06 pm    Post subject: Reply with quote

Great work.
Back to top
texasyoungin
User
User


Joined: 07 Apr 2008
My Posts

PostPosted: Wed May 21, 2008 12:43 am    Post subject: Reply with quote

ario wrote:
Great work.


Just to be sure...It's not realm ready right?
Back to top
BlizzFoX
User
User


Joined: 09 Mar 2008
My Posts

PostPosted: Wed May 21, 2008 1:33 am    Post subject: Reply with quote

Error :/



?
Back to top
Regicide
User
User


Joined: 18 Feb 2007
My Posts

PostPosted: Wed May 21, 2008 2:00 am    Post subject: Reply with quote

Is the stashing fixed? Or at least reverted back to 0.9.0.2 stashing (height 4 bug).

Also, thanks a lot for this. I really appreciate you and Sheppard working on a bot that is free, all of my botters have found me nice things since I've been using d2bs.

If I knew your jsp I might donate some fg the next time I sell some bot finds.

Edit: hm I tried replacing 0.9.0.2 with your version, but it doesn't get passed log in screen. Oh well :/
Back to top
dd-juhu
User
User


Joined: 16 Apr 2008
My Posts

PostPosted: Wed May 21, 2008 3:36 am    Post subject: Reply with quote

BlizzFoX wrote:
Error :/



?



same error here, did you change the function lord?

[Edit] Got it fixed by simply removing the () , but now i get another error



there i cant remove the () because where the function is, it's needed.
Code:
   if( _x || _y ) {
            control.click( _x, _y );
         } else {
            control.click( );
         }


Last edited by dd-juhu on Wed May 21, 2008 4:23 am; edited 3 times in total
Back to top
Regicide
User
User


Joined: 18 Feb 2007
My Posts

PostPosted: Wed May 21, 2008 3:54 am    Post subject: Reply with quote

Mine doesn't even get to the char select screen. It just goes to login screen and stops
Back to top
dd-juhu
User
User


Joined: 16 Apr 2008
My Posts

PostPosted: Wed May 21, 2008 4:14 am    Post subject: Reply with quote

Regicide wrote:
Mine doesn't even get to the char select screen. It just goes to login screen and stops


did you remove the old d2bs.dll? does it write 9.0.4-jh at the top?
Back to top
Cyrre
User
User


Joined: 21 Jul 2005
My Posts

PostPosted: Wed May 21, 2008 4:54 am    Post subject: Reply with quote

dd-juhu wrote:
Regicide wrote:
Mine doesn't even get to the char select screen. It just goes to login screen and stops


did you remove the old d2bs.dll? does it write 9.0.4-jh at the top?


Got same prob (wont load at all).. Did remove old, dont write version number at all. :S
Replace with older version and it loads just fine.

Something special I'm missing with this version?
Back to top
lord2800
Section Leader
Section Leader


Joined: 05 Jul 2002
My Posts
Location: /sbin/
PostPosted: Wed May 21, 2008 11:57 am    Post subject: Reply with quote

I didn't test it with NTBot, but somehow it's not surprising at all to me that NTBot doesn't work with it. I didn't change a single thing in the oog stuff, so these are bugs that have existed in NTBot's code since well before now. The most likely problem is that it doesn't actually check to make sure it got a control before attempting to use it.
Back to top
Whiteevil
User
User


Joined: 08 Feb 2007
My Posts

PostPosted: Wed May 21, 2008 12:35 pm    Post subject: Reply with quote

Well it's not doing anything for lots of ppl.

Not printing a version etc
Back to top
lord2800
Section Leader
Section Leader


Joined: 05 Jul 2002
My Posts
Location: /sbin/
PostPosted: Wed May 21, 2008 4:25 pm    Post subject: Reply with quote

Regicide wrote:
Is the stashing fixed? Or at least reverted back to 0.9.0.2 stashing (height 4 bug).


Stashing has been fixed in the official core for quite some time now.

For those of you having problems loading it: Please get ahold of me on IRC. It's much easier and faster for me to deal with whatever problems you're having on there than it is to try and diagnose them through here.
Back to top
Saytun
User
User


Joined: 24 Aug 2004
My Posts
Location: ‬‭‮‪‫‬‭‮‫‬‭‮‪‫‬‭‮‫‬‭‮‪‫‬‭‮‫‬‭‮‪‫‬ï
PostPosted: Wed May 21, 2008 7:19 pm    Post subject: Reply with quote

Is there any current effort to build a new script to replace NTBot? It seems that a good 80% of the issues with D2BS are because NTBot is poorly made and every update of the D2BS core breaks something or other in it.
Back to top
lord2800
Section Leader
Section Leader


Joined: 05 Jul 2002
My Posts
Location: /sbin/
PostPosted: Wed May 21, 2008 7:36 pm    Post subject: Reply with quote

I've been working on a replacement called simplebot, but I haven't had time to seriously sit down and work on it between real life stuff, my own existing library bugs, and now core bugs.

For those of you having problems with it loading at all, search on your computer and let me know if you have MSVCR90.dll. I suspect the problem lies there.

[EDIT] Ok, MSVCR90.dll missing is definitely the problem. Download it from whatever source you trust and place it in your system32 folder, the same place your js32.dll should be. The official Microsoft package for it is at: http://www.microsoft.com/downloads/details.aspx?familyid=9B2DA534-3E03-4391-8A4D-074B9F2BC1BF&displaylang=en
(NOTE: This package does NOT, however, place it in the correct location)
Back to top
dd-juhu
User
User


Joined: 16 Apr 2008
My Posts

PostPosted: Thu May 22, 2008 3:59 am    Post subject: Reply with quote

Umpf, i wanted to work over NTBot today... but my account password got changed, filled the retrieve thing out, but i dont think ill get it back, seems like i'm out...

Lord, it looks like ill go your way and play singleplayer ,

the errors which i posted, i think kimsout integrated something own in his version.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    The Edge of Nowhere Forum Index -> D2BS Help/Support All times are GMT - 5 Hours
Goto page 1, 2, 3  Next
Page 1 of 3

 


Donations this month: $120
Server cost this month: $120
Surplus Donations: $243 (2 months)

Donators this month: BenOwns, m3flow, crazyguy2005, TriiT, mbundy, pcgamer4life, parajumper, HEMULI, Alister, fallore, ZepherX, iLikeDixLOL, dsa, fobic, wootie, fbu, KaRdOoShI, youngstar2, ByTeMe, jj!, zonic, cruciform, Ninjai, Dr.Duck



Spelling by SpellingCow.

blueGray theme by Nuttzy     One of the largest message boards on the web !


membersemails