iRO - Hugel Troy RPS game macro

Moderator: Moderators

Message
Author
rastalo
Noob
Noob
Posts: 3
Joined: 29 Jun 2008, 08:14
Noob?: No

iRO - Hugel Troy RPS game macro

#1 Post by rastalo »

Hello every1,

I've been working on this macro since the double xp end, and finaly, with the aid of the old forum, i'm finally successfull to make a nice macro for this game.

Thanks to ezza and everyone for the posts about general macro coding, regexp & eval using and all the stuff :ugeek:

This macro must be call with : macro hugelTroy (maybe because it's the main macro who start talking to the npc :roll: )
You should type nl before to make sure that TroyNPC is number 0 otherwise it will not talk with the right npc.
Autotalkcont MUST BE OFF. The best is to have a config that do absolutly nothing, no move, no storage etc ...




What this macro do :
-Talk to Troy, and make you start playing the game
-Start with shield answer, in case troy shows 'whats going on' option, bc he'll chose bow so you win
-Log troy's last answer
-Take care about the 'whats going on' option so you win the round
-Change answer if troy win because he will answer the same if we don't change
-Count & show how many times you have play each time you start again
-Loop again and again and again untill you, you're computer, or troy are dead (note : if you are dead irl, macro will still run)

Here the code :twisted:

Code: Select all


###################################################
#
# macro for hugel minigames npc
# made by rastalo
# Using OpenKore 2.0.1
# Using Macro Plugin 1.3.5a
# U CAN USE THIS MACRO ONLY IF YOU AGREE WITH THE GENERAL OPEN SOURCE DISCLAMER
#
# created : 24/06/2008
# last modified : 29/06/2008
#

########################
# auto-answer for playing the game

#answer r1 to play
automacro TroyRespGame {
	console /Game rules/
	call TroyRespGameB
}

macro TroyRespGameB {
#	pause 1
	do talk resp 1
	do talk cont
}

#answer r0 to play
automacro TroyRespPay {
	console /Do Not Pay/
	call TroyRespPayB
}

########################
# keep track of troy's last answer

macro TroyRespPayB {
#	pause 1
	do talk resp 0
	do talk cont
	release TroyResp
	do talk cont
}


automacro Troysword {
	console /Troy#fes: Sword!/
	call TroyswordB
}

macro TroyswordB {
	$troyLast = sword
	call TroyRespC
}

automacro Troyshield {
	console /Troy#fes: Shield!/
	call TroyshieldB
}

macro TroyshieldB {
	$troyLast = shield
	call TroyRespC
}

automacro Troybow {
	console /Troy#fes: Bow!/
	call TroybowB
}

macro TroybowB {
	$troyLast = box
	call TroyRespC
}

########################
# if option 'whats going on' show up,
# calculate the winnin resp

automacro WhatsG0 {
	console /0\s\swhat/
	call WhatsG0B
}

automacro WhatsG1 {
	console /1\s\swhat/
	call WhatsG1B
}

automacro WhatsG2 {
	console /2\s\swhat/
	call WhatsG2B
}

automacro WhatsG3 {
	console /3\s\swhat/
	call WhatsG3B
}

macro WhatsG0B {
	#whats going on is choice 0
	#move up all aswers
	if ($troyLast == sword) goto T0Going1
	if ($troyLast == shield) goto T0Going2
	if ($troyLast == box) goto T0Going3
	:T0Going1
	# dernier choix sword
	$switch = 3
	goto T0GoingEnd
	:T0Going2
	# dernier choix shield
	$switch = 1
	goto T0GoingEnd
	:T0Going3
	# dernier choix box
	$switch = 2
	goto T0GoingEnd
	:T0GoingEnd
	call TroyRespB
}

macro WhatsG1B {
	#whats going on is choice 1
	#move up aswers till 1
	if ($troyLast == sword) goto T1Going1
	if ($troyLast == shield) goto T1Going2
	if ($troyLast == box) goto T1Going3
	:T1Going1
	# dernier choix sword
	$switch = 3
	goto T1GoingEnd
	:T1Going2
	# dernier choix shield
	$switch = 0
	goto T1GoingEnd
	:T1Going3
	# dernier choix box
	$switch = 2
	goto T1GoingEnd
	:T1GoingEnd
	call TroyRespB
}
macro WhatsG2B {
	#whats going on is choice 2
	#move up aswers till 2
	if ($troyLast == sword) goto T2Going1
	if ($troyLast == shield) goto T2Going2
	if ($troyLast == box) goto T2Going3
	:T2Going1
	# dernier choix sword
	$switch = 3
	goto T2GoingEnd
	:T2Going2
	# dernier choix shield
	$switch = 0
	goto T2GoingEnd
	:T2Going3
	# dernier choix box
	$switch = 1
	goto T2GoingEnd
	:T2GoingEnd
	call TroyRespB
}
macro WhatsG3B {
	#whats going on is choice 3
	# => we don't care :)
	if ($troyLast == sword) goto T3Going1
	if ($troyLast == shield) goto T3Going2
	if ($troyLast == box) goto T3Going3
	:T3Going1
	# dernier choix sword
	$switch = 2
	goto T3GoingEnd
	:T3Going2
	# dernier choix shield
	$switch = 0
	goto T3GoingEnd
	:T3Going3
	# dernier choix box
	$switch = 1
	goto T3GoingEnd
	:T3GoingEnd
	call TroyRespB
}

########################
# if 'whats going on' don't show up

automacro TroyResp {
	run-once 1
	console /3\s\sCancel Chat/
	call TroyRespNext
}

#make sure we don't answer cancel
macro TroyRespNext {
	if ($switch < 3) goto TroyRespSwitch
	$switch = 2
	:TroyRespSwitch
	call TroyRespB
}

########################
# respond to npc

macro TroyRespB {
	pause 1
	log switch is $switch
	if ($switch == 0) goto switch0
	if ($switch == 1) goto switch1
	if ($switch == 2) goto switch2
	if ($switch == 3) goto switch3
	:switch0
	do talk resp 0
	call TroyRespC
	:switch1
	do talk resp 1
	call TroyRespC
	:switch2
	do talk resp 2
	call TroyRespC
	:switch3
	do talk resp 3
	call TroyRespC
}

macro TroyRespC {
	do talk cont
	log  last answer is $troyLast
	do talk cont
#	pause 1
	release TroyResp
	do talk cont
}

########################
# in case of a tie: change answer for another

automacro TroyCollision {
	console /Troy#fes: A head-on collision!/
	call TroyColB
}

macro TroyColB {
	log COLLISION !!!!!!!!!!!
	if ($switch == 0) goto switchCol0
	if ($switch == 1) goto switchCol1
	if ($switch == 2) goto switchCol2
	if ($switch == 3) goto switchCol3
	:switchCol0
	$switch = @rand(0,2)
	if ($switch != 0) goto switchEnd
	$switch = 1
	goto switchEnd
	:switchCol1
	$switch = @rand(0,2)
	if ($switch != 1) goto switchEnd
	$switch = 2
	goto switchEnd
	:switchCol2
	$switch = @rand(0,2)
	if ($switch != 2) goto switchEnd
	$switch = 1
	goto switchEnd
	:switchCol3
	$switch = @rand(0,2)
	goto switchEnd
	:switchEnd
	log NEW Switch IS $switch
	call TroyRespC
}

########################
# If troy win, we need to change answer or it keep spamm and winning

automacro TroyWin {
	console /Hahaha, Troy wins!/
	call TroyWinB
}

macro TroyWinB {
	log TROY WIN !!!!!!!!!!!
	$temp = $switch
	:TroyWinR
	$switch = @rand (0,2)
	if ($switch == $temp) goto TroyWinR
	call TroyRespC
}



########################
# THIS IS THE START MACRO

macro hugelTroy{
#	pause 1
	$passe++
	log =============== PASSE NUM $passe ==============

	release TroyResp
	# default answer is shield
	$switch = 1
	$troyLast = box
	do talk 0
#	pause 1
	do talk cont
	do talk cont
#	pause 1
# on joue
#	do talk resp 1
#	do talk cont
#	pause 1
# on paye
#	do talk resp 0
#	do talk cont
#	do talk cont
#	pause 1
# passe 1
#	do talk resp 1
#	do talk cont
#	do talk cont
#	do talk cont
#	pause 1
# passe 2
#	do talk resp 1
#	do talk cont
#	do talk cont
#	do talk cont
#	pause 1
# passe 3
#	do talk resp 1
#	do talk cont
#	do talk cont
#	do talk cont
#	pause 1
# passe 4
#	do talk resp 1
#	do talk cont
#	do talk cont
#	do talk cont
#	pause 1
# passe 5
#	do talk resp 1
#	do talk cont
#	do talk cont
#	do talk cont
}

########################
# do it again again again again again again again again ...
# untill the comp is dead :-)
automacro TroyRestart {
	console /Done talking/
	call hugelTroy
}

About this code

-macro should be 348 lignes with the } of the automacro TroyRestart, if not, tell me because you are mess up

