Netheouz
01-16-2014, 11:20 PM
Hello.
I'll start off with the fact that XenoBot is my favourite bot and I am really enjoying writting my own scripts for it.. but.. it's missing several features (mostly lua functions) I would like to ask for.
I'll put it in a form of list, so you can just point it out and tell me what you think.
1. Functions:
1.1 Self.Skills() returning a table of skills (skillName, skillLevel, skillProgress) -- I know this was suggested already, but just wanted to make sure things it should return are also considered
1.2 somePosition:ToScreen(), someScreenPos:ToPos() -- Would be nice to have this, because then we can create HUDs that show text at some dynamic position (like HUD that shows "Elder Druid" above someone's head)
1.3 More options for items such as (mostly self-explanatory):
Item.Weight()
Item.CanPickup()
Item.TimeLeft() -- for rings, soft boots etc.
Item.LevelRequirement()
Item.ProfessionRequirement()
Item.Defense()
Item.Attack()
Item.BonusMagicLevel()
Item.BonusResistance()
Item.BonusSkill()
Item.BonusSpeed()
-- or istead of all these releated to stat bonuses:
Item.BonusStats()
1.4 Timers: -- instead of clumsy wait() that affects the whole code
timer.Start( timerName, time, repetitions, funcCallback ) -- timerName would be for stopping the timer before it's time passes using timer.Stop()
timer.Stop( timerName )
1.5 GUI Library (because... why not let us make own gui? For example: for configuration):
gui.New( name, type ) -- where name is used for gui.Open() and type could be: text, itemSlot, list, button, slider, text-input, number-input
gui.Open( name )
gui.Close( name )
1.6 Additions to Self library:
Self.QuestProgress( quest ) -- because Xenobot is mostly for afking right? Why not expand it's features by ability to track/do quests?
1.7 Additions to Global library:
mousePosition() -- Combined with :ToPos() it might become useful for configuring stuff such as casino (aiming at depo and typing !setrollingplace instead of modifying config each time)
ScrW(), ScrH() -- because it would make scripting so much easier
There are only few functions that I've suggested, but each of them will create new possibilities.
Now the last thing I would like to suggest is hooks.. yes I know that there is a thing like Module library but it's lacking all the neccessary features and seem to be a cheap replacement for an infinite loop.
At beginning I would like to explain what hooks are (based on hooks for a game called Garry's Mod which has insanely expanded lua, you can check for yourself (I hope I won't get banned for linking):Garry's Mod Lua Wiki (http://wiki.garrysmod.com/page/Main_Page))
-Hook is something you can use to tell your engine when to run a certain function and what info to pass it
-Hooks are insanely simple, they look like this: hook.Add( 'SomeEventHere', 'Description of the hook', funcCallback ) -- where 'SomeEventHere' can be anything like 'OnPlayerDamaged', 'OnDepositOpened', 'OnCreatureKilled', 'OnRuneUsed' and so on.
-Hooks are only executed at certain event, so some things that were impossible before or required infinite loop to work will now work without using so much RAM.
-Hooks can pass arguments which creates a lot of possibilities.
So now that you know what hooks are (or atleast have a minor knowledge of it), I would like you to imagine 2 situations:
1st: Creating a script that tells us how much damage and what type of damage we dealt to a creature (without hooks)
2nd: Creating a script that tells us how much damage and what type of damage we dealt to a creature (with hooks)
This is what it would look like:
1st:
-You would have to create an infinite loop that checks if we have any creature targetted and then check each frame if it's health has changed which wouldn't be 100% accurate because others might have dealt some damage to the creature or the creature was burning etc.
-Then you would have to print the result, which can change any second because the infinite loop is still looping
2nd:
-You would have to create a function that prints the damage using arguments: attacker, victim, damage, damageType
-You would have to create a hook applied to the above function using this simple function: hook.Add( 'OnCreatureDamaged', 'Print the damage', ourPrintingFunction ) and the hook would pass all neccessary arguments to the function with no problems.
If that's not enought, here is my list of pros:
-No infinite loop, less RAM consuming
-More possibilities, since there are no functions such as Creature:GetLastDamage() or Creature:GetTypeOfLastDamage() that you could use and even if there were, they would also be very inconvenient
-Less code, easier to understand
Make sure to post your opinion, thoughts and such.
Sorry if I failed at grammar at some point. English is not my native language and I am doing my best to improve my grammatics.
I'll start off with the fact that XenoBot is my favourite bot and I am really enjoying writting my own scripts for it.. but.. it's missing several features (mostly lua functions) I would like to ask for.
I'll put it in a form of list, so you can just point it out and tell me what you think.
1. Functions:
1.1 Self.Skills() returning a table of skills (skillName, skillLevel, skillProgress) -- I know this was suggested already, but just wanted to make sure things it should return are also considered
1.2 somePosition:ToScreen(), someScreenPos:ToPos() -- Would be nice to have this, because then we can create HUDs that show text at some dynamic position (like HUD that shows "Elder Druid" above someone's head)
1.3 More options for items such as (mostly self-explanatory):
Item.Weight()
Item.CanPickup()
Item.TimeLeft() -- for rings, soft boots etc.
Item.LevelRequirement()
Item.ProfessionRequirement()
Item.Defense()
Item.Attack()
Item.BonusMagicLevel()
Item.BonusResistance()
Item.BonusSkill()
Item.BonusSpeed()
-- or istead of all these releated to stat bonuses:
Item.BonusStats()
1.4 Timers: -- instead of clumsy wait() that affects the whole code
timer.Start( timerName, time, repetitions, funcCallback ) -- timerName would be for stopping the timer before it's time passes using timer.Stop()
timer.Stop( timerName )
1.5 GUI Library (because... why not let us make own gui? For example: for configuration):
gui.New( name, type ) -- where name is used for gui.Open() and type could be: text, itemSlot, list, button, slider, text-input, number-input
gui.Open( name )
gui.Close( name )
1.6 Additions to Self library:
Self.QuestProgress( quest ) -- because Xenobot is mostly for afking right? Why not expand it's features by ability to track/do quests?
1.7 Additions to Global library:
mousePosition() -- Combined with :ToPos() it might become useful for configuring stuff such as casino (aiming at depo and typing !setrollingplace instead of modifying config each time)
ScrW(), ScrH() -- because it would make scripting so much easier
There are only few functions that I've suggested, but each of them will create new possibilities.
Now the last thing I would like to suggest is hooks.. yes I know that there is a thing like Module library but it's lacking all the neccessary features and seem to be a cheap replacement for an infinite loop.
At beginning I would like to explain what hooks are (based on hooks for a game called Garry's Mod which has insanely expanded lua, you can check for yourself (I hope I won't get banned for linking):Garry's Mod Lua Wiki (http://wiki.garrysmod.com/page/Main_Page))
-Hook is something you can use to tell your engine when to run a certain function and what info to pass it
-Hooks are insanely simple, they look like this: hook.Add( 'SomeEventHere', 'Description of the hook', funcCallback ) -- where 'SomeEventHere' can be anything like 'OnPlayerDamaged', 'OnDepositOpened', 'OnCreatureKilled', 'OnRuneUsed' and so on.
-Hooks are only executed at certain event, so some things that were impossible before or required infinite loop to work will now work without using so much RAM.
-Hooks can pass arguments which creates a lot of possibilities.
So now that you know what hooks are (or atleast have a minor knowledge of it), I would like you to imagine 2 situations:
1st: Creating a script that tells us how much damage and what type of damage we dealt to a creature (without hooks)
2nd: Creating a script that tells us how much damage and what type of damage we dealt to a creature (with hooks)
This is what it would look like:
1st:
-You would have to create an infinite loop that checks if we have any creature targetted and then check each frame if it's health has changed which wouldn't be 100% accurate because others might have dealt some damage to the creature or the creature was burning etc.
-Then you would have to print the result, which can change any second because the infinite loop is still looping
2nd:
-You would have to create a function that prints the damage using arguments: attacker, victim, damage, damageType
-You would have to create a hook applied to the above function using this simple function: hook.Add( 'OnCreatureDamaged', 'Print the damage', ourPrintingFunction ) and the hook would pass all neccessary arguments to the function with no problems.
If that's not enought, here is my list of pros:
-No infinite loop, less RAM consuming
-More possibilities, since there are no functions such as Creature:GetLastDamage() or Creature:GetTypeOfLastDamage() that you could use and even if there were, they would also be very inconvenient
-Less code, easier to understand
Make sure to post your opinion, thoughts and such.
Sorry if I failed at grammar at some point. English is not my native language and I am doing my best to improve my grammatics.