Results 1 to 6 of 6

Thread: Require lua inbuilt modules on bot script files

  1. #1
    Basic Member
    Join Date
    Apr 2016
    Posts
    10

    Require lua inbuilt modules on bot script files

    How can we require lua inbuilt modules such as "io" in the bot scripting files?
    Every time I try this the game crashes, is there a specific way or is it not possible?
    Also can we require luarocks modules such as "http" or "json"?

  2. #2
    Basic Member
    Join Date
    Dec 2016
    Posts
    28
    You can't. Dota uses a secured Lua VM, with a stripped down version of require.

  3. #3
    Basic Member
    Join Date
    Mar 2012
    Posts
    1,532
    In order to use built in code, you need to use modes instead of takeovers. It only works for already implemented bots. io isn't one of them but you can use lion, ck, dp, cm, lina, venge, viper etc.
    Explanations on the normal, high and very high brackets in replays: here, here & here
    Why maphacks won't work in D2: here

  4. #4
    Basic Member
    Join Date
    Nov 2015
    Posts
    99
    Pretty sure he was not referring to the hero IO
    also
    Quote Originally Posted by The Nomad View Post
    ... It only works for already implemented bots ...
    It depends on what part of the built in code you are talking about. Everything default works for all heroes, except ability usage isn't programmed in. You can add a build for them in npc_heroes.txt and I think it will work except for using abilities. In my project I have it set up so that I have a 'build system' in ability_item_usage_generic that I call into from ability_item_usage_botname to level abilities and buy items and then you have to code in the bots ability usage in AbilityUsageThink() and all other default mode code will work for that bot, whether they are implemented by default or not.

  5. #5
    Basic Member
    Join Date
    Mar 2012
    Posts
    1,532
    Quote Originally Posted by ironmano View Post
    Pretty sure he was not referring to the hero IO
    Ah Well you can use the table, math and string functions already. You don't need to include them.
    I haven't tried (the non-bot ) io, but I am pretty sure they're restricted. os is missing since you aren't running in an OS VM, but rather a sandboxed (the game engine) VM.
    Explanations on the normal, high and very high brackets in replays: here, here & here
    Why maphacks won't work in D2: here

  6. #6
    you can just literally copy paste the json lua stuff into your project

    https://github.com/ThePianoDentist/t...geapi/json.lua

    (I took mine from https://github.com/Elinea/dota2-StorageAPI)

    they have also enabled CreateHTTPRequest in bot api, for localhost only, POST requests only.

    I could never get it to work.

    so for io I am just doing console dumps and parsing console logs with external files.

    edit: im working on some tools to help with this (and do other things) but theyr're a way from finished
    https://github.com/ThePianoDentist/d.../master/run.py

    so you can certainly get/set up outbound io. but dont think it will ever be possible for bot to read from disk or requests
    Last edited by TheP1anoDentist; 03-16-2017 at 06:44 AM.
    https://github.com/ThePianoDentist/t...dentistdotabot Lina bot which pulls small camp when 'laning' (Aim to work on pulling and stacking bots initially)
    https://github.com/ThePianoDentist/dotabots-ml-tools Parsing data from bot games

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •