Ostrich Nurse

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Message
Author
s018mes
Posts: 79
Joined: Sun Jan 16, 2011 11:14 am

Ostrich Nurse

#1 Post by s018mes » Sat Dec 01, 2012 10:53 am

So is there a way for the bot to do the Ostrich Nurse quest? I am not good are writing waypoints using the chatmonitor function.

Could someone write a script for that quest?

Here are the "phrases" that correspond with the action needed:

-# >>> alt+1
#- >>> alt+2
*! >>> alt+3
** >>> alt+4
'* >>> alt+5

User avatar
grande
Posts: 261
Joined: Tue Jun 28, 2011 4:46 pm

Re: Ostrich Nurse

#2 Post by grande » Sat Dec 01, 2012 2:13 pm

I'm also scratching my head thinking this might be something bottable. The other thing that needs to mention is that it's not so simple as responding to a two symbol print from the system. In fact, multiples of two-symbol prints are reported contiguously. For example, it may be -#*!**#- In which case, alt+1, alt+3, alt+4, and alt+2 would have to be pressed in that order, perhaps with some delay time between. I'm also beginner level here so would have to go re-read on how to monitor and act on system chat.. although I've seen some examples. The other part which I have no idea how to make happen is to ensure the bot reads two symbols at a time from the system messages and acts on each two-symbol segment with independent alt+# buttons. And hopefully, the alt+# buttons don't change order... I haven't done it enough to know for sure.

I was going to start with the easier tracks first: kill 5 mobs, run resources, run errands, cinnamon leaf. And then link them with loadpath. Just haven't mustered the steam yet.

But...those 4 alone should generate ten vouchers?

User avatar
grande
Posts: 261
Joined: Tue Jun 28, 2011 4:46 pm

Re: Ostrich Nurse

#3 Post by grande » Sat Dec 01, 2012 4:14 pm

It also increases the difficulty by incrementing the number of two-part symbols by two each time. Starts with three buttons to push, then five, then seven.

Example:

Code: Select all

***!**

***!*!-##-

#-*!#-**#-*!'*
so first line would need alt+4, alt+3, alt+4

Second line: alt+4, alt+3, alt+3, alt+1, alt+2

etc.. lol

User avatar
grande
Posts: 261
Joined: Tue Jun 28, 2011 4:46 pm

Re: Ostrich Nurse

#4 Post by grande » Sat Dec 01, 2012 4:29 pm

Okay, has to be something from this: http://www.troubleshooters.com/codecorn ... string.htm

Maybe in the "Splitting by Character Position" and "Finding Substring" section near the bottom of the page.

Should be able to split the 3/6, 5/10, and 7/14 character positions and then do something with them. But I'm still trying to understand how.


Or... maybe something from here: http://lua-users.org/wiki/PatternsTutorial

Cindy
Posts: 237
Joined: Fri Sep 28, 2012 4:23 pm

Re: Ostrich Nurse

#5 Post by Cindy » Sat Dec 01, 2012 5:53 pm

I don't know how lua does it, but in a typical language, strings are an array of characters, should be able to somehow get

Code: Select all

current_index = 0  -- assumes C++ style 0 based indexing
s_size = strlen(thestring)
while current_index < s_size do
    ostrichcmd = thestring[current_index ]..thestring[current_index +1]
    respondto(ostrichcmd)
    yrest(aslongasthecastbaris)
    current_index  += 2  (can lua do this?)
end
Last edited by Cindy on Sat Dec 01, 2012 6:06 pm, edited 1 time in total.

Cindy
Posts: 237
Joined: Fri Sep 28, 2012 4:23 pm

Re: Ostrich Nurse

#6 Post by Cindy » Sat Dec 01, 2012 6:06 pm

bingo!

Code: Select all

ostrichcmd = string.sub(thestring, current_index, current_index+1)
Now if only I knew how to get the string from the game....

HTH

Cindy
Posts: 237
Joined: Fri Sep 28, 2012 4:23 pm