-all the pause 1 are commented out, because i use console log and XKore 1, so it's slow enough to not have to make pause.
If you encounter bugs like 'You are not talking to a npc', uncomment them, and/or and more pauses.

-All the comments parts in macro hugelTroy are a very basic macro for playing the game, who do not take care of anything else than doing resp 1 all the time

-You can improve this macro, but YOU MUST POST YOUR MODS DOWN THERE !

-I run it for 1 hour :
about 85 games
about 300 tickets

-Comments are welcome :lol:

Have fun earning tickets !

ezza
Developers
Developers
Posts: 109
Joined: 04 Apr 2008, 09:50

Re: iRO - Hugel Troy RPS game macro

#2 Post by ezza »

rastalo wrote:-Comments are welcome :lol:


You may wanna change the "\s\s" to "\s+" in the regexp .. more neat that way. Also you may packed the regexp in console /Troy#fes: (Sword|Bow|Shield)/ and then in macro ...

Code: Select all

$word = $.lastMatch1
if ($word = Sword) call sword
if ($word = Bow) call bow
if ($word = Shield) call shield

p.s: You are doing it fine btw ^^

rastalo
Noob
Noob
Posts: 3
Joined: 29 Jun 2008, 08:14
Noob?: No

Re: iRO - Hugel Troy RPS game macro

