Page 1 of 2
Targetting/locating guild buildings
Posted: Sun Aug 18, 2013 11:26 pm
by Cindy
So, I am trying to script getting the mount buff from the stable, as well as doing minis in the drill grounds. Anyone tackle the problem of finding the right building in the castle? (Different castles have the buildings at different locations)
Secondly, this seems like a stupid question but I can't figure out the answer.
How do I target the stable to get the popup menu? Same with the Drill grounds?
Thanks in advance
Re: Targetting/locating guild buildings
Posted: Mon Aug 19, 2013 3:03 pm
by Ego95
Maybe you could do something like this:
Code: Select all
local stable = player:FindNearestNameOrId("Stable I") or player:FindNearestNameOrId("Stable II") or player:FindNearestNameOrId("Stable III") or player:FindNearestNameOrId("Stable IV") or player:FindNearestNameOrId("Stable V") -- until Stable X
if stable then player:target(stable.adress)
To open the dialog I think you should use player:target_NPC("...")
About the different locations of buildings there isn't much you can do. You could probably check your current guild and then let your characzer run to a spot in the guild castle first before targeting the buildings.
Additionally it's maybe a good idea to use the wallhack because of those small fences some guild buildings have got.
I hope there aren't any mistakes in the code, I'm not home atm
AlterEgo95
Re: Targetting/locating guild buildings
Posted: Mon Aug 19, 2013 6:11 pm
by Cindy
Hmm.... How do I read my guild tag? (Based on the tag, i could have pre-programmed map file(s))
Re: Targetting/locating guild buildings
Posted: Tue Aug 20, 2013 3:20 am
by haringpb
For the drill ground i use player:target_Object(112901); which works fine for me.
Re: Targetting/locating guild buildings
Posted: Tue Aug 20, 2013 11:37 pm
by Cindy
Code: Select all
The game client did not crash.
11:34pm - [string " -- Front left Tile, is it Stable? ( Stable ..."]
:2: attempt to call method 'FindNearestNameOrId' (a nil value)
Code: Select all
<!-- # 10 --><waypoint x="-121" z="-421" y="6"> -- Front left Tile, is it Stable? ( Stable III - 112469) ( Stable VI - 112472)
local stable = player:FindNearestNameOrId("Stable I") or player:FindNearestNameOrId("Stable II") or player:FindNearestNameOrId("Stable III") or player:FindNearestNameOrId("Stable IV") or player:FindNearestNameOrId("Stable V") -- until Stable X
if stable then player:target(stable.adress)
-- player:target_NPC(112472);
sendMacro("ChoiceOption(6);");
__WPL:setWaypointIndex(__WPL:findWaypointTag("exitcastle"));
end
if not player.Mounted then
player:mount();
end
note when i use my commented out code, it works. (But can't use to find the stable).
Re: Targetting/locating guild buildings
Posted: Wed Aug 21, 2013 1:18 am
by rock5
Most class methods (functions) start with a small letter. It should be
Code: Select all
player:findNearestNameOrId("Stable")
Also this function accepts partial names so the above should suffice.
Re: Targetting/locating guild buildings
Posted: Wed Aug 21, 2013 7:02 am
by Ego95
Ok, well
I hope there aren't any mistakes in the code, I'm not home atm
Try
Code: Select all
<!-- # 10 --><waypoint x="-121" z="-421" y="6"> -- Front left Tile, is it Stable? ( Stable III - 112469) ( Stable VI - 112472)
local stable = player:findNearestNameOrId("Stable")
if stable then player:target(stable.adress)
yrest(2000)
sendMacro("ChoiceOption(6);");
__WPL:setWaypointIndex(__WPL:findWaypointTag("exitcastle"));
end
if not player.Mounted then
player:mount();
end
Like rock said, you can search for partial names so player:findNearestNameOrId("Stable") is enough
Re: Targetting/locating guild buildings
Posted: Wed Aug 21, 2013 7:27 am
by rock5
Should be 'stable.Address' not 'stable.adress'.
Re: Targetting/locating guild buildings
Posted: Wed Aug 21, 2013 8:33 am
by dx876234
I'm using a simple tag based waypoint to navigate to the correct location:
Code: Select all
guild = api:GetGuildInfo()
__WPL:setWaypointIndex(__WPL:findWaypointTag(guild))
and then have a tag="guild" for each guild I run in as location of buildings are different, then I do a findNearest.. as above to open the building independent of level.
-dx
P.S. The api:GetGuildInfo() is a straight call to the GetGuildInfo() function.
Re: Targetting/locating guild buildings
Posted: Wed Aug 21, 2013 10:00 pm
by Cindy
dx876234 wrote:I'm using a simple tag based waypoint to navigate to the correct location:
Code: Select all
guild = api:GetGuildInfo()
__WPL:setWaypointIndex(__WPL:findWaypointTag(guild))
and then have a tag="guild" for each guild I run in as location of buildings are different, then I do a findNearest.. as above to open the building independent of level.
-dx
P.S. The api:GetGuildInfo() is a straight call to the GetGuildInfo() function.
Do you have different waypoint files you load based on the guild name? (I'm not sure I am understanding the second part correctly)
Re: Targetting/locating guild buildings
Posted: Wed Aug 21, 2013 10:09 pm
by Cindy
Next question. Based on the level of the stable, there are options for picking the level of the buff. How can I pick the 2nd Last option, not knowing what the total number of options in the dialog (ie, some sort of logic for the "4" below)?
Code: Select all
local stable = player:findNearestNameOrId("Stable")
if stable then player:target(stable.Adress)
-- player:target_NPC(112472);
sendMacro("ChoiceOption(4);");
end
if not player.Mounted then
player:mount();
end
Re: Targetting/locating guild buildings
Posted: Thu Aug 22, 2013 12:31 am
by Cindy
FYI, this doesn't work:
but this does:
Re: Targetting/locating guild buildings
Posted: Thu Aug 22, 2013 1:22 am
by lisa
Cindy wrote:FYI, this doesn't work:Code: player:target(stable.Adress)
rock5 wrote:Should be 'stable.Address' not 'stable.adress'.
Address
Did you try
stable.Id
should actually tell you which level the stable is because each level would have a different Id, that might help with ur option choices.
Re: Targetting/locating guild buildings
Posted: Thu Aug 22, 2013 1:37 am
by dx876234
Cindy wrote:dx876234 wrote:I'm using a simple tag based waypoint to navigate to the correct location:
Code: Select all
guild = api:GetGuildInfo()
__WPL:setWaypointIndex(__WPL:findWaypointTag(guild))
and then have a tag="guild" for each guild I run in as location of buildings are different, then I do a findNearest.. as above to open the building independent of level.
-dx
P.S. The api:GetGuildInfo() is a straight call to the GetGuildInfo() function.
Do you have different waypoint files you load based on the guild name? (I'm not sure I am understanding the second part correctly)
I do:
Code: Select all
<waypoint x=...>
guild = api:GetGuildInfo()
__WPL:setWaypointIndex(__WPL:findWaypointTag(guild))
</waypoint>
<!-- for guild NN, move to stable -->
<waypoint x=.... tag="NN> </waypoint>
<waypoint x=....>
local stable = player:FindNearestNameOrId("Stable I") or player:FindNearestNameOrId("Stable II") or player:FindNearestNameOrId("Stable III") or player:FindNearestNameOrId("Stable IV") or player:FindNearestNameOrId("Stable V") -- until Stable X -- Prolly want this in a function to re-use
...
</waypoint>
<!-- for guild XX, move to stable -->
<waypoint x=.... tag="XX> </waypoint>
<waypoint x=....>
local stable = player:FindNearestNameOrId("Stable I") or player:FindNearestNameOrId("Stable II") or player:FindNearestNameOrId("Stable III") or player:FindNearestNameOrId("Stable IV") or player:FindNearestNameOrId("Stable V") -- until Stable X -- Prolly want this in a function to re-use
...
</waypoint>
-dx
Re: Targetting/locating guild buildings
Posted: Thu Aug 22, 2013 6:43 am
by rock5
Cindy wrote:FYI, this doesn't work:
but this does:
Even if you used the correct address, ie. stable.Address, these commands are different. player:target_NPC (and player:target_Object) search for something by name or id, targets it and then attacks it (clicks on it). In the case of an NPC, for example, it opens a dialog.
player:target only targets the object. It does no action. The equivalent to target_NPC then is
Code: Select all
player:target(stable.Address)
Attack()
As to which you should use, you usually use
player:target_NPC on npcs and objects that open dialogs. You usually use
player:target_Object when you are collecting something that either disappears or has a casting bar appear, because target_Object has extra options to deal with those. You use
player:target and
Attack, if you have already found the object, to avoid the extra search target_NPC would do and to make sure it clicks the object you found and not another.
Re: Targetting/locating guild buildings
Posted: Sat Aug 24, 2013 1:02 pm
by Cindy
Great, thanks all

Re: Targetting/locating guild buildings
Posted: Wed Aug 28, 2013 6:19 pm
by Cindy
error
guild = api:GetGuildInfo()
removing "api:" didn't help either. What do I need? thanks
Re: Targetting/locating guild buildings
Posted: Wed Aug 28, 2013 6:41 pm
by Cindy
Code: Select all
guild = RoMScript('GetGuildInfo("player")');
This works.. anything better?
Re: Targetting/locating guild buildings
Posted: Thu Aug 29, 2013 12:58 am
by rock5
Why? Is that not good enough for you? Do you want more information? Well here is the full command,
Code: Select all
local guildName, leaderName, bRecruit, alreadyCreate,
MaxMemberCount, Score, GuildNote, Introduce,
isLeader, isBBSEnable, isOpenGuild, Level, IsOwnHouse, IsOpenVisit = GetGuildInfo();
The meaning of some of those returned values are obvious, some not so obvious. I'll leave you to figure out what they mean.
Re: Targetting/locating guild buildings
Posted: Thu Aug 29, 2013 6:10 am
by Cindy
Works for me, though the original poster of it had "api:" I thought I am missing something.