Re: Ostrich Nurse

#7 Post by Cindy » Sat Dec 01, 2012 6:21 pm

Ok im posting hte work in progress file in waypoints.

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

Re: Ostrich Nurse

#8 Post by lisa » Sat Dec 01, 2012 10:07 pm

grande wrote:It also increases the difficulty by incrementing the number of two-part symbols by two each time. Starts with three buttons to push, then five, then seven.

Example:

Code: Select all

***!**

***!*!-##-

#-*!#-**#-*!'*
so first line would need alt+4, alt+3, alt+4

Second line: alt+4, alt+3, alt+3, alt+1, alt+2

etc.. lol

I would probably use string.find
http://www.lua.org/manual/5.1/manual.ht ... tring.find

So for each action key you would look for the required characters.
From your example
** alt 4
*! alt 3
#- alt 2
-# alt 1

Since there can be more than 1 occurance of the same action you would do a loop until the string.find returns nil (using the 3rd argument of where to start searching in the string) , in the loop you could just add the returned value to a table, for easy ordering and then do the actions from the table.

So let's just say your "string" had this
#-*!#-**#-*!**
2 3 2 4 2 3 4
the string.find returns the position of what it is searching for, so

Code: Select all

text = "#-*!#-**#-*!**"
alt4 = string.find(text,"**") -- probably need to add in special character things because of looking for special characters.
print(alt4)
that should print 7 since the ** is found at the 7th "character" of the string.

Let's see if you can work it out from there, if you get stuck, post any questions you have.

--=== Added ===--
Yep you deffinately need to use special characters in the find.

Code: Select all

Command> text = "#-*!#-**#-*!**" alt4 = string.find(text,"**") print(alt4)
1 -- not right

Command> text = "#-*!#-**#-*!**" alt4 = string.find(text,"%*%*") print(alt4)
7 -- yay
So add in a % to each of the "characters"
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
grande
Posts: 261
Joined: Tue Jun 28, 2011 4:46 pm

Re: Ostrich Nurse

#9 Post by grande » Sat Dec 01, 2012 11:13 pm

Here's the alt+1 piece of the puzzle:

Code: Select all

keyboardPress( key.VK_1, key.VK_ALT );
so this part of cindy's script would be:

Code: Select all

	function respondto(ostrichcmd)
		--TODO: optimize this with a table?
		if     ostrichcmd == "-#" then keyboardPress( key.VK_1, key.VK_ALT );
		elseif ostrichcmd == "#-" then keyboardPress( key.VK_2, key.VK_ALT );
		elseif ostrichcmd == "*!" then keyboardPress( key.VK_3, key.VK_ALT );
		elseif ostrichcmd == "**" then keyboardPress( key.VK_4, key.VK_ALT );
		elseif ostrichcmd == "'*" then keyboardPress( key.VK_5, key.VK_ALT );
		else
			printf("You gave me garbage : "..ostrichcmd)
		end
	end

User avatar
grande
Posts: 261
Joined: Tue Jun 28, 2011 4:46 pm

Re: Ostrich Nurse

#10 Post by grande » Sat Dec 01, 2012 11:22 pm

I'm lost. Seems like the action at the WP1 of accepting to care for the ostrich would kick off the stuff in the onload section. All I can think is to make extra waypoints below to call out various functions.

frankensteined version of Cindy's script:

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
<onload>

function EVENTdetection()
repeat
local time, moreToCome, name, msg = EventMonitorCheck("EVENTdetect", "4,1")
if msg ~= nil then
if string.find(msg,"The ostrich tells you its wish:") then
parseostrichstring(thestr)
respondto(ostrichcmd)
end
if string.find(msg,"The time is up. Please get your reward from Ostrich Nurse") then
__WPL:setWaypointIndex(__WPL:findWaypointTag("GOTOSLEEP"));
end
end
until moreToCome == false
end