#3 Post by rastalo »

Also you may packed the regexp in console /Troy#fes: (Sword|Bow|Shield)/ and then in macro ...
Yes God you're right, maybe it was so simple that i forgot it.
But in my days of experiments it seems that all those regexp execute slower than 'normal' macro commands.

Any ideas to make execution faster ?

ezza
Developers
Developers
Posts: 109
Joined: 04 Apr 2008, 09:50

Re: iRO - Hugel Troy RPS game macro

#4 Post by ezza »

Actually I dont know how to answer that specifically... but, lessen the automacro block might help you alot which the 1 that I've suggested (packed regexp).



p.s: We have alot macro/perl expert viewing this forum... maybe they will help you giving those answers. Sorry :oops:

qwerty
Noob
Noob
Posts: 1
Joined: 17 Jun 2008, 16:38
Noob?: No

Re: iRO - Hugel Troy RPS game macro

#5 Post by qwerty »

Your code is way too long. I have 200 lines with 100% 24/7 working macro with auto dc checker and everything.

But I guess it works.

DelitaX
Human
Human
Posts: 48
Joined: 07 Apr 2008, 21:02
Noob?: No
Location: USA

Re: iRO - Hugel Troy RPS game macro

#6 Post by DelitaX »

sorry to ask but what is this rock paper scissors npc thing?
what can you win from it?

