Page 1 of 1

Minigame status

Posted: Tue May 01, 2012 3:25 pm
by BillDoorNZ
Anyone know how to determine if a character has run the minigames for that day? I could probably just see if the choice option leads to them teleporting into the instance, but that seems a little inefficient.

Re: Minigame status

Posted: Tue May 01, 2012 3:57 pm
by rock5
I don't think there is any other way to know. That's what my scripts do. Just try to go in and if it fails then assume you already done it for the day.

Re: Minigame status

Posted: Tue May 01, 2012 9:12 pm
by lisa
My guess is a function is called when you initiate dialog with a NPC, something along the lines of the checkquest() which basically alters which NPC is visible or not when you enter certain areas.
So it will alter what text options you have, pure guess of course, I don't have the time to investigate it.

Re: Minigame status

Posted: Wed May 02, 2012 2:53 am
by BillDoorNZ
lisa wrote:My guess is a function is called when you initiate dialog with a NPC, something along the lines of the checkquest() which basically alters which NPC is visible or not when you enter certain areas.
So it will alter what text options you have, pure guess of course, I don't have the time to investigate it.
slacker!!!! ;)

I imagine you are correct however....might have to extract the lua files and start digging - the joy! But in the interim I'll settle for the ugly method :)

Having a look at where to get housekeeper data from too, found the frame etc, now just need to see where rom pulls the value from as I'm working on a script to auto-chat and develop housekeepers. My current method is a bit ugly.

Code: Select all


CController = class(
	function(self)
		self.DEBUG = true;
		self.config = {};
		
		--Daily Quest to run
		self.config.daily = {};
		self.config.daily.Id = 424180;
		self.config.daily.StarterId = 118072;
		self.config.daily.StarterZone = 14;
		self.config.daily.EnderId = 118072;
		self.config.daily.EnderZone = 14;
		
		--Housemaid types
		local housemaids = {};
		local maid = {id=113803, run="1,5", type="cooking", name="Mila Black"};
		table.insert(housemaids, maid);
		
		maid = {id=113776, run="1,3", type="battle", name="Istolil Hill"};
		table.insert(housemaids, maid);
		
		maid = {id=113799, run="1,6", type="crafting", name="Clark Zorlan"};
		table.insert(housemaids, maid);
		
		self.config.housemaids = housemaids;
		self.config.housemaidsLastDone = nil;
		
		
		--State
		self.actionList = CQueue(true);
		self.currentAction = nil;

		--EVENTS
		self.events = {};
		--event to fire when a waypoint is complete so i can figure out what to do next
		self.events.onComplete = function(_state)
			if (_state == WPT_EVENT_FINISHED) then
				--remove from action list --> need a queue here
				self.currentAction = nil;
				self:Think();
			end;
		end;
		
		self.think = {};
		self.think.lastCallTime = os.time();
	end
);