function startEVENTDetect()
      unregisterTimer("EVENTdetection");
      printf("EVENT detection started\n");
      EventMonitorStart("EVENTdetect", "CHAT_MSG_SYSTEM");
      registerTimer("EVENTdetection", secondsToTimer(15), EVENTdetection);
end

startEVENTDetect()


	function respondto(ostrichcmd)
		--TODO: optimize this with a table?
		if     ostrichcmd == "-#" then keyboardPress( key.VK_1, key.VK_ALT );
		elseif ostrichcmd == "#-" then keyboardPress( key.VK_2, key.VK_ALT );
		elseif ostrichcmd == "*!" then keyboardPress( key.VK_3, key.VK_ALT );
		elseif ostrichcmd == "**" then keyboardPress( key.VK_4, key.VK_ALT );
		elseif ostrichcmd == "'*" then keyboardPress( key.VK_5, key.VK_ALT );
		else
			printf("You gave me garbage : "..ostrichcmd)
		end
	end

	function parseostrichstring(thestr)
		s_size = string.len(thestr)
		for i = 1, s_size do
			cmd = string:sub(thestr, i, i + 1)
			respondto(cmd)
			yrest(3000) --TODO: need to find this value experimentally
			i = i + 2
		end
	end
</onload> 
	<!-- #  1 --><waypoint x="2437" z="1065" y="51">
	player:target_NPC("Ostrich Nurse")
	ChoiceOption(1); yrest(500) -- Ok, I would like to know...
	ChoiceOption(1); yrest(500) -- I got it.
	player:target_NPC("Ostrich waiting to be looked after")
	ChoiceOption(1); -- I will fulfill your wish.
	
	local gameisplaying = true
	while gameisplaying do
		thestr = "" --TODO: get string from game
		parseostrichstring(thestr)
		gameisplaying = true --TODO: figure out how to determine end of game.
	end
	</waypoint>
</waypoints>

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

Re: Ostrich Nurse

#11 Post by lisa » Sat Dec 01, 2012 11:32 pm

I like my way, simply because it is my way lmao

Code: Select all

--=== testing with predefined text ===--
--== it's value will be the result of system monitoring ===--
text = "#-*!#-**#-*!**" 
local pos = {} 
local spot = 1 
local position

--=== looking for action 1, -#
repeat 
	position = string.find(text,"%-%#", spot) 
	if position then spot = position + 1 pos[position]="UseExtraAction(1)" end 
until position == nil

spot = 1 -- reset position

--=== looking for action 2, #-
repeat 
	position = string.find(text,"%#%-", spot) 
	if position then spot = position + 1 pos[position]="UseExtraAction(2)" end 
until position == nil

spot = 1 -- reset position

--=== looking for action 3, *!
repeat 
	position = string.find(text,"%*%!", spot) 
	if position then spot = position + 1 pos[position]="UseExtraAction(3)" end 
until position == nil

spot = 1 -- reset position

--=== looking for action 4, **
repeat 
	position = string.find(text,"%*%*", spot) 
	if position then spot = position + 1 pos[position]="UseExtraAction(4)" end 
until position == nil

--=== use action skills here ===--
for i = 1, #text-1, 2 do
	--print(pos[i])
	RoMScript(pos[i])
	yrest(500)
end
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
grande
Posts: 261
Joined: Tue Jun 28, 2011 4:46 pm

Re: Ostrich Nurse

#12 Post by grande » Sat Dec 01, 2012 11:51 pm

lol, hope Cindy understands that. I think I'm sitting at the kids table wondering what the adults are talking about ;/

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

Re: Ostrich Nurse

#13 Post by lisa » Sun Dec 02, 2012 12:03 am

short explanation:
it turns this

Code: Select all

"#-*!#-**#-*!**" 
into

Code: Select all