rastalo
Noob
Noob
Posts: 3
Joined: 29 Jun 2008, 08:14
Noob?: No

Re: iRO - Hugel Troy RPS game macro

#7 Post by rastalo »

@qwerty : if you macro is better, shorter, running faster or anyelse cool :

SHARE IT

sorry i don't understand why, i just dislike see someone saying : i'll do it better, but u can't see it.
This isn't constructive, don't allow others to understand their mistakes and all that stuff.

@DelitaX : Check iRO Wiki : http://irowiki.org/wiki/Main_Page
Look at the Current iRo event part !

gil
Noob
Noob
Posts: 5
Joined: 27 Jun 2008, 00:49
Noob?: No

Re: iRO - Hugel Troy RPS game macro

#8 Post by gil »

Mine dont check for DC but it's fast and short..auto talk cont must be set to 1. This does about 500+ tickets an hour, 96 lines but doesnt check for DC. I use this on XKore and initiate it manually by talking to the NPC and then clicking cancel. You need to do this so that when you are doing medals, you are actually facing the NPC. At night time, you need to add more randompauses to slow the script down. In the day time, just hide under people's chat boxes and nobody will ever know you are botting.



automacro donetalking{
console /^Troy.*Done talking/
call donetalking
}

macro donetalking{
call randompause
call rps
}

automacro responselist{
console /[3-4].*Cancel Chat/
call responselist
}

macro responselist{
$text = $.lastLogMsg
$whats = 9
do eval @aaa=split("\n", $::Macro::Data::varStack{text}); foreach(@aaa) { @l = split(" ", $_); $::Macro::Data::varStack{@l[1]}=@l[0]; };
if ($whats = "9") goto guess
if ($whats != "9") goto w

:w
call what
goto e

:guess
do talk resp $Shield

:e
}

automacro npcsword{
console /^Troy.*Sword\!/i
call npcsword
}

automacro npcshield{
console /^Troy.*Shield\!/i
call npcshield
}

automacro npcbow{
console /^Troy.*Bow\!/i
call npcbow
}

macro npcsword{
$last = sword
}

macro npcshield{
$last = shield
}

macro npcbow{
$last = bow
}

macro what{
if ($last = "shield") goto shield
if ($last = "sword") goto sword
if ($last = "bow") goto bow

:sword
do talk resp $Bow
goto end

:bow
do talk resp $Shield
goto end

:shield
do talk resp $Sword
goto end

:end
}

macro randompause{
$waittime = .1
pause $waittime
}

macro rps{
$last = bow
do talk @npc (121 116)
call randompause

do talk resp 1
call randompause
call randompause
do talk resp 0
call randompause
call randompause
}

Tenkai
Noob
Noob
Posts: 7
Joined: 07 Jul 2008, 02:02
Noob?: Yes

Re: iRO - Hugel Troy RPS game macro

#9 Post by Tenkai »

In the console your're constantly spammed with hundreds of Emotions from the RPS game. It is hard to watch it with the text moving so fast :shock: . I tried deleting the Emotions in the tables file but that just made them go to Emotion #12 ect.... Is there anyway to turn them off or fix this problem of extream scrolling?

gil
Noob
Noob
Posts: 5
Joined: 27 Jun 2008, 00:49
Noob?: No

Re: iRO - Hugel Troy RPS game macro

#10 Post by gil »

Tenkai wrote:In the console your're constantly spammed with hundreds of Emotions from the RPS game. It is hard to watch it with the text moving so fast :shock: . I tried deleting the Emotions in the tables file but that just made them go to Emotion #12 ect.... Is there anyway to turn them off or fix this problem of extream scrolling?

yes...
in config.txt
squelchDomains emotion


lol.... i had to figure all this stuff myself so i'll try to help in any way I can. I had no experience with macro until I realized the opportunity that hugel presented us

edit: btw.. this is not a macro thing. This is part of openkore

Post Reply