; ===================================================================================================== ; '|| ||` '||` || /.\ '||` ; || || || || '' // \\ || '' ; || || || ''||'' || '||),,(|, '''|. //...\\ || || '''|. `||''|, '''/ '''|. ; || || || || || || || || .|''|| // \\ || || .|''|| || || // .|''|| ; `|...|' .||. `|..' .||. .|| ||. `|..||. .// \\. .||. .||. `|..||. .|| ||. /... `|..||. ; ===================================================================================================== ; Script Name: Cocinar [Britain Bank] ; _ _ ; (c)___c____(c) ; \ ........../ ; |.........| ; |.......| ; |.......| ; |=======| ; |=======| ; __o)""""::? ; C__ c)::; ; >-- :: /\ ; (____/ /__\ ; } /""| |##| ; __/ (|V ^ )\ |##| ; o | _____/ |#/ / | |##| ; @ o_|}|_____/|/ / | |##| ; _____/ / | ~!!~ ; ======ooo}{|______)# | /`'\ ; ~~~~ ; ; ###---|8 "" ; ____;_____;____ ###==== /:|\ ; (///0///@///@///) ###@@@@| ; |~~~~~~~~~~~~~~~| ###@@@@| ; \ / ###@@@@| + ; \___________/ ###xxxxx /\ // ; H H H H ###|| | / \ // ; H H H H | || | /____\ /~_^_ ; H H H H C |C | _|@@|_ /__|#|_ ; H H H H || || /_|@@|_/___|#|/| ; v \/ H(o) (o) H || :: |:::::::::::::|#| ; ~ ~~ (o) (o) Ccc__)__) |ROMAN CANDLES|#| ; \|/ ~ @* & ~ |:::::::::::::|/ \|/ ; ~ \|/ !! \ !/ ~~~~~~~~~~~~~ ~~~ ; ~~~ ~~ ~~ ~~ ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ `"""""""` ; set %version v1.6 ; ; Author: Sthil Lauda ; Version: 1.6 ; Client Tested with: 2.0.3 ; EUO version tested with: 1.5 Version 142 ; Shard: Ultima Alianza (¡Hasta la muerte!) ; Fecha: 07/12/2019 ; Actualizada: 07/04/2020 ; Purpose: Cocina pescado y carne para subir la skill de cocinar. ; Instrucciones; Poner en el primer nivel del cofre del banco de Britain, un buen montón de filetes de pescado ; o filetes de carne cruda, troncos o ramas para encender el horno, y herramientas de cocinar en una bolsa. ; También le puedes cargar de peso a mano echándole al principio más herramientas o alimentos. ;------------------------------------------------------ ;________________________________ ; ; /////////////////////////////// ; ******** CONFIGURACIÓN ******** ; /////////////////////////////// ;________________________________ ; set %bolsa_herramientas NRTHUND ; Bolsa con herramientas de cocina en el primer nivel del cofre. set %bolsa_pergaminos_recompensa XGNDCPD ; Bolsa para dejar los pergaminos que da el horno, para subir 0.1 con cada uno de ellos. set %num_herramientas 20 ; Numero de sartenes, cazos, etc, en la mochila. set %stack_alimentos 600 ; Cantidad de alimentos y troncos a procesar en la mochila. set %stack_combustible 25 ; Cantidad de troncos o ramas en la mochila. set %tiempo_alimentacion 360 ; Cada cuantos segundos comprobar el hambre. ;________________________________________________ ; ; ////////////////////////////////////////////// ; ************* FIN CONFIGURACIÓN ************* ; ////////////////////////////////////////////// ;________________________________________________ ; set %horno BPB ; Tipo de Horno. set %combustible ZLK_PEF ; Troncos y ramas. set %alimentos_crudos IND_VRD ; Filetes de pescado crudo (IND), Filetes de carne cruda (VRD). set %alimentos_cocinados HND_YRD ; Filetes de pescado asado (HND), Filetes de carne asada (YRD). set %herramientas IRD_GRD_HRD_CRD_FRD_BRD_JRD ; Herramientas de Cocina. set %comida RGG_NRD_QSD_ZBG_WLI_QRD_END_FUD_YLI_WLI_HGI +_KGI_EGI_QLI_KLI_MLI_KRD_AQD_MQE_VQE_TQE_JQE_IQE +_GQE_SPE_ZPE_OQE_BDF_KPE_RQE_YSD_SQD_YWI_AXI_PQD_QQD +_HND_YRD_ set %tiempo_actual #SCNT set %proxima_vez #SCNT set *esperando #FALSE set %hid_timer #SCNT2 ; Reloj. set %bank_timer #SCNT ; Reloj. set #SYSMSGCOL 88 event sysmessage ============= set #SYSMSGCOL 53 event sysmessage Cocinar %version set #SYSMSGCOL 88 event sysmessage ============= wait 20 gosub setupBank ; Configuración de la posición del banco y el cofre. gosub setupHorno ; Configuración del Horno. ;======================================================== ; ; ******************* LOOP PRINCIPAL ******************** ; ;======================================================== loop: gosub checkskill gosub checkHungry finditem %ID_horno G_3 if #FINDCNT > 0 { finditem %combustible C_ , #BACKPACKID if #FINDCNT > 0 { set %ID_combustible #FINDID finditem %herramientas C_ , #BACKPACKID if #FINDCNT > 0 { set %ID_herramientas #FINDID finditem %alimentos_crudos C_ , #BACKPACKID if #FINDCNT > 0 { set %ID_alimentos_crudos #FINDID ; Comprobar el Horno... set #LOBJECTID %ID_horno set %jstart #jindex ; Comprobamos el horno. event macro 17 target gosub wait_for MSG esta_apagado no_esta_encendido esta_encendido 40 if ( #TRUE in #RESULT ) { if ( esta_apagado in #RESULT || no_esta_encendido in #RESULT ) { set #LTARGETID %ID_combustible set #LTARGETKIND 1 event macro 22 wait 20 set #LOBJECTID %ID_horno event macro 17 target goto _cocina } if ( esta_encendido in #RESULT ) ; Usar el Horno con los alimentos. { _cocina: finditem %alimentos_crudos C_ , #BACKPACKID if #FINDCNT = 0 { key ESC ; Limpiamos el puntero del target. goto loop } set #LTARGETID %ID_alimentos_crudos set #LTARGETKIND 1 event macro 22 set %jstart #jindex ; Esperamos a que el horno esté disponible de nuevo. gosub wait_for MSG Alimentas Selecciona El_horno_se_apaga esta_apagado no_esta_encendido Logras Pones Fallas 400 if ( #TRUE in #RESULT ) { if ( Selecciona in #RESULT ) { gosub selectPuchero set #LOBJECTID %ID_horno event macro 17 target goto _cocina } if ( Logras in #RESULT || Pones in #RESULT ) { goto loop } if ( Fallas in #RESULT ) { set #LOBJECTID %ID_horno event macro 17 target goto _cocina } if ( El_horno_se_apaga in #RESULT || esta_apagado in #RESULT || no_esta_encendido in #RESULT ) { goto loop } } } } } else ; Reponemos alimentos... { set #SYSMSGCOL 88 event sysmessage Reponiendo... wait 20 gosub goto_bank gosub dejarAlimentos gosub pillarDelBank %alimentos_crudos gosub pillarDelBank %herramientas gosub pillarDelBank %combustible } } else ; Reponemos herramientas... { set #SYSMSGCOL 88 event sysmessage Reponiendo... wait 20 gosub goto_bank gosub dejarAlimentos gosub pillarDelBank %herramientas gosub pillarDelBank %combustible gosub pillarDelBank %alimentos_crudos } } else ; Reponemos combustible... { set #SYSMSGCOL 88 event sysmessage Reponiendo... wait 20 gosub goto_bank gosub dejarAlimentos gosub pillarDelBank %combustible gosub pillarDelBank %herramientas gosub pillarDelBank %alimentos_crudos } } else { set #SYSMSGCOL 88 event sysmessage Moviendo hasta el horno... wait 20 gosub goto_horno } goto loop ;======================================================== ; ; ***************** FIN LOOP PRINCIPAL ***************** ; ;======================================================== sub selectPuchero ; Seleccionar la Herramienta de Cocina. finditem %herramientas C_ , #BACKPACKID if #FINDCNT > 0 { set %ID_herramientas #FINDID set #LOBJECTID %ID_horno event macro 17 target set #LTARGETID %ID_herramientas set #LTARGETKIND 1 event macro 22 wait 20 } else ; Reponemos herramientas... { set #SYSMSGCOL 88 event sysmessage Reponiendo... wait 20 gosub goto_bank gosub dejarAlimentos gosub pillarDelBank %herramientas gosub pillarDelBank %combustible gosub pillarDelBank %alimentos_crudos } return sub dejarAlimentos finditem %alimentos_cocinados C_ , #BACKPACKID if #FINDSTACK > 0 { set #SYSMSGCOL 73 event sysmessage Descargando alimentos... wait 20 gosub dejarCocinadosBank } return sub dejarCocinadosBank ; <==============================> _abreBank0: if #SCNT >= %bank_timer { if #CONTID <> %bank_ID ; El banco está cerrado... { event macro 1 0 Bank wait 20 gosub wait_for GUMP %bank_ID 40 ; Esperar a que se abra el cofre del banco if ( #TRUE in #RESULT ) { goto _dejarPS } else { wait 20 set %bank_timer #SCNT + 60 gosub busca_banquero goto _abreBank0 } } else ; El banco ya está abierto... :-) { _dejarPS: finditem TVH C_ , #BACKPACKID ; Pergaminos de poder o "Receta de cocina para el Aprendidaje" if #FINDCNT > 0 { set %num_PS #FINDCNT chooseskill Item real ; Podemos identificarlos... if #SKILL >= 1000 { _PS: finditem TVH C_ , #BACKPACKID if #FINDCNT > 0 && #FINDCOL = 538 ; PS de cocina, color rojo. { event macro 13 3 ; Item ID target set #LTARGETID #FINDID set #LTARGETKIND 1 event macro 22 wait 20 set #LOBJECTID #FINDID event macro 17 wait 20 gosub comprobar_comida gosub checkskill ; Comprobar GM cocina. goto _PS } } else { exevent drag #FINDID #FINDSTACK exevent dropC %bolsa_pergaminos_recompensa wait 30 goto _dejarPS } } _dejarComida: finditem %alimentos_cocinados C_ , #BACKPACKID if #FINDCNT > 0 { exevent drag #FINDID #FINDSTACK exevent dropC %bank_ID wait 30 goto _dejarComida } return } } wait 20 goto _abreBank0 return sub pillarDelBank ; <==============================> set %item %1 _abreBank1: if #SCNT >= %bank_timer { if #CONTID <> %bank_ID ; El banco está cerrado... { event macro 1 0 Bank wait 40 gosub wait_for GUMP %bank_ID 40 ; Esperar a que se abra el cofre del banco if ( #TRUE in #RESULT ) { goto _pillarItem } else { wait 20 set %bank_timer #SCNT + 60 gosub busca_banquero goto _abreBank1 } } else ; El banco ya está abierto... :-) { finditem %item C_ , %bank_ID if %item = %combustible || %item = %alimentos_crudos { if %item = %alimentos_crudos { set %stack_material %stack_alimentos } else { if %item = %combustible { set %stack_material %stack_combustible } } if #FINDSTACK >= %stack_material { set %ID_Item_Stack #FINDID finditem %item C_ , #BACKPACKID if #FINDSTACK < %stack_material { set %debocoger %stack_material - #FINDSTACK exevent drag %ID_Item_Stack %debocoger exevent dropC #BACKPACKID wait 30 } } else { set #SYSMSGCOL 38 event sysmessage FALTAN MATERIALES! :-( halt } return } else { if %item = %herramientas { finditem %item C_ , #BACKPACKID if #FINDCNT < %num_herramientas { set %debocoger %num_herramientas - #FINDCNT set #LOBJECTID %bolsa_herramientas event macro 17 gosub wait_for GUMP %bolsa_herramientas 40 finditem %item C_ , %bolsa_herramientas if #FINDCNT > 0 { for %h 1 %debocoger { finditem %item C_ , %bolsa_herramientas if #FINDCNT > 0 { exevent drag #FINDID 1 exevent dropC #BACKPACKID wait 30 } } } else { set #SYSMSGCOL 38 event sysmessage FALTAN HERRAMIENTAS! :-( halt } return } return } } } wait 20 goto _abreBank1 return sub setupBank ; <==============================> display OK *********************** [ BANK ] ***********************$$ + Acércate a la farola o a la papelera del banco y pulsa la tecla ESCAPE. $$ + ******************************************************** _hotLoop: onhotkey ESC { _waitToBank: if #SCNT >= %bank_timer { event macro 1 0 Bank gosub wait_for GUMP 180_240 30 ; Esperar a que se abra el cofre del banco if ( #TRUE in #RESULT ) { set %bank_x #CHARPOSX set %bank_y #CHARPOSY set %bank_z #CHARPOSZ set %bank_ID #CONTID set #SYSMSGCOL 88 event sysmessage OK: Bank %bank_ID wait 40 gosub pillarDelBank %herramientas gosub pillarDelBank %combustible gosub pillarDelBank %alimentos_crudos gosub wait_for GUMP %bank_ID CLOSE ; Cerrar el cofre del banco... return } else { set #SYSMSGCOL 38 event sysmessage ESPERANDO AL BANQUERO :-( wait 20 set %bank_timer #SCNT + 60 gosub busca_banquero goto _waitToBank } } wait 1 gosub hiding ; Ocultarse. goto _waitToBank } wait 1 goto _hotLoop return sub pathLoop ; <==============================> set %destino_x %1 set %destino_y %2 set %destino_z %3 repeat { set %old_pos_X #CHARPOSX set %old_pos_Y #CHARPOSY set %old_pos_Z #CHARPOSZ event pathfind %destino_x %destino_y %destino_z wait 20 } until ( #CHARPOSX = %destino_x && #CHARPOSY = %destino_y && #CHARPOSZ = %destino_z ) return sub busca_banquero ; <==============================> _busca_banquero: finditem HS_IS G_25 if #findkind <> -1 { if ( #FINDREP = 1 ) { set %vendor_id #FINDID set %bad_proper $ repeat { finditem #FINDID if #FINDCNT > 0 { event property %vendor_id wait 1 } } until ( %bad_proper <> #PROPERTY ) || ( #FINDCNT = 0 ) if ( %bad_proper <> #PROPERTY ) && ( #FINDCNT > 0 ) { set %string #property gosub split %string $ Propiedades set %profesion_vendor %PROPIEDADES2 if ( Banquero in %profesion_vendor ) { return ; Hemos encontrado al banquero :-) } else { ignoreitem #FINDID BAD_BANK ; Descartamos este vendor... ; Repetimos... goto _busca_banquero } } } else ; No parece ser un vendor... { ignoreitem #FINDID BAD_BANK ; Repetimos... goto _busca_banquero } } else ; No hay vendor cerca... { wait 20 gosub forceHiding ; Ocultarse. goto _busca_banquero } return sub forceHiding ; <==============================> _ForceHid: if ( H Notin #CHARSTATUS ) && ( #CHARGHOST <> YES ) { if ( #SCNT2 > %hid_timer ) { event macro 13 21 ; Use skill Hiding set %hid_timer #SCNT2 + 50 goto _ForceHid } } return sub setupHorno ;<====================> set %ID_horno N/A _setupHorno: set #SYSMSGCOL 73 event sysmessage Nos vamos al HORNO... wait 40 gosub goto_horno finditem YOB_BPB_EPB G_3 if #FINDCNT > 0 { for #FINDINDEX 1 #FINDCNT { if ( #FINDCOL = 451 ) ; Un horno que esté sin encender, libre para nosotros solos. { if ( #FINDX = 1448 && #FINDY = 1615 ) || ( #FINDX = 1448 && #FINDY = 1614 ) || ( #FINDX = 1448 && #FINDY = 1612 ) || ( #FINDX = 1448 && #FINDY = 1612 ) { set %ID_horno #FINDID set #SYSMSGCOL 88 event sysmessage [ OK ] ID HORNO: %ID_horno wait 40 return } } } if %ID_horno = N/A { goto _noHayHorno } } else { _noHayHorno: set #SYSMSGCOL 38 event sysmessage NO ENCUENTRO EL HORNO! :-( halt } return sub goto_horno gosub pathLoop 1465 1657 10 gosub pathLoop 1465 1647 17 gosub pathLoop 1465 1635 20 gosub pathLoop 1465 1624 20 gosub pathLoop 1465 1615 20 gosub pathLoop 1461 1614 20 finditem KOJRJMD G_3 if #FINDCNT > 0 { if #FINDTYPE = HQC { gosub WalkThroughDoor KOJRJMD } } gosub pathLoop 1452 1616 20 gosub pathLoop 1449 1616 20 gosub pathLoop 1450 1613 20 return sub goto_bank gosub pathLoop 1450 1616 20 gosub pathLoop 1458 1614 20 finditem KOJRJMD G_3 if #FINDCNT > 0 { if #FINDTYPE = HQC { gosub WalkThroughDoor KOJRJMD } } gosub pathLoop 1465 1615 20 gosub pathLoop 1465 1624 20 gosub pathLoop 1465 1635 20 gosub pathLoop 1465 1647 17 gosub pathLoop 1465 1657 10 gosub pathLoop 1456 1659 10 gosub pathLoop %bank_x %bank_y %bank_z return sub checkskill ;<====================> _check: chooseskill Cook real if #SKILL >= 1000 { set #SYSMSGCOL 73 event sysmessage SOMOS GM COOKING! :-) halt } return sub checkHungry ;<====================> set %tiempo_actual #SCNT if %proxima_vez <= %tiempo_actual { gosub comprobar_comida } 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 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 ;=========================================================== ; Name: pathFind ; Author: ScriptFellow (the.WZA) ; Parameters: %1 = X ; %2 = Y ; %3 = Z ; %4 = tolerance ; %5 = timeout (in seconds) ; Purpose: Pathfind to the given coordinates ; Return: %return (#true or #false ) ;----------------------------------------------------------- sub pathFind set %_x %1 set %_y %2 if %0 <= 2 || %2 = N/A set %_z -1 else set %_z %3 if %0 <= 3 || %3 = N/A set %_tolerance 0 else set %_tolerance %4 if %0 <= 4 set %_endTime #sCnt + 15 else set %_endTime #sCnt + %5 set %return #false deleteJournal scanJournal 2 event PathFind %_x %_y %_z _pathFindScanAgain: scanJournal 1 if pathfinding in #journal goto _pathFindOkay if can't_get_there in #journal || #sCnt > %_endTime return goto _pathFindScanAgain _pathFindOkay: gosub _pathFindDist %_x %_y %_z #charPosX #charPosY #charPosZ set %return %return <= %_tolerance if %return { if %_tolerance > 0 { set %1 #cliLeft + #cliXRes / 2 set %2 #cliTop + #cliYRes / 2 if #charDir < 3 set %1 %1 + 1 else { if #charDir > 3 && #charDir < 7 set %1 %1 - 1 } if #charDir = 0 || #charDir = 6 set %2 %2 - 1 else { if #charDir > 1 && #charDir < 5 set %2 %2 + 1 } click %1 %2 R } return } if #sCnt > %_endTime return goto _pathFindOkay sub _pathFindDist set %1 %1 - %4 abs set %2 %2 - %5 abs set %3 %3 - %6 abs gosub max %1 %2 %3 return ; to be defined sub max set %return %1 for %_idx 2 %0 { if % . %_idx > %return set %return % . %_idx } return ;================================ Sub WalkThroughDoor ;ver 1.0 7Dec03 by Roadkill ;purpose: open a door and walk through it without having a rail. Useful ; for getting to a vendor type, I use this in conjunction with my ; RKFindVendorType to hike in/out a building looking for a cobbler ; so I don't have to hard code vendorIDs and get boofed later. ; If no door specified, finds one within 5 tiles. If in Fel may get blocked ;%1 = id of door to walk through, optional ;@dependencies: RKsubs.txt findThingsDir ;status: tested, insert doortypes. buggy due to not square t door. ; use #chardir with doortype to decide which dir to walk ; the different types below are n/s and e/w doors set %doortypes JQC_ZPC_BQC_HQC_HNC_FNC_XMC_ZMC_VFD_XFD_JOC_XNC ; kcd_ucd__joc_hoc__nnc_wcd_qcd_vnc_xnc__pqc_hqc_jqc if %0 >= 1 set %doortypes %1 finditem %doortypes G_5 if #findkind display ok there is no door within 5 tiles set %doorid #findid move #findx #findy 1 2s gosub FindThingsDir #findx #findy doordir event macro 5 %doordir _openDoor: wait 10 set #lobjectid %doorid event macro 17 set %_charx #charposx set %_chary #charposy wait 20 event macro 5 %doordir wait 20 event macro 5 %doordir wait 20 event macro 5 %doordir wait 20 if #charposx = %_charx && #charposy = %_chary goto _openDoor return SUB FindThingsDir ;ver 1.2 10Jul04 by Roadkill ;purpose: find the direction from you that a thing is ;%1= #findx of object, it's UO world coord ;%2=#findy of object, it's UO world coord ;%3= the name of the return var, i.e. 'dir', 'thingsdirection' by default ;%3 holds its dir from you 0-nw 1-n 2-ne 3-e 4-se 5-s 6-sw 7-w 8-sametile ;* @example call rksubs.txt FindThingsDir %mapxcoord %mapycoord spotdir SET !itsX %1 SET !itsY %2 if %0 < 3 set %3 thingsdirection IF !itsX = #charposx && !itsY < #charposy SET % . %3 1 ;N IF !itsX > #charposx && !itsY < #charposy SET % . %3 2 ;NE IF !itsX > #charposx && !itsY = #charposy SET % . %3 3 ;E IF !itsX > #charposx && !itsY > #charposy SET % . %3 4 ;SE IF !itsX = #charposx && !itsY > #charposy SET % . %3 5 ;S IF !itsX < #charposx && !itsY > #charposy SET % . %3 6 ;SW IF !itsX < #charposx && !itsY = #charposy SET % . %3 7 ;W IF !itsX < #charposx && !itsY < #charposy SET % . %3 0 ;NW IF !itsX = #charposx && !itsY = #charposy SET % . %3 8 ;same tile RETURN ;****************************************************************** ;** ;* 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 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_GUMP ; version 1.4 ~Locke ;================================================================= ; Añadido #CONTID ^^ 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 ;================================================================= 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 ( #scnt2 + !_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 =< #scnt2 return #result wait 1 set *esperando #TRUE goto _lets_wait_for_a_message } else set *esperando #FALSE return #result wait 1 goto _lets_wait_for_a_message