RoMScript("UseExtraAction(2)")
RoMScript("UseExtraAction(3)")
RoMScript("UseExtraAction(2)")
RoMScript("UseExtraAction(4)")
RoMScript("UseExtraAction(2)")
RoMScript("UseExtraAction(3)")
RoMScript("UseExtraAction(4)")
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
grande
Posts: 261
Joined: Tue Jun 28, 2011 4:46 pm

Re: Ostrich Nurse

#14 Post by grande » Sun Dec 02, 2012 12:04 am

Thanks, but how do we make it read the string from the game Notice:

The string is random. Should this change in the event monitor to include some variance/random symbols that actually print?

Code: Select all

if string.find(msg,"The time is up. Please get your reward from Ostrich Nurse") then
That quote is what is in the eventmonitor but what actually prints in game is more like:

Code: Select all

Notice:The ostrich tells you its wish:-#**#-


Then some time goes by and it prints another message but with four more symbols and then one last time with four more symbols, 3-5-7

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

Re: Ostrich Nurse

#15 Post by lisa » Sun Dec 02, 2012 12:15 am

grande wrote:Then some time goes by and it prints another message but with four more symbols and then one last time with four more symbols, 3-5-7
So the number of symbols is defined each time, bah I did a bit of overkill in my code then lmao

Are you getting it to print the messages with the monitoring?
If so it should be pretty simple after that.
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
grande
Posts: 261
Joined: Tue Jun 28, 2011 4:46 pm

Re: Ostrich Nurse

#16 Post by grande » Sun Dec 02, 2012 12:50 am

lisa wrote: Are you getting it to print the messages with the monitoring?
If so it should be pretty simple after that.
No, that's what I'm trying to understand since the previous examples I can recall don't actually printing the full system message... it just prints what the test tells it to print.

I'm thinking this is almost what to use to test it but i know the print part is wrong. Or.. even after I do get it to print what the game has printed I'm clueless on what to do with it.. but maybe one--step... ugh...

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
	<!-- #  1 --><waypoint x="2437" z="1065" y="51"> EventMonitorStart("Test", "CHAT_MSG_SAY");
	player:target_NPC("Ostrich Nurse")
	ChoiceOption(1); yrest(500) -- Ok, I would like to know...
	ChoiceOption(1); yrest(500) -- I got it.
	player:target_NPC("Ostrich waiting to be looked after")
	ChoiceOption(1); -- I will fulfill your wish.
local time, moreToCome, msg = EventMonitorCheck("Test", "1") if string.find(msg, "The ostrich tells you its wish:") then 

printf("PRINT SOMETHING USEFUL HERE?? BUT WHAT WOULD YOU DO WITH IT AFTER THIS LOL")
player:sleep()
end
</waypoint>
</waypoints>

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

Re: Ostrich Nurse

#17 Post by lisa » Sun Dec 02, 2012 1:17 am

you need to work out what type of chat the ostrich is using, I can tell you it isn't any of these.

Code: Select all

		EventMonitorStart("EVENTdetect1", "CHAT_MSG_EMOTE") 
		EventMonitorStart("EVENTdetect2", "CHAT_MSG_SALE")
		EventMonitorStart("EVENTdetect3", "CHAT_MSG_SAY")
		EventMonitorStart("EVENTdetect4", "CHAT_MSG_SYSTEM_GET")
		EventMonitorStart("EVENTdetect4", "CHAT_MSG_SYSTEM_VALUE")
		EventMonitorStart("EVENTdetect5", "CHAT_MSG_SYSTEM")
when it says it isn't happy or is happy with you that is the CHAT_MSG_SYSTEM.
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
grande
Posts: 261
Joined: Tue Jun 28, 2011 4:46 pm

Re: Ostrich Nurse

#18 Post by grande » Sun Dec 02, 2012 1:31 am

Lisa, can you please show me what the code looks like when you ran all those tests?

These are all the chat_msg options that I see available for me to try (--exclude the ones I bet are not it):

--CHAT_MSG_CHANNEL_JOIN
--CHAT_MSG_CHANNEL_LEAVE
--CHAT_MSG_CHANNEL
CHAT_MSG_COMBAT
CHAT_MSG_EMOTE
CHAT_MSG_GM_TALK
CHAT_MSG_GM
--CHAT_MSG_GUILD
--CHAT_MSG_LFG
CHAT_MSG_LOOT
--CHAT_MSG_PARTY
--CHAT_MSG_RAID
CHAT_MSG_SALE
--CHAT_MSG_SAY
CHAT_MSG_SYSTEM_GET
CHAT_MSG_SYSTEM_VALUE
--CHAT_MSG_SYSTEM
--CHAT_MSG_WHISPER_INFORM
--CHAT_MSG_WHISPER_OFFLINE
--CHAT_MSG_WHISPER
--CHAT_MSG_YELL
--CHAT_MSG_ZONE

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

Re: Ostrich Nurse

#19 Post by lisa » Sun Dec 02, 2012 1:40 am

Code: Select all

		function testevent()
			local time, moreToCome, name, msg1 = EventMonitorCheck("EVENTdetect1", "4,1")
			local time, moreToCome, name, msg2 = EventMonitorCheck("EVENTdetect2", "4,1")
			local time, moreToCome, name, msg3 = EventMonitorCheck("EVENTdetect3", "4,1")
			local time, moreToCome, name, msg4 = EventMonitorCheck("EVENTdetect4", "4,1")
			local time, moreToCome, name, msg5 = EventMonitorCheck("EVENTdetect5", "4,1")
			if msg1 then print("1 "..msg1) end
			if msg2 then print("2 "..msg2) end
			if msg3 then print("3 "..msg3) end
			if msg4 then print("4 "..msg4) end
			if msg5 then print("5 "..msg5) end
		end
		EventMonitorStart("EVENTdetect1", "CHAT_MSG_WHISPER_INFORM") 
		EventMonitorStart("EVENTdetect2", "CHAT_MSG_WHISPER")
		EventMonitorStart("EVENTdetect3", "CHAT_MSG_YELL")
		EventMonitorStart("EVENTdetect4", "SYSTEM_MESSAGE")
		EventMonitorStart("EVENTdetect5", "CHAT_MSG_SYSTEM")
		registerTimer("EVENTdetection", secondsToTimer(1), testevent);
So I test 5 at a time

Code: Select all

CHAT_MSG_CHANNEL_JOIN 
CHAT_MSG_CHANNEL_LEAVE 
CHAT_MSG_CHANNEL 
CHAT_MSG_COMBAT 
CHAT_MSG_EMOTE 
CHAT_MSG_GM_TALK 
CHAT_MSG_GM 
CHAT_MSG_GUILD 
CHAT_MSG_LFG 
CHAT_MSG_LOOT 
CHAT_MSG_PARTY 
CHAT_MSG_RAID 
CHAT_MSG_SALE 
CHAT_MSG_SAY 
CHAT_MSG_SYSTEM_GET 
CHAT_MSG_SYSTEM_VALUE 
CHAT_MSG_SYSTEM 
CHAT_MSG_WHISPER_INFORM 
CHAT_MSG_WHISPER_OFFLINE 
CHAT_MSG_WHISPER 
CHAT_MSG_YELL 
CHAT_MSG_ZONE 
CHAT_MSN_ADDBUTTON 
CHAT_MSN_ADDITEMLINK 
CHAT_MSN_ADD 
CHAT_MSN_CLOSE 
CHAT_MSN_ITEMPREVIEW 
CHAT_MSN_OPEN 
CHAT_MSN_POPUP 
CHAT_MSN_SMALL 
SYSTEM_MESSAGE 
those are the ones I know about, probably more.
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
grande
Posts: 261
Joined: Tue Jun 28, 2011 4:46 pm

Re: Ostrich Nurse

#20 Post by grande » Sun Dec 02, 2012 1:43 am

Thanks again Lisa. Bed time here. I'll take another whack at it in a few hours.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 23 guests