Page 1 of 1

Daily script with partymember check

Posted: Wed Mar 05, 2014 6:33 am
by Ego95
Hi,
I got a problem while trying to make a daily quest script for a few characters at the same time.

What I want to do is to make a script for the character, who does the quest and one script for those who just wait to turn in the quest. This is why I want to set up an "alt-list" and let wait the character who does the quest until all alts have written "accepted" in the party chat.

Now at first I got two problems. If I start the script and write "accepted" in the party chat manually while micromacro shows "Waiting for partymembers to accept/complete daily" nothing happens. I dn't know why. but it doesn't react.

Second thing is, that I need to implent the alt list, so is does not just look for the message "accepted" but also if every alt has written this in the partychat.

Maybe there is something wrong with "EventMonitorCheck("Wait","4,1",true)" but I never understood what the "4,1", true means.

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad>
	DAILY_ALTS = {""}
	EventMonitorStart("Wait", "CHAT_MSG_PARTY")
	
	function acceptDaily()
		cprintf(cli.lightred,"Waiting for partymembers to accept/complete daily...\n")
		while true do
			local time, moreToCome, _name, _message = EventMonitorCheck("Wait","4,1",true)
			if _message then
				string.lower(_message)
			end
			if _message and (_message == "accepted" or _message == "completed") then
				break
			else
				yrest(500)
			end
		end
		cprintf(cli.lightgreen,"Going on\n")
	end

</onLoad>
	<!-- #  1 --><waypoint x="-7099" z="-4127" y="172" tag="quest">
		acceptDaily() -- wait for party to accept the daily
....

Re: Daily script with partymember check

Posted: Wed Mar 05, 2014 6:57 am
by rock5
I usually just have 1 account do the dailies normally while the alt accounts furiously click the npc (with DailyNotes automatically accepting and completing). I use my own custom addon that controls the party.
Ego95 wrote:Maybe there is something wrong with "EventMonitorCheck("Wait","4,1",true)" but I never understood what the "4,1", true means.
EventMonitorCheck always returns "time, moreToCome" as the first 2 arguments. Then it returns the arguments returned from the actual event. If you don't specify any filter then it will return all the arguments. If you specify a filter, such as "4,1" used here, it returns the 4th and 1st argument respectively. In this case argument 4 and 1 are "name" and "message".

Re: Daily script with partymember check

Posted: Wed Mar 05, 2014 7:02 pm
by lisa
The "true" is ONLY last message, you are probably better off not using that as an option as you might miss other chars who have posted they are done.

If you deffinately want to wait for all party members to have interacted with NPC then you can monitor party chat like you do looking for the finished with npc message and then check the names against party member names.

For me though I don't do it this way, if any character crashes or DC's your main will just sit there until you come and deal with it.

I just make 2 WP, one to do the quest and there other just sits at NPC and hands in quest when it's complete.

Example

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints type="TRAVEL">
<onload>
questtype = "daily"
questname = RoMScript('TEXT("Sys426087_name")')
function doquest()
	player:target_NPC(121843)
	CompleteQuestByName(questname,questtype)

	local dqCount, dqPerDay = RoMScript("Daily_count()")
	if dqCount ~= 10 then
		player:target_NPC(121843)
		AcceptQuestByName(questname,questtype)
	else
		inventory:update()
		if inventory:itemTotalCount(202434) > 0 then
			inventory:useItem(202434)
			yrest(2000)
			player:target_NPC(121843)
			AcceptQuestByName(questname,questtype)	
		else
			player:sleep()
		end
	end	
end
</onload>
	<!-- #  1 --><waypoint x="-7379" z="-5134" y="1359">
	doquest()
		repeat
			yrest(500)
		until getQuestStatus(questname) == "complete"	
	</waypoint>
</waypoints>

Re: Daily script with partymember check

Posted: Mon Mar 10, 2014 10:21 am
by Ego95
while the alt accounts furiously click the npc (with DailyNotes automatically accepting and completing)
I think this would really be the best way to do it. What I wanted to do is maybe a bit too complicated.

Re: Daily script with partymember check

Posted: Mon Mar 10, 2014 3:13 pm
by ZZZZZ
I tried doing this myself for my dreamland script, but I had issues trying to tag each member as ready. In the end I simply used it to print who was ready and used a counter to determine when to go.

Code: Select all

		checkPartyNames()
			checkWantedBadges()
			if CommandDone == false then
				sendpartychat('code"resetDreamLandHeal()"')
				CommandDone = true
			end
			if (RoMScript("GetNumSpeakOption()") > 1)then
				repeat
					yrest(1000);
					local time, moreToCome, name, msg = EventMonitorCheck("Dreamland", "4,1")
					if msg ~= nil then
						if msg == "ready" and name ~= player.Name then
							partyIsReady(name)
						elseif msg == "Out of Dreamland Dust" then
							player:sleep()
						end
					end
				until StartDreamland == true

Code: Select all

	function checkPartyNames()
		ZZPartyTable = {}
		ZZNumberParty = 0
		ZZReady = 0
		for i = 1, 6 do
			--ZZPartyTable[i] = GetPartyMemberName(i)
			if GetPartyMemberName(i) ~= nil then
				table.insert(ZZPartyTable, GetPartyMemberName(i))
				ZZNumberParty = ZZNumberParty + 1
			end
		end

	end
	
	function partyIsReady(playerReady)
		StartDreamland = true
		for k,v in pairs(ZZPartyTable) do
				if playerReady == v then
				ZZReady = ZZReady + 1
					print(""..playerReady.." is ready!")
				end
			--end
		end
		if ZZReady ~= ZZNumberParty then
			StartDreamland = false
		else
			cprintf(cli.red,"\nStarting!\n")
		end
		-- for k,v in pairs(ZZPartyTable) do
		-- --for i = 1, ZZNumberParty do
			-- if v ~= "ready" or v ~= nil then
				-- StartDreamland = false
				-- print("Will not start until all have announced they are ready.");
			-- else
				-- print(""..playerReady.." is ready.");
			-- end
		-- end		
	end
To signal everyone was ready I tried changing the players names in the table to "ready" if they have said 'ready' in party chat, but for some reason I couldn't get it to work ... so just went with the counter.

Re: Daily script with partymember check

Posted: Fri Mar 14, 2014 6:04 pm
by Ego95
Thank you for helping, I'm going to do it now like rock and lisa said. The problem is, that the alts have to be in the party to complete the quests. So for example I have got a list with alts of different accounts:

Code: Select all

altList = {"Hero","King","Warrior","Bob","Mitchell","Frank","Susie","Emma"}
One alt will do the quest and after it is completed it will cancle the quest and accept it again. Before accepting it should check all alts of "altList" in a range of let's say 75 for characters that are online and invite them.

For example:
The char which does dailies is at the npc:
-check for all alts of "altList"
-invite the ones who are online
-then do the quest

Would something like this be possible? I have no idea how I could check for specific characters in the altList :/

Ego95

Re: Daily script with partymember check

Posted: Fri Mar 14, 2014 7:10 pm
by lisa
This will probably get you started.

Code: Select all

function dailyinvites()
	local altList = {"Hero","King","Warrior","Bob","Mitchell","Frank","Susie","Emma"}
	local obj = nil;
	local objectList = CObjectList();
	objectList:update();
	player:updateXYZ()
	for i = 0,objectList:size() do
		obj = objectList:getObject(i);	
		if obj ~= nil and obj.Type == 1 then
			for k,v in pairs(altlist) do
				if obj.Name == v and 75 >= distance(player,obj) then
					SlashCommand("invite \""..v.."\"")
				end
			end
		end
	end
end