function CController:Think()
	self:print("==============\nTHINK\n==============");
	self:print(tostring(self.think.lastCallTime));
	local time = os.time();
	local elapsed = time - self.think.lastCallTime;
	self.think.lastCallTime = time;
	
	if (self.currentAction) then
		self:print("currentAction: "..tostring(self.currentAction.name));
	else
		self:print("currentAction: None");
	end;
	self:print("actionList.Empty: "..tostring(self.actionList:isEmpty()));
	if (self.currentAction) then
		--check for errored state (stuck etc)
		self:print("  Perfoming an action - do nothing new");
		return;
	end;
	--we aint doing nuffink!
	--if we currently have a plan of action, then do that
	if (not self.actionList:isEmpty()) then
		self:print("  Moving on to next action");
		--are we still performing the current action? or are we ready to move on to the next action;
		self:SetAction(self.actionList:pop());
		return;
	end;
	
	--figure out what to do
	--order: develop housekeeper/plants etc, daily, mini's, other stuff
	if (not self:HasCompletedDailies()) then
		self:print("  Aint done dailies");
		local wpl = self:buildPathToNPC(self.config.daily.StarterZone, self.config.daily.StarterId);
		local dailyWPL = CWaypointList();
		local paths = self:getQuestFile(self.config.daily.Id);
		if (#paths > 0) then
			local questFile = getExecutionPath().."/waypoints/quests/"..tostring(self.config.daily.Id)..".xml";
			dailyWPL:load(questFile, true);
			dailyWPL.notifyOfEvent = self.events.onComplete;
			
			--load the daily script
			if (wpl and dailyWPL) then 
				self.actionList:push(self:buildAction("Run to Dailies", wpl));
				self.actionList:push(self:buildAction("Do Dailies", dailyWPL));
				self:print("ActionList.Count: "..self.actionList:count());
			end;
			return;
		else
			self:print("Could not find waypoint file for daily quest "..tostring(self.config.daily.Id));
		end;
		
	end;
	
	--do we need to do housemaids?
	--have we done them at all yet? or has it been 2 hours?
	--need to also check for potions in backpack
	if ((not self.config.housemaidsLastDone) or ((60*60*2) > os.time() - self.config.housemaidsLastDone)) then
		self:print("  Going to housemaids");
		local wpl = self:buildPathToHouse();
		self:print("Have path to house");
		local command = "";
		for k,v in pairs(self.config.housemaids) do
			command = command.."for i=1,2,1 do\n";
			command = command.."\tplayer:target_NPC("..tostring(v.id)..");\n";
			command = command.."\tsendMacro(\"SpeakFrame_ListDialogOption("..tostring(v.run)..");\");\n";
			command = command.."\tyrest(20);\n"
			command = command.."end;\n\n"
		end;
		self:print("Build command: "..tostring(command));
		local wplExec = self:buildExecuteWPL(command);
		
		--load the daily script
		if (wpl and wplExec) then 
			self:print("Have path to house xml AND execute xml");
			self.actionList:push(self:buildAction("Goto house", wpl));
			self.actionList:push(self:buildAction("Talk to housekeepers", wplExec));
			self:print("ActionList.Count: "..self.actionList:count());
		end;
		self:SetAction(self.actionList:pop());
		return;
	end;

	self:print("  Finished");
	
end;


Re: Minigame status

Posted: Wed May 02, 2012 6:59 am
by lisa
I spent about 20 mins on house maids, getting the values from memory is actually very easy when searching with CE, trouble is I couldn't find any pointers at all for them.

Might have another look at this another day.

Re: Minigame status

Posted: Wed May 02, 2012 7:29 am
by rock5
Sometimes I think getting some stuff from memory is pointless and only causes head aches come patch day. The main purpose of getting info from memory is to speed things up. Seeing as you seldom talk to npcs, I don't see why you just don't use RoMScripts and in game commands.

This is how I leveled my housemaid.

Code: Select all

function LevelHousekeeper()
	local again

	local DBID, name, sex, character, month, day, horoscope, race,
	Affinity, AffinityMax,
	Charisma, CharismaMax,
	Fatigue, FatigueMax,
	Magic, MagicMax,
	Battle, BattleMax,
	Defense, DefenseMax,
	Cooking, CookingMax,
	Inventive, InventiveMax

	local function LevelOne(skill)
		print("Leveling skill "..skill)
		player:target_NPC(name)
		ChoiceOptionByName(skill)
		again = true
	end

	repeat
		again = false

		DBID, name, sex, character, month, day, horoscope, race,
		Affinity, AffinityMax,
		Charisma, CharismaMax,
		Fatigue, FatigueMax,
		Magic, MagicMax,
		Battle, BattleMax,
		Defense, DefenseMax,
		Cooking, CookingMax,
		Inventive, InventiveMax = RoMScript("Houses_GetServantInfo( 1 )")
if name =="" or name == nil then player:sleep() end
		if Fatigue > 85 then
			-- Too tired to do any more
			break
		elseif Fatigue > 75 then
			-- Can only increase Affinity
			if Affinity < 49 then
				LevelOne("Chat")
			end
		else
			if Inventive < Affinity and Inventive < InventiveMax then
				LevelOne("Crafting")
			elseif Affinity < 49 then
				LevelOne("Chat")
			elseif (player.Name == "melee1" or player.Name == "melee2") and Battle < Affinity and Battle < BattleMax then
				LevelOne("Battle")
			elseif (player.Name == "magic1" or player.Name == "magic2") and Magic < Affinity and Magic < MagicMax then
				LevelOne("Magic")
			elseif Defense < Affinity and Defense < DefenseMax then
				LevelOne("Protection")
			end
		end
	until again == false
end
It could be improved for general use but what it does is level afinity and crafting until 50 for the magic pots then starts leveling Battle buff for my melee character and Magic buff for my magic users and then lastly levels Defense buff.

Re: Minigame status

Posted: Wed May 02, 2012 2:16 pm
by BillDoorNZ
nice, thanks Rock - will steal the romscript (api call) part for my purposes :)