jParty [Version v1.11.20beta]

Additional botting resources. Addons may be either for the game itself or for the RoM bot.
Forum rules
Only post additional bot resources here. Please do not ask unrelated questions.
Message
Author
User avatar
Zangetsu
Posts: 56
Joined: Fri Nov 11, 2011 5:45 pm

jParty [Version v1.11.20beta]

#1 Post by Zangetsu » Thu Nov 17, 2011 10:28 pm

jParty is a script that make your bot acting as a player in your party.

Current Version: 1.11.20beta
  • Complete rewriting following Lisa's tips again :lol: .
  • Disabled <option name="jParty_Debug" value="true" /> for now.
  • Less loops.
  • Sell to NPC when your put the Icon 8 on a merchant.
  • Talk to NPC and select the choice equal to the Icon (1, 2, 3, 4, 5, 6 and 7)
  • If the member the bot have to follow is out of range, it will try to find and follow the "Master"
  • If both of the Master and "Followed" member is out of range, it will try to find and follow the "Assist" player
  • If these 3 members are too far, it will go to the last position of the "Followed" and just spam MOVE_FORWARD (I know, it's not perfect)
  • Zoning is working (At least I didn't had issues while testing)
  • If when started, the bot isn't in party, it will not crash. I have to find the way to get the name of the player who's inviting. Once done it will accept invite if he's the Master

Functionnality(WORKING, NOT WORKING)
  • The bot can follow a specified player
  • The bot can listen a specified player
  • The bot can assist a specified player
  • The bot can loot
  • The bot can need/greed/pass loot
  • The bot can check if he's on a party and if not wait for an invite from his master.
  • The bot can accept party invite if the player inviting is its master.
  • The bot can heal and regen
  • The bot can fight
  • The bot can zone
  • The bot can drop party
  • The bot can rest MP when Master ask it
  • The bot can change channel when the master ask it.
Some functions need few tweaks still I guess, sorry for "ugly" code sometimes but I've just learned LUA few weeks ago :lol:

HOW TO USE IT
Put userfunction_jparty.lua into rom/scripts/userfunctions/ directory
userfunction_jparty.lua
(17.53 KiB) Downloaded 364 times
Put jParty.xml into rom/scripts/waypoints/
jParty.xml
v1.11.20beta
(1.64 KiB) Downloaded 347 times

Set up these vars in your profile.xml before starting the bot:

Code: Select all

<option name="jParty_BotMaster" value="PlayerName" />
<option name="jParty_BotAssist" value="PlayerName" /> The bot will assist this member if a fight is engaged
<option name="jParty_BotFollowed" value="PlayerName" /> The bot will follow this member
<option name="jParty_FollowingDistance" value="20" /> The bot will keep this distance with the BotFollowed
<option name="jParty_BotHealer" value="true" /> The bot will heal
<option name="jParty_BotDPSer" value="true" /> The bot will Fight the target of BotAssist if in combat
<option name="jParty_BotLooter" value="true" /> The bot will loot
<option name="jParty_Heal" value="PRIEST_URGENT_HEAL" /> Your main heal
<option name="jParty_BigHeal" value="PRIEST_HEAL" /> Your Big heal
<option name="jParty_Regen" value="PRIEST_REGENERATE" /> Your regen (The bot will only regen if jParty_RegenBuffName is not found on party members and if IN combat
<option name="jParty_RegenBuffName" value="Regenerate" /> The name of your buff's regen
Once it's done, launch your bot as usual and lot jParty.xml

:arrow: Once in game:
To make your bot sell stuff, have a merchant targeted, put the Icon 8 on its head, then wait a bit and remove it.
To make your character speak with a NPC, target the NPC and choose options put:
- Icon 1 if you want the bot choose the option 1
- Icon 2 if you want the bot choose the option 2
- Icon 3 if you want the bot choose the option 3
- Icon 5 if you want the bot choose the option 4
- Icon 5 if you want the bot choose the option 5
- Icon 6 if you want the bot choose the option 6
- Icon 7 if you want the bot choose the option 7

IMPORTANT: Remember to target, put the icon you need, wait a bit and put the icon on someone else. Or else, the bot will keep spamming the choice depending the Icon.
I know it's not perfect, but until I find a way, it's like that :S


If you want to use NPC and Icon, check this:

:arrow: Open rom/classes/pawn.lua
:arrow: Seach for:

Code: Select all

function CPawn:GetPartyIcon()
   local listStart = memoryReadRepeat("intptr", getProc(), addresses.partyIconList_base, addresses.partyIconList_offset)
   for i = 0, 6 do
      local guid = memoryReadShort(getProc(), listStart + i * 12)
      if guid == self.GUID then
         return i + 1
      end
   end
end
:arrow: Replace:

Code: Select all

for i = 0, 6 do
With

Code: Select all

for i = 0, 8 do

Enjoy :D










-------Original Post:-----------------------------------------------------------------------------------------
I'm currently writing a script that will make your bot act as a party member for farming, questing, instance farming, etc...
It's still not finished but it's in a good way. I'm coding this because I saw a lot of posts on the forum and I've also used Lisa and some others members's scripts but it's not doing exactly what I need.

TBH, I need some help in order to finish it and sharing it with you all. It's more to know if something is doable by the RoM API or not because I need some functions to work. If not, I need to search another way.

Currently objectives are:
  • Accept invite from a set player
  • Drop party
  • Follow a set player
  • Heal
  • Fight
  • Loot
  • Execute simple commands to rest by example
  • Log into a file

Some functions are already working.
I need to know if this thing are possible:
:arrow: Get the name of the player who is sending invite
:arrow: Need/Greed/Pass on the loot window

I will post the script once it's working and cleaned of all junks.

Thanks for helping :)
Last edited by Zangetsu on Sun Nov 20, 2011 7:47 pm, edited 10 times in total.

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: jParty - Using your bot as party member (Currently in de

#2 Post by lisa » Thu Nov 17, 2011 11:31 pm

Zangetsu wrote: Get the name of the player who is sending invite
Need/Greed/Pass on the loot window
Best place to find out info on in game functions is right here
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

User avatar
Zangetsu
Posts: 56
Joined: Fri Nov 11, 2011 5:45 pm

Re: jParty - Using your bot as party member (Currently in de

#3 Post by Zangetsu » Fri Nov 18, 2011 12:08 am

lisa wrote:
Zangetsu wrote: Get the name of the player who is sending invite
Need/Greed/Pass on the loot window
Best place to find out info on in game functions is right here

Yeah, I'm always going there but I can't find a suitable function, maybe I've miss it...

User avatar
Zangetsu
Posts: 56
Joined: Fri Nov 11, 2011 5:45 pm

Re: jParty - Using your bot as party member (Currently in de

#4 Post by Zangetsu » Fri Nov 18, 2011 12:24 am

Lisa, I can't find anywhere the description of the function:

Code: Select all

player:findEnemy
In party.lua I can see this:

Code: Select all

player:findEnemy(nil,nil,icontarget,nil)
I'd like to know, if possible, what are parameters. Want to see if I can make the bot assist a specified player (name, ObjectID or even Address) when the combat event pop



EDIT
Or maybe I can do something like this:

Code: Select all

if player.Battling then
		player:target(AssistPlayer.target)
			if player:haveTarget() then
				player:fight();
			end
end
I guess player.Battling is working like the event COMBATMETER_DAMAGE




EDIT 2
About the loot window, I've found this function:

Code: Select all

RollOnLoot(this:GetParent().lootIndex, "roll|greed|pass");
I guess I can simply pass items then.

User avatar
Zangetsu
Posts: 56
Joined: Fri Nov 11, 2011 5:45 pm

Re: jParty - Using your bot as party member (Currently in de

#5 Post by Zangetsu » Fri Nov 18, 2011 2:08 am

Well, no errors when loading the xml in MM but it's not looping every seconds. I'm too tired, i'll check tomorrow :roll:

:arrow: XML

Code: Select all

startjParty();

while (true) do
  yrest(100); 
end;

:arrow: LUA

Code: Select all

function startjParty()
	[...]


	  unregisterTimer("jPartyTimer");
	  cprintf(cli.yellow, "startjParty().\n");
	  EventMonitorStart("jPartyOrdersMonitor", "CHAT_MSG_PARTY");
	  registerTimer("jPartyTimer", 1000, jPartyMain);


end
It should execute jPartyMain() every 1 second right?

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: jParty - Using your bot as party member (Currently in de

#6 Post by lisa » Fri Nov 18, 2011 3:03 am

Zangetsu wrote:I guess I can simply pass items then.
If you are going to just pass on any loot then why not set it to "free for all" then you don't need to roll on anything.
Zangetsu wrote:player:findEnemy
have a look in rom/classes/player.lua
Zangetsu wrote:I guess player.Battling is working like the event COMBATMETER_DAMAGE
player.Battling is if you are in combat, you know when the red writing appears on screen saying you enter combat and stay true until it says leaving combat.
Zangetsu wrote:It should execute jPartyMain() every 1 second right?
I assume the XMl is in the onload of a WP.
I also assume the LUA is in a userfunction file.
Where abouts is the function jPartyMain(), if it is in the same userfunction file as the timer function is it before the timer function or after it?
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: jParty - Using your bot as party member (Currently in de

#7 Post by rock5 » Fri Nov 18, 2011 7:37 am

You know what I did to collect the most loot? I'd set auto greed on everything on all my characters in party so the loot gets spread between all characters.

Just saying.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
Zangetsu
Posts: 56
Joined: Fri Nov 11, 2011 5:45 pm

Re: jParty - Using your bot as party member (Currently in de

#8 Post by Zangetsu » Fri Nov 18, 2011 10:57 am

rock5 wrote:You know what I did to collect the most loot? I'd set auto greed on everything on all my characters in party so the loot gets spread between all characters.
Just saying.
lisa wrote: If you are going to just pass on any loot then why not set it to "free for all" then you don't need to roll on anything.
The cast loot part sounds fine. I need to check the event now to launch this function or not. Found LOOT_ITEM_SHOW I'll try to monitor it with EventMonitor. I guess it might return true or false.

No offense here but I'm trying to design this to not have to act on the bot physically. I wish to give to the user the choice of letting his bot to need/greed/pass items.
It's useful if you're botting with 1 friends and another bot by example.

lisa wrote:have a look in rom/classes/player.lua
Ok thanks, I'm going to have a look there :)
lisa wrote: player.Battling is if you are in combat, you know when the red writing appears on screen saying you enter combat and stay true until it says leaving combat.
Since if someone in your party is aggroing/starting combat and you're close enough, you got this message. So it's fine :) Thanks



EDIT
The loop is working. Now I have a problem with tables.

I'm creating and inserting value in a table into a function
I'm trying to get a table value on another function but didn't working.

Table are globals since I'm doing:

Code: Select all

Table = {}
and not

Code: Select all

local Table = {}
right?

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: jParty - Using your bot as party member (Currently in de

#9 Post by rock5 » Fri Nov 18, 2011 12:44 pm

That's right. As long as it wasn't declared local earlier on.

The thing to remember about global variables is that they might clash with other functions or code that might be using the same variable. So it's important to not make them too generic. "Table" is quite generic and could be used somewhere else. If you are not going to use the variable outside the file you could make it local to the file so all functions in the file can use it but it wont clash with other files. Just declare it local at the top of the file before the first function.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
Zangetsu
Posts: 56
Joined: Fri Nov 11, 2011 5:45 pm

Re: jParty - Using your bot as party member (Currently in de

#10 Post by Zangetsu » Fri Nov 18, 2011 3:31 pm

rock5 wrote:That's right. As long as it wasn't declared local earlier on.

The thing to remember about global variables is that they might clash with other functions or code that might be using the same variable. So it's important to not make them too generic. "Table" is quite generic and could be used somewhere else. If you are not going to use the variable outside the file you could make it local to the file so all functions in the file can use it but it wont clash with other files. Just declare it local at the top of the file before the first function.
Yeah I took "Table" for the example, my real variable is "arr_jPartySomeTable"

I have an error actually and can't find how to debug it :/

Code: Select all

#109 local CurrentMemberID = player:findNearestNameOrId(RoMScript("UnitName('party"..i.."')"))
MicroMacro wrote: userfunction_jparty.lua:109: attempt to concatenate local 'CurrentMemberID' (a table value)
But it's not, right?

User avatar
Zangetsu
Posts: 56
Joined: Fri Nov 11, 2011 5:45 pm

Re: jParty - Using your bot as party member (Currently in de

#11 Post by Zangetsu » Fri Nov 18, 2011 3:40 pm

Wow just found that table are not the same as array in LUA :shock:
I need to change all of my functions, this is not what I wanted.

brb in few minutes xD

User avatar
Zangetsu
Posts: 56
Joined: Fri Nov 11, 2011 5:45 pm

Re: jParty - Using your bot as party member (beta)

#12 Post by Zangetsu » Fri Nov 18, 2011 7:49 pm

It's on the good way and it's testable, I've edited the first post with files.

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: jParty - Using your bot as party member (beta)

#13 Post by lisa » Fri Nov 18, 2011 9:39 pm

109 local CurrentMemberID = player:findNearestNameOrId(RoMScript("UnitName('party"..i.."')"))
Have a look in rom/classes/party.lua
The code is already done for party members and the info is gotten direct from memory.
just call PartyTable() and then use the table partymemberpawn.
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

User avatar
Zangetsu
Posts: 56
Joined: Fri Nov 11, 2011 5:45 pm

Re: jParty - Using your bot as party member (beta)

#14 Post by Zangetsu » Fri Nov 18, 2011 9:56 pm

lisa wrote:
109 local CurrentMemberID = player:findNearestNameOrId(RoMScript("UnitName('party"..i.."')"))
Have a look in rom/classes/party.lua
The code is already done for party members and the info is gotten direct from memory.
just call PartyTable() and then use the table partymemberpawn.
Don't worry lisa, this part is done and working.

I have some troubles with the targeting now. Apparently if in game the bot is targeting a mob (visible in the frame), it's not ok for MM. MM is returning that no target is selected :S


EDIT
For example I'm trying to find how the targetting is working.
jParty_BotAssist is the name of the char I want the bot to assist

Code: Select all

RoMScript("AssistUnit('"..settings.profile.options.jParty_BotAssist.."');")
	jPartyAssistTargetName = RoMScript("UnitName('target');")

	if jPartyAssistTargetName ~= nil then
		jPartyAssistTargetObject = player:findNearestNameOrId(jPartyAssistTargetName)
		jPartyAssistTargetAddress = CPawn(jPartyAssistTargetObject.Address)

		player:target(player:findEnemy(nil,jPartyAssistTargetAddress,nil,nil))


		jPartyAssist:update();
		player:update();
		player:checkSkills(true);


		if player:haveTarget() then
			cprint(cli.yellow, "Target OK\n");
		else
			cprintf(cli.lightred, "Target KO\n");
		end

	end
And it's just spamming Target KO but in game the bot have the target of the assist player targeted :shock:




EDIT 2
Ok this is giving me Target Assist OK

Code: Select all

jPartyAssist:update();
		player:update();
		player:checkSkills(true);


		if jPartyAssist:haveTarget() then
			cprintf(cli.yellow, "Target Assist OK\n");

		else
			cprintf(cli.lightred, "Target Assist KO\n");
		end
Then it can see that the player setup as Assist player have a target. I might find the name, the id or the address of his target then?

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: jParty - Using your bot as party member (beta)

#15 Post by lisa » Fri Nov 18, 2011 10:20 pm

You do realize your basically trying to invent the wheel when if you look in your neighbours yard the wheel is already there, it might not be exactly how you want your wheel but the wheel itself has already been invented.
You could always just work on the existing wheel and turn it into what you want.
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

User avatar
Zangetsu
Posts: 56
Joined: Fri Nov 11, 2011 5:45 pm

Re: jParty - Using your bot as party member (beta)

#16 Post by Zangetsu » Fri Nov 18, 2011 10:32 pm

lisa wrote:You do realize your basically trying to invent the wheel when if you look in your neighbours yard the wheel is already there, it might not be exactly how you want your wheel but the wheel itself has already been invented.
You could always just work on the existing wheel and turn it into what you want.
Lisa, I'm learning lol. I'm using your scripts to find the way.
I'm trying to make the bot target the assist player target.

If I'm really annoying, it's because I don't understand, I'm sorry. But after a lot of wiki/forum search I did not see something doing exactly what I'm trying to do. So I'm just taking some lines and functions here and there.

All I've seen is your way to work with icon. I don't want to specify icon to make it work :S

Anyway, sorry if I'm disturbing you. Just learning and wanted some tips.

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: jParty - Using your bot as party member (beta)

#17 Post by lisa » Sat Nov 19, 2011 5:32 am

Learning is of course good, when I talked about the wheel already existing I meant what you are trying to do, pretty much all of the code you want already exists.

rom/classes/pawn.lua has all the information you can get from objects which includes players and mobs.

the target of pawn is
self.TargetPtr
So using the code I posted earlier.

Code: Select all

PartyTable() -- populate party member table
partymemberpawn[2]:update() -- update info for first party member, 1 is player.
player:target(partymemberpawn[2].TargetPtr) -- target the target of first party member
target = player:getTarget();
if target then -- check if you even have a target, should add in check for if target is a mob.
fight() -- start using skills and kill the mob
end
very very basic example but you get the idea, everything you want for your script already exists, you just need to learn how to use it.

Have a read of the files in rom/classes paying close attention to party.lua player.lua and pawn.lua

You will find if you keep trying to use the in game scripts for everything you will always find issues. Issue for the target of a player is if it is a bot player then it targets via memory and not physically in game. So the in game function to assist will fail 60% of the time if the other player is a bot. It only gets the target as a physical target when that mob actually does damage to the bot.

Which is why the icon works 100% of the time because it doesn't rely on any targets of target, it relies on a single bit of memory which isn't affected by the bots targeting via memory.
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

BillDoorNZ
Posts: 446
Joined: Wed Aug 03, 2011 7:37 pm

Re: jParty - Using your bot as party member (beta)

#18 Post by BillDoorNZ » Sat Nov 19, 2011 7:07 am

an alternate way of dealing with targetting target-of-target is to have mm tell the character to 'assist' from memory there is a key mapped in-game to assist your target.

User avatar
Zangetsu
Posts: 56
Joined: Fri Nov 11, 2011 5:45 pm

Re: jParty - Using your bot as party member (beta)

#19 Post by Zangetsu » Sat Nov 19, 2011 6:15 pm

Based a script on your script but for MM, the bot have always a target and its name is unknown :?

If I understand well, from memory I the bot have a target it's not impossible that the bot won't have a "target frame" in game.
But whatever I'm doing with your script, the bot have always a target named <UNKNOWN>

I have messed up something?

BillDoorNZ wrote:an alternate way of dealing with targetting target-of-target is to have mm tell the character to 'assist' from memory there is a key mapped in-game to assist your target.
Yeah if I can't understand how to do with memory, I think I'll try to make something like
-- check if in combat
-- RoMScript("AssistUnit('NameOfThePlayer');") or hit the key mapped in game to assist it
-- elseif not in combat > yrest(100)

Something like that would work




EDIT
To debug it better, I've wrote a function to output the partymemberpawn table into a file and I found why it wasn't working.
You need to put

Code: Select all

player:update();
Before trying to

Code: Select all

player:getTarget();
Finally :shock:
Thanks Lisa for your patience toward me :oops:

This output function I wrote gave me ideas too, I guess I'll rewrite the whole script >.>

User avatar
Zangetsu
Posts: 56
Joined: Fri Nov 11, 2011 5:45 pm

Re: jParty [Version 0.11.20beta]

#20 Post by Zangetsu » Sat Nov 19, 2011 9:06 pm

Thanks Lisa with your example I could handle it better, the new version is uploaded.

Next step is to make it going to the last Followed.X Followed.Z if he lost him.
I have some idea of how to do it but I'll ask before just in case.

Is it possible to know if a partymemberpawn is in the same zone or not?
Last edited by Zangetsu on Sat Nov 19, 2011 9:43 pm, edited 2 times in total.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests