This thread is for the discussion of the scripter's variables, functions, and events. You can find the original thread here: http://forums.xenobot.net/showthread...ons-and-Events
Printable View
This thread is for the discussion of the scripter's variables, functions, and events. You can find the original thread here: http://forums.xenobot.net/showthread...ons-and-Events
You're doing a nice job with it dude. I hope it has much functions and variables as neobot, but i can expect even more than neo.
keep it.
Do, what you do best. I'm w8ing for this bot.
Seems weird to be using methods instead of properties.
Don't understand shit right now. But I think you know what you're doing.
Keep it up
Looks sweet imo,
=o so will it be possible for the bot to invite a player to party / join a party?
Nice to see that the scripter idea is getting improved.
But it seems to be lill' bit complicate by now like NG was. To realize a couple of functions it would take so much lines of "programming" and it seems to be a LOT limited too i think that a good idea is export some idea from neo libraries and take some functions like "pickupitems" "auto" "dropitemsxyz" "ifattacked" these things.
Btw, gz for nice job.
Att.,
.Position returns a table or what? Numeric indexes?
Also, what about pre-defined creature objects, such Self, Target, Followed, etc...
If I'm not mistaken they already exist.
this are the relational properties. (can be found on the Creature.lua or Jo3 post)
an example of using this variables would be.. (using Jo3 example)Code:Creature:isSelf()
Creature:isTarget()
Creature:isFollowed()
Again if im not mistaken.
If everything is fine then Jo3 will die.Code:local creature = Creature.GetByName("Jo3Bingham")
if (creature:ID() ~= 0) then
if (creature:isTarget() and creature:WarIcon()) then
----use spell or rune
end
end
Nope, you're a little wrong.
By using those functions you currently only check if creature is you itself, your target or creature that you follow.
He had in mind something like $self, $target, $attacked, $followed in neobot. Those variables was returning creature pointers.
Also I want to know if there will be some variable or loop like in neobot that would be returning all creatures (players/monsters/npc's) from screen (all floors)?
Atm i think I'm correct.
I'll use the same script but with line comments to point out what's happening. (on my opinion)
I personally thing that way, I might be wrong but, for undestranding always a new lengauge I need an script with comment lines that's pointing out what's happening, I have used LUA on Ot's and on Neobot but those " : " are confusing me alot.Code:local creature = Creature.GetByName("Jo3Bingham") -- creature = Jo3Bingham
-- first If statement is checking the "creature:ID" which means Jo3Bingham ID's, example: Jo3Bingham:ID()
if (creature:ID() ~= 0) then
-- sencond If statement is cheking that , Jo3Bingham:isTarget() and Jo3Bingham:WarIcon()
if (creature:isTarget() and Creature:WarIcon()) then
----use spell or rune
end
end
sirmate, try to point out what's happening on this script for me to understand your way of viewing this script.
But while you exp your target changes it's not always the same. If you used NeoBot then you should know how $target pointer works.
Here is my example.
Code:local Target = Creature.GetByID(getSelfTargetID())
if (Target:Name():lower() == 'wyrm' and Target:HealthPercent() >= 10 and Target:isAdjacent()) then
--[[ CAST EXORI ICO ]]--
end
I don't use neo but I did, Was completely GUI-less, Not atractive.
Bot's are my baby bitches, Neo bot was ugly as hell, but was able to move very nice. (you know what I mean)
I don't know who is correct, me or you, or maybe both are, or maybe just you. (But I think Im wrong, for sure lmao xD)
I just can't wait for the scripter!
So I'm making non-sence scripts :)
There is no fkn GetSelfId() or GetTargetId().
noob
No dude, this only checks if the creature pointer you have, is the target or you. If you wanted to find the target's pointer, you'd have to either loop through all creatures and check if isTarget() or have a pre-defined pointer assigned to it, which is what I'm asking for.
There will be pointers as such (self, target, etc.). The Creature class, and more, just allows you to have more control over your scripts.
They exist, Check the Creature.lua
Code:---------------------------------------------------
----------- Relational Properties ---------------
---------------------------------------------------
function Creature:isSelf()
return self._id == getSelfID()
end
function Creature:isTarget()
return self._id == getSelfTargetID()
end
function Creature:isFollowed()
return self._id == getSelfFollowID()
end
That's not documentation, that's implementation. This is documentation, and is where the thread starter states that ALL variables and functions would be.
There's no need of writing getSelfID() instead of Creature:isSelf() or isSelf(), both works the same way just that they are written with a "diferent name". and writing EVERY SINGLE "variable" that is used for a variable that already exist would be a pain on the ass.
For example
There's no need for the users/customers of knowing the "return value" of each variable.Code:LookDirection() is the same as writing getCreatureLookDirection(self._id)
Speed() is the same as writing getCreatureSpeed(self._id)
Outfit() is the same as writing getCreatureOutfit(self._id)
HealthPercent() is the same as writing getCreatureHealthPercent(self._id)
Is the same thing, all of 'em are the return values of a variable, just look at this code.
Code:-- On this code the variable is "Speed()"
-- and the return value (for the variable to work) is getCreatureSpeed(self._id)
-- So There's no need for the users/customers of knowing the "return value" of each variable.
-- code starts here
function Creature:Speed()
return getCreatureSpeed(self._id)
end
Ok then. Tell me how you find the Name of your target only using isTarget().
You can't lie to the code, an this proves is the same thing...
getTargetId() Doesn't exist, Probably you meant to say getSelfTargetID()Code:function Creature:isTarget()
return self._id == getSelfTargetID()
end
As I say before "getById(isTarget())" would be the way to get the name of your current target.
getById() is used to get their name by their id, so writing an id inside the "()" will tell you the name.
isTarget() will return the id of your current target.
This can also be written like the following codes.
an example implemented on a script would be.Code:GetByID(getSelfTargetID())
--or
getCreatureNameById(getSelfTargetID())
--or
GetByID(isTarget())
--or
getCreatureNameById(isTarget())
(examples taken from @sirmate all credits for him)
Code:local target = Creature.GetByID(getSelfTargetID())
--or just the one I made
local targetname = Creature.GetByID(isTarget())
Stop arguing before I throw infractions out like a blind squirrel! It doesn't matter if I documented it or not, yet. It's in the Creature class so that means it exists, but I haven't documented it. Calm down, both of you! Good grief, you're like a bunch of babies. Get offline, go ween yourself off your mother's teet, then come back when you've grown up...
really, reading the post http://forums.xenobot.net/showthread...ons-and-Events
and the discussion above, we need a "creature loop".
One solution "not good" to find the target is:
PS: not tested because i haven't xenobot.Code:function targetid()
local creature
for i = 1, 100000 do
creature = Creature.GetByID(i)
if creature and creature:isTarget() then
return i
end
end
return false
end
function targetname()
local target = targetid()
return (target and Creature.GetByID(target):Name)
end
@Efren, @Raphael is correct. isTarget() returns a boolean (yes/no), getSelfTargetID() returns the actual ID of your character's target.
@Blequi, that's a bad, bad way to get it. Just use getSelfTargetID()
Code:local Target = Creature.GetByID(getSelfTargetID())
----then use Target:Name() to return your target's name
i didn't know the existence of getSelfTargetID(), at least you didn't post.
I'm mistaken. DarkstaR, I think, accidentally included it with a previous version of XenoBot, but you can view it here: http://pastebin.com/3vDpZWL3