Código:
; | / \ | .
; _ -O- . ) (( )) ( -O-
; (@) | + /|\ ))_(( /|\ | .
; |-| / | \ (/\|/\) / | \ (@)
; | | --------------------------/--|-voV---\`|'/--Vov-|--\---------------------------|-| .
; |-| '^` (o o) '^` | |
; | | `\Y/' |-|
; |-| _______ __ __ __ _______ __ __ | |
; | | | | | | |_|__|.--------.---.-.| _ | |__|.---.-.-----.-----.---.-. |-| . o
; |-| | | | | _| || | _ || | | || _ | |-- __| _ | | |
; | | |_______|__|____|__||__|__|__|___._||___|___|__|__||___._|__|__|_____|___._| |-|
; |_|________________________________________________________________________________| |
; (@) l /\ / ( ( \ /\ l `\|-| .
; o l / V \ \ V \ l + (@)
; l/ _) )_ \I +
; + `\ /'
;
; Script Name: Sastreria "Multi Vendor"
; ____
; / __ \
; ( (__) |___ ___
; \________,' """""----....____
; _______< () dd ____----'
; / __ __`.___-----""""
; ( (__) |
; \____/
;
; Author: Sthil Lauda
; Version: 1.5
; Client Tested with: 2.0.3
; EUO version tested with: EasyUO 1.5 Version 243
; Shard: Ultima Alianza ¡Hasta la muerte!
; Revision Date: 14/02/2019
; Public Release: 15/02/2019
; Purpose: Subir la skill de Sastrería fabricando bandanas y vendiéndolas :-)
;
set %version 1.5
;________________________________
;
; ///////////////////////////////
; ************** CONFIGURACIÓN **************
; ///////////////////////////////
;________________________________
;
; LUGAR DE MACREO: ~~> Sastrería de Nujel'm <~~ [ Tiene 3 vendors ^^ ]
;
set %tiempo_alimentacion 360 ; Cada cuántos segundos va a comprobar si tiene hambre.
set %bandanas_vender 50 ; Máximo de bandanas en la mochila antes de venderlas.
set %ignora_vendor_x 3773 ; La posición X de un NPC que es comerciante, pero no vende telas, y que por tanto hay que ignorar. [ Configurado para la sastrería de Nujel'm ]
set %ignora_vendor_y 1260 ; La posición Y de un NPC que es comerciante, pero no vende telas, y que por tanto hay que ignorar. [ Configurado para la sastrería de Nujel'm ]
;
; Modo "Friki" [ Saluda al vendor, da las gracias, etc ]
;
set %friki_mode #TRUE ; [ #TRUE = ON | #FALSE = OFF ]
set %tecla_saludo_1 b ; Macro "Bow".
set %tecla_saludo_2 ctrl
set %tecla_macreo_3 s ; Macro "Salute".
set %tecla_macreo_4 ctrl
;________________________________________________
;
; //////////////////////////////////////////////
; ************************* FIN CONFIGURACIÓN *************************
; //////////////////////////////////////////////
;________________________________________________
;
set %comida RGG_NRD_QSD_ZBG_WLI_QRD_END_FUD_YLI_WLI_HGI
+_KGI_EGI_QLI_KLI_MLI_KRD_HQD_AQD_MQE_VQE_TQE_JQE_IQE
+_GQE_SPE_ZPE_OQE_BDF_KPE_RQE_YSD_SQD_YWI_AXI_PQD_QQD
set %rollo_tela ZZF
set %tela RTI
set %kit_costura HAG
set %bandana TDI
set %sombreros_x 70
set %sombreros_y 230
set %bandana_x 270
set %bandana_y 110
set %fabricar_ultimo_x 326
set %fabricar_ultimo_y 495
set %start_macro 0
set %start_vendor 0
set %tiempo_actual #SCNT
set %proxima_vez #SCNT
set #SYSMSGCOL 88
event sysmessage =====================
event sysmessage Sastreria %version
event sysmessage =====================
wait 2s
ignoreitem reset
ignoreitem #CHARID ; Quitamos nuestro PJ de la lista de NPC's...
gosub cerrar_ventanas
set #SYSMSGCOL 53
event sysmessage Buscando vendor...
wait 10
gosub busca_vendor ; Buscamos un vendor en un radio de 15 tiles
set #SYSMSGCOL 73
event sysmessage Limpiando zona de macreo...
wait 10
gosub recoger ; Limpiamos el suelo de tela por si las moscas... XD
set #SYSMSGCOL 23
event sysmessage Comprobando hambre...
wait 10
gosub comprobar_comida ; Alimentación del PJ...
; Comprobar la suerte ( Influye muy poquito en el crafteo, pero algo es algo... )
if ( #LUCK < 75 ) ; 75 es una armadura de oro, se le puede añadir escudo o mejor una ballesta o arco de oro, etc ^^
{
set #SYSMSGCOL 1264
event sysmessage ===============================
event sysmessage Llevas poca suerte encima :-(
event sysmessage ===============================
wait 2s
display OK Si puedes, intenta conseguir una armadura de oro.$
}
;========================================================
;
; ************************************* LOOP PRINCIPAL **************************************
;
;========================================================
inicio:
chooseskill Tail real
if #SKILL >= 1000
{
display ¡Somos GM Tailor! :-) ; Hemos terminado.
gosub cerrar_ventanas
halt
}
finditem %vendor_id G_1 ; Monitorizamos el vendor con el que estamos macreando...
if #findkind <> 1 ; Si no encontramos un vendor cerca...
{
gosub busca_vendor ; lo buscamos sin parar en un radio de 15 tiles
}
gosub material ; Reponer telas y kit's de costura
gosub coser ; Craftear bandanas
goto inicio
;========================================================
;
; ******************************** FIN LOOP PRINCIPAL ********************************
;
;========================================================
sub material ;<=========================>
finditem %tela C_ , #BACKPACKID
if #FINDSTACK < 4
{
if ( %friki_mode )
{
key %tecla_macreo_3 %tecla_macreo_4
}
event macro 1 0 %nombre_vendor buy
gosub wait_for GUMP 800_590 20
click 397 258 ; Rollo de tela
gosub wait_for GUMP 800_590 20
click 601 537 ; Botón "OKAY"
if ( %friki_mode )
{
event macro 1 0 Gracias, milord
key %tecla_saludo_1 %tecla_saludo_2
}
gosub cortar ; Cortamos los rollos de tela.
gosub recoger ; Buscamos en el suelo por si se han caído, etc... XD
}
finditem %kit_costura C_ , #BACKPACKID
if #FINDCNT < 2
{
if ( %friki_mode )
{
key %tecla_macreo_3 %tecla_macreo_4
}
event macro 1 0 %nombre_vendor buy
gosub wait_for GUMP 800_590 20
click 398 138 ; Kit de costura
gosub wait_for GUMP 800_590 20
click 398 138 ; Kit de costura
gosub wait_for GUMP 800_590 20
click 398 138 ; Kit de costura
gosub wait_for GUMP 800_590 20
click 398 138 ; Kit de costura
gosub wait_for GUMP 800_590 20
click 398 138 ; Kit de costura
gosub wait_for GUMP 800_590 20
click 398 138 ; Kit de costura
gosub wait_for GUMP 800_590 20
click 398 138 ; Kit de costura
gosub wait_for GUMP 800_590 20
click 398 138 ; Kit de costura
gosub wait_for GUMP 800_590 20
click 398 138 ; Kit de costura
gosub wait_for GUMP 800_590 20
click 398 138 ; Kit de costura
gosub wait_for GUMP 800_590 20
click 601 537 ; Botón "OKAY"
if ( %friki_mode )
{
event macro 1 0 Gracias, milord
key %tecla_saludo_1 %tecla_saludo_2
}
}
return
sub coser ;<=========================>
if %start_macro = 0 ; Si acabamos de arrancar la macro...
{
Costura:
finditem %kit_costura C_ , #BACKPACKID
if #FINDCNT > 0
{
set #LOBJECTID #FINDID
event macro 17
target 3s
finditem %tela C_ , #BACKPACKID
if #FINDKIND = -1 ; Si no hay telas, ni lo intentamos.
{
return
}
set #LTARGETID #FINDID
set #LTARGETKIND 1
event macro 22
gosub wait_for GUMP 530_480 20
click %sombreros_x %sombreros_y ; Sub menú de Sombreros.
gosub wait_for GUMP 530_480 20
click %bandana_x %bandana_y ; Item Bandana.
gosub wait_for GUMP 530_480 100
set %start_macro 1
}
}
else
{
if ( #CONTNAME <> generic_gump ) && ( #CONTSIZE <> 530_480 ) ; Si el menú de crafteo está cerrado
{
goto Costura
}
click %fabricar_ultimo_x %fabricar_ultimo_y ; Fabricar último item.
gosub wait_for GUMP 530_480 100
finditem %bandana C_ , #BACKPACKID
if ( #FINDCNT >= %bandanas_vender ) ; Si llegamos al límite de bandanas...
{
gosub busca_vendor ; Comprobamos si hay un vendor.
gosub vender ; Se las vendemos...
}
}
return
sub vender ;<=========================>
set %tiempo_actual #SCNT
if ( %proxima_vez <= %tiempo_actual )
{
gosub comprobar_comida
}
finditem %bandana C_ , #BACKPACKID
if ( #FINDCNT >= %bandanas_vender )
{
if ( %friki_mode )
{
key %tecla_macreo_3 %tecla_macreo_4
}
event macro 1 0 %nombre_vendor sell
gosub wait_for GUMP 800_590 20
click 329 580 ; Sexta página del menú de vender
gosub wait_for GUMP 800_590 20
click 376 151 ; Seleccionar las bandanas
gosub wait_for GUMP 800_590 20
click 601 537 ; Botón "OKAY"
if ( %friki_mode )
{
event macro 1 0 Gracias, milord
key %tecla_saludo_1 %tecla_saludo_2
}
}
return
; Busca, selecciona un vendor, y se acerca hasta él.
sub busca_vendor ;<=========================>
_busca_vendor:
finditem HS_IS G_15
if #findkind <> -1
{
if ( #findrep = 1 )
{
set %vendor_id #FINDID
event property %vendor_id
set %string #property
gosub split %string $ Propiedades
set %nombre_vendor %PROPIEDADES1
set %pos_vendor_x #FINDX ; Coordenada X del vendor
set %pos_vendor_y #FINDY ; Coordenada Y del vendor
; Ignoramos todo lo que no sea un vendor, o uno que hay en la sastrería pero que no vende telas ¬¬ ... XD
if ( Comerciante Notin %PROPIEDADES2 ) || ( %pos_vendor_x = %ignora_vendor_x && %pos_vendor_y = %ignora_vendor_y )
{
ignoreitem %vendor_id
goto _busca_vendor ; Repetimos...
}
; Hemos localizado un vendor...
set %pos_vendor_x %pos_vendor_x - 1
set %pos_vendor_y %pos_vendor_y - 1
_acercarse:
if #FINDDIST > 1
{
set %start_vendor 0 ; Parece un nuevo vendor...
set %jstart #jindex ; Marcamos el inicio del diario.
event pathfind %pos_vendor_x %pos_vendor_y
gosub wait_for MSG GET_THERE 3 ; Si no podemos llegar a este vendor, lo ignoramos...
if ( #TRUE in #RESULT )
{
ignoreitem %vendor_id
goto _busca_vendor ; Repetimos...
}
goto _acercarse
}
if %start_vendor = 0 ; Mostramos el nombre del vendor...
{
set #sysmsgcol 43
event sysmessage OK Vendor: %nombre_vendor
wait 20
set %start_vendor 1
}
}
else ; No parece ser un vendor...
{
ignoreitem %vendor_id
goto _busca_vendor ; Repetimos...
}
}
else ; Si no hay un vendor cerca
{
wait 1s ; Esperamos hasta que aparezca alguno...
goto _busca_vendor
}
return
; Recoger montón de telas del suelo.
sub recoger ;<=========================>
_recoge:
finditem %tela G_2
if #FINDKIND <> -1
{
exevent drag #FINDID #FINDSTACK
exevent dropc #BACKPACKID
wait 30
goto _recoge
}
return
; Convertir un rollo de tela en un stack de Telas.
sub cortar ;<=========================>
_corta:
finditem %rollo_tela C_ , #BACKPACKID
if #FINDKIND <> -1
{
set #LOBJECTID #FINDID
event macro 17 0
wait 20
goto _corta
}
return
; Cerrar menús del vendor y de craftear.
sub cerrar_ventanas ;<=========================>
gosub wait_for GUMP 800_590 10 ; Cerrar el menú del vendor
if ( #TRUE in #RESULT )
{
click 601 537
gosub wait_for GUMP 800_590 CLOSE
}
gosub wait_for GUMP 530_480 CLOSE ; Cerrar el menú de craftear
gosub wait_for GUMP 800_590 10 ; Cerrar el menú del vendor
if ( #TRUE in #RESULT )
{
click 601 537
gosub wait_for GUMP 800_590 CLOSE
}
gosub wait_for GUMP 530_480 CLOSE ; Cerrar el menú de craftear
return
;=====================================================
; Rutina para, en caso de hambre, comer hasta saciarse
;=====================================================
; v2.2
sub comprobar_comida ;<=========================>
{
hambriento:
set %jrnl #jindex ; Marcamos un índice de las líneas del diario.
event macro 4 0 .hungry
wait 20
while #true
{
if #jindex > %jrnl ; Si aparece una nueva línea.
{
set %jrnl %jrnl + 1 ; Seleccionamos ese numero de línea.
scanjournal %jrnl ; La leemos...
if Dentro_de_1_minuto in #journal
{
wait 120s ; Save del server...
}
if Estas_no_le_afecta_el_hambre in #journal || Estas_tan_lleno_que_no_puedes in #journal || Estas_totalmente_saciado in #journal
{
set %proxima_vez %tiempo_actual + %tiempo_alimentacion
return
}
else
{
if Estas_lleno in #journal || Estas_contento in #journal || Estas_en_inanicion in #journal || Estas_hambriento in #journal || Sientes_mucho in #journal || Estas_con_hambre in #journal || Estas_parcialmente in #journal || Estas_bien_lleno in #journal || Te_sientes_casi_lleno in #journal
{
finditem %comida C_ , #backpackid
if #findcnt > 0
{
set #lobjectid #findid
event macro 17
wait 20
goto hambriento
}
else
{
event exmsg #charid 3 48 COMPRA COMIDA!!
wait 40
set %proxima_vez %tiempo_actual + %tiempo_alimentacion
}
}
else ; Mensaje extraño, repetimos...
{
goto hambriento
}
}
}
return
} ; FIN While
}
return
;[email protected] ============================== @-;
;[email protected] ############################## @-;
;[email protected] SUBS públicos del Foro EasyUO @-;
;[email protected] ############################## @-;
;[email protected] ============================== @-;
;
;**
;* Splits a string by a divider into an array and
;* copies the result into the desired namespace
;* @param %1 The string to split
;* @param %2 Divider
;* @param %3 Array name
;* @param %4 {optional} Result namespace. If no
;* namespace is given it will create the
;* array using the %-notation
;* @sideEffects Creates a number of variables
;* with name as given in %3 followed by
;* a digit
;* @returns The length of the array
sub split
namespace Push
namespace Local split , #systime
set !lpc #lpc
if #lpc < 500
set #lpc 500
set !string %1
set !divider %2
set !arrayName %3
if %0 > 3
set !namespace %4
else
set !namespace #false
set !length 0
repeat
{
set !length !length + 1
str Pos !string !divider 1
if #strRes = 0
{
set !done #true
set ! . !arrayName , !length !string
}
else
{
set !pos #strRes
set !len !pos - 1
str Left !string !len
set ! . !arrayName , !length #strRes
str Del !string 1 !pos
set !string #strRes
}
}
until ( !done = #true )
set #result !length
if !namespace <> #false
{
namespace Copy !arrayName , * To Local !namespace
}
else
{
for !i 1 #result
{
set !value !arrayName , !i
set % . !arrayName , !i ! . !value
}
}
set #lpc !lpc
namespace Clear
namespace Pop
return #result
sub waitForSysVar
if %0 < 4 || %4 = N/A
set %4 %_defaultWaitForTimeout
if %0 < 5
set %5 return
set %4 #sCnt2 + %4
_waitForSysVar:
set % . %5 # . %1 %2 %3
if ! % . %5 && #sCnt2 < %4
{
Wait 1
goto _waitForSysVar
}
return
;=================================================================
sub wait_for
;=================================================================
; This "wait_for" sub package was created by Locke. If you use these subs please keep this header intact.
; Documentation: the sub package grew to large with all the comments. To load them call the sub like this:
; gosub wait_for docs | or you can use doc, documention, what, or my personal favorite, kickass.
; "wait_for core dispatcher" version 1.2 by Locke
if %1 = doc || if %1 = docs || if %1 = documentation || if %1 = what || if %1 = kickass
{
Display ok Please click ok and wait for your browser to start.
execute http://www.easyuo.com/forum/viewtopic.php?t=24716
halt
}
nameSpace Push
namespace local LLNS
set #result N/A ; if #result isn't set by one of my wait_for subs it'll throw an error.
set !LPC #lpc
set #lpc 200
for %i 0 %0
set !_A . %i % . %i
gosub wait_for_ , !_A1
set #lpc !lpc
namespace clear LLNS
namespace pop
if #result <> N/A
return #result
else
display ok You specified an unknown wait_for command. Script returned #result and is halting.
halt
;=================================================================
sub wait_for_MSG ; version 1.4 ~Locke
;=================================================================
if !_A0 < 3
{
display ok You haven't specified enough vars.$
+The basic format is: gosub wait_for MSG %message time_out_in_seconds$
+Script is halting
halt
}
set !_timeout ( #scnt + !_A . !_A0 )
_lets_wait_for_a_message:
for %i %jstart #jindex
{
scanjournal %i
for %ii 2 !_A0
{
if !_A . %ii in #journal && %jstart <> %i
set #result #true , #spc , !_A . %ii
}
}
if #true notin #result
{
set #result #false
if !_timeout =< #scnt
return #result
wait 1
goto _lets_wait_for_a_message
}
else
return #result
wait 1
goto _lets_wait_for_a_message
;======================================================================
sub wait_for_GUMP ; version 1.4 ~Locke
;=================================================================
; Añadido #CONTID para "sub abrir_cofre"
if !_A0 < 3
{
display ok You haven't specified enough vars.$
+The basic format is: gosub wait_for GUMP XXX_YYY time_out_in_seconds$
+Script is halting
halt
}
if !_A3 <> CLOSE
set !_timeout #scnt2 + !_A3
else
set !_timeout 0 ; no gump wait if %3 = CLOSE since we already believe it to be open.
_lets_wait_for_a_gump:
if #CONTSIZE = !_A2 || #CONTKIND = !_A2 || #CONTNAME = !_A2 || #CONTTYPE = !_A2 || #CONTID = !_A2
{
if !_A5 <> N/A && !_A6 <> N/A
{
set !clickx !_A5 + #contposx
set !clicky !_A6 + #contposy
click !clickx !clicky
}
if !_A3 = CLOSE || if !_A4 = CLOSE || !_A5 = CLOSE || !_A6 = CLOSE
{
set !string #contsize
str pos !string _
set !pos #strres
str del !string #strres #strres
set !clickX #contposx + ( #strres / 2 )
str del !string 1 !pos
set !clickY #contposy + ( #strres / 2 )
click !clickx !clicky R
}
return #true
}
if ( !_timeout =< #scnt2 ) && ( !_A4 = N/A )
{
return #false
}
if !_A4 <> N/A && !_timeout =< #scnt2
{
finditem !_A4
if #findkind <> -1
{
for #findindex 1 #findcnt
{
if #finddist > 2
ignoreitem #findid LLWAITFOR
else
break
}
set #lobjectid #findid
event macro 17 0
set !_timeout #scnt2 + !_A3
}
else
return #false
}
wait 1
goto _lets_wait_for_a_gump
Saludos!