Forum Gildii Wielkiego Bractwa Sosarii (WBS)

Forum Gildii Wielkiego Bractwa Sosarii (WBS)


#1 2010-05-18 14:53:57

Anion

Administrator

Zarejestrowany: 2010-04-06
Posty: 51
Punktów :   

Drwalstwo z juczniakiem

Kod:

; lumberjacking ;) 14.08.2008

set %hid 0
; 1-ukrywa
; 0-nie ukrywa

set %stealth 0
; 1-stealth
; 0-bez ;]

set %drop 0
; 1-wyrzuca pod siebie
; 0-wrzuca na lame

set %topory FSF_BSF_ZRF_NSF_MPH
; siekierki, ktorymi bedzie scinac
set %zarcie HND_END_QQD_
; filety (bedzie jesc:))
set %jablka QQD_
; bedzie karmic lamke :


; nie rusz!;>
;-----------------------------------------------------
set %HID_SCNT #SCNT
set %SAY_SCNT #SCNT - 5
set %LAMA_SCNT #SCNT
set %ZARCIE_SCNT #SCNT
set %ZARCIE_hors_DELEY 1000
set %ZARCIE_hors #SCNT + %ZARCIE_hors_DELEY
; bedzie karmic lame 1 jablkiem co 500 sek.

set %timeout 10

set %log_all #true ; #false = log only one in each 8x8-ressource-field; #True = ignores 8x8-ressource-grids
set %scan_radius 20
set %action lumbering

set %tree 1
set %treec 1

set %woodc 0

set %startx #CharPosX
set %starty #CharPosY
set %startz #CharPosZ

loop:
if #ContName = generic_gump && #ContSize = 560_520
   {
   event sysmessage MAKROCZEK! Pierdole, nie robie...
   wait 1s
   goto loop
   }
if #ContName = Stringquery_gump
   {
   event sysmessage MAKROCZEK! Pierdole, nie robie...
   wait 1s
   goto loop
   }
event sysmessage Drzewo: %tree / %treec
event sysmessage Scieto %woodc bali drewna.
if %drop = 0 && %hors = N/A
   {
   FindItem WN_BO G_2
   if #FindKind = -1
      {
      display ok Nie widze lamy jucznej O_o
      halt
      }
   if #FindCnt > 1
      {
      set #TargCurs 1
      event sysmessage Wskaz swoja lame... bo znalazlem pare O_o
      repeat
      until #TargCurs = 0
      event sysmessage Ok. Wskazano #LTargetID , .
      set %hors #LTargetID
      }
   else
       {
       set %hors #FindID
       event sysmessage Znalazlem lame. Mam nadzieje, ze to Twoja...;> ( #FindID ).
       }
   set %tmp #ContID
   set #LObjectID %hors
   event macro 17 0
   repeat
   until %tmp <> #ContID
   set %horsc #ContID
   }
if %drop = 1
   {
   FindItem ZLK C_ , #BackPackID
   if #FindKind <> -1
      {
      set %woodc %woodc + #FindStack
      exevent drag #FindID #FindStack
      exevent dropg #CharPosX #CharPosY #CharPosZ
      }
   }
else
    {
    FindItem ZLK C_ , #BackPackID
    if #FindKind <> -1
       {
       FindItem %hors G
       while #FindDist > 2
             {
             if %SAY_SCNT + 5 < #SCNT
                {
                event macro 1 0 Podazajcie za mna
                set %SAY_SCNT #SCNT
                }
             FindItem %hors G
             }
       repeat
       if #SCNT > %hors_SCNT + 1
          {
          set #LObjectID %hors
          event macro 17 0
          }
       until #ContID = %horsc
       FindItem ZLK C_ , #BackPackID
       set %woodc %woodc + #FindStack
       exevent drag #FindID #FindStack
       exevent dropc %horsc
       if %ZARCIE_hors <= #SCNT
          {
          FindItem %jablka C_ , #BackPackID
          if #FindKind = -1
             FindItem %jablka C_ , %horsc
          if #FindKind = -1
             event sysmessage Nie ma jablek dla lamki:(
          else
              {
              exevent drag #FindID 1
              exevent dropc %hors
              }
          set %ZARCIE_LAMA #SCNT + %ZARCIE_hors_DELEY
          }
       }
    }
if %ZARCIE_SCNT <= #SCNT
   {
   gosub spr_glod
   set %ZARCIE_SCNT #SCNT + 300
   }
if %hid = 1 && %HID_SCNT + 10 < #SCNT
   {
   gosub hiding
   goto loop
   }
if %tree = %treec
   {
   repeat
   event pathfind %startx %starty %startz
   wait 20
   until #CharPosX = %startx && #CharPosY = %starty
   gosub 8x8_scanner %scan_radius %action #CharPosX #CharPosY tile_list
   set %treec #Result
   if %treec = 0
      {
      event sysmessage Nie znalazlem zadnych drzew...$Pauza.
      pause
      goto loop
      }
   set %tree 1
   }
move %tile_list_X_ . %tree %tile_list_Y_ . %tree 1 2s
set %_JIndex #JIndex
repeat
      {
      gosub findtopor
      set #LObjectID %siekiera
      event macro 17 0
      target 1s
      }
until #TargCurs = 1
set #LTargetX %tile_list_X_ . %tree
set #LTargetY %tile_list_Y_ . %tree
set #LTargetZ %tile_list_Z_ . %tree
set #LTargetTile %tile_list_title_ . %tree
set #LTargetKind 3
event macro 22 0
gosub ScanJournal %_JIndex To_jest_za_daleko Nie_ma_tutaj Wrzucasz Nie_potrafisz Nie_udalo Twoje_narzedzie_sie Nie_mozesz already
;                 1        2                 3            4        5             6         7                   8          9
if #Result = 2
   {
   event pathfind %tile_list_X_ . %tree %tile_list_Y_ . %tree %tile_list_Z_ . %tree
   goto loop
   }
if #Result = 4 || #Result = 9
   {
   wait 5
   goto loop
   }
if #Result = 6 || #Result = 7
   goto loop
set %tree %tree + 1
event sysmessage Drzewo: %tree / %treec
event sysmessage Scieto %woodc bali drewna.
goto loop


; jedzenie :)

sub spr_glod
glodloop:
set %_JIndex #JIndex
event macro 1 0 .glod
gosub ScanJournal %_JIndex Twoja_postac_jest_tak_najedzona Twoja_postac_jest_najedzona_do_syta_i_nic_wiecej Twoja_postac_jest_najedzona_do_syta Twoja_postac_jest_najedzona Twoja_postac_nie_jest_glodna Twoja_postac_czuje_oznaki_glodu Twoja_postac_jest_nieco_glodna Twoja_postac_jest_glodna Twoja_postac_jest_bardzo_glodna Twoja_postac_przymiera_glodem Twoja_postac_jest_bliska_smierci_glodowej
;                           2                               3                                                4                                   5                           6                            7                               8                              9                        10                              11                            12
if #Result < 5
   event macro 1 0 .glodniej
if #Result = 5
   return
if #Result > 5
   {
   FindItem %zarcie C
   if #FindKind = -1
      {
      event sysmessage Nie znalazle jedzenia:(
      return
      }
   set #LObjectID #FindID
   event macro 17 0
   }
goto glodloop
return

; hiding :)

sub hiding
event macro 13 21
if %stealth = 1
   {
   gosub ScanJournal %_JIndex Ukryles Nie_potrafisz_sie already
   if #Result = 2
      {
      repeat
            {
            for %w 1 12
                {
                  wait 1s
                  if H notin #CharStatus
                     break
                }
            event macro 13 47
            }
      until H notin #CharStatus
      }
   }
set %HID_SCNT #SCNT
return

; ----------------------------------


; szukanie siekierki ;]

sub findtopor
FindItem %topory C_ , #CharID
if #FindKind = -1
  {
  FindItem %topory C
  if #FindKind = -1
     {
     display ok Brak siekier.
     halt
     }

  set %siekiera #FindID
  exevent drag %siekiera
  exevent droppd
  wait 1s
  return
  }
set %siekiera #FindID
return

; --------------------------------


; Scanjournal

sub ScanJournal
set %__JIndex %1
set %_timeout #SCNT
ScanLoop:
set %x %timeout + %_timeout
if #SCNT > %_timeout + %timeout
   return TIMEOUT
if #JIndex > %__JIndex
   {
   set %__JIndex %__JIndex + 1
   ScanJournal %__JIndex
   for %__i 2 %0
       {
       if % . %__i in #journal
          return %__i
       }
   }
goto ScanLoop
return

;------------------------------

; PATHFIND

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

;----------------------------------------


; tree_scanner;]

sub 8x8_scanner
; save vars, create namespace... & make hurry!
nameSpace Push
nameSpace Local #sysTime , #random
set !old_lpc #LPC
Linespercycle 500

tile init

set !layer_mining 1
; Note: After the 3rd line the values are from Cyberpopes Mine radar!
set !mining _220_221_222_223_224_225_226_227_268_269_270_271_276
+_277_278_279_294_295_296_297_561_562_563_564_564_569_570_571_572
+_1861_1873_1981_1982_1983_1984_
+228_229_230_231_236_237_238_239_244_245_246_247_252_253_254_255_256_257_
+258_259_260_261_262_263_272_273_274_275_286_287_288_289_290_291_292_293_
+295_321_322_323_324_430_467_468_469_470_471_472_473_474_476_477_478_479_
+480_481_482_483_484_485_486_487_492_493_494_495_543_544_545_546_547_548_
+549_550_551_552_553_554_555_560_565_566_567_568_573_574_575_576_577_578_
+579_581_582_583_584_585_586_587_588_589_590_591_592_593_594_595_596_597_
+598_599_600_601_610_611_612_613_1010_1339_1340_1341_1342_1343_1344_1345_
+1346_1347_1348_1349_1350_1351_1352_1353_1354_1355_1356_1357_1358_1359_1741_
+1742_1743_1744_1745_1746_1747_1748_1749_1750_1751_1752_1753_1754_1755_1756_
+1757_1771_1772_1773_1774_1775_1776_1777_1778_1779_1780_1781_1782_1783_1784_
+1785_1786_1787_1788_1789_1790_1801_1802_1803_1804_1805_1806_1807_1808_1809_
+1811_1812_1813_1814_1815_1816_1817_1818_1819_1820_1821_1822_1823_1824_1831_
+1832_1833_1834_1835_1836_1837_1838_1839_1840_1841_1842_1843_1844_1845_1846_
+1847_1848_1849_1850_1851_1852_1853_1854_1862_1863_1864_1865_1866_1867_1868_
+1869_1870_1871_1872_1874_1875_1876_1877_1878_1879_1880_1881_1882_1883_1884_
+1985_1986_1987_1988_1989_1990_1991_1992_1993_1994_1995_1996_1997_1998_1999_
+2000_2001_2002_2003_2004_2029_2030_2031_2032_2033_2100_2101_2102_2103_2104_
+2105_430_556_557_558_559_2028_240_241_242_243_

set !layer_lumbering 2
set !lumbering _3274_3275_3276_3277_3278_3279_3280_3281_3282_3283_3284_3285_3286_
+3287_3288_3289_3290_3291_3292_3293_3294_3295_3296_3297_3298_3299_
+3300_3301_3302_3304_3320_3321_3322_3323_3324_3325_3326_3327_3328_
+3329_3330_3331_3393_3394_3395_3396_3397_3398_3399_3400_3401_3402_
+3403_3404_3405_3406_3407_3408_3409_3410_3411_3415_3416_3417_3418_
+3419_3420_3421_3422_3423_3424_3425_3426_3427_3428_3429_3430_3431_
+3432_3433_3438_3439_3440_3441_3442_3443_3444_3445_3446_3447_3448_
+3449_3450_3451_3452_3453_3454_3455_3460_3461_3462_3463_3464_3465_
+3466_3467_3468_3469_3470_3471_3472_3477_3478_3479_3481_3482_3483_
+3485_3486_3487_3489_3490_3491_3493_3494_3495_3497_3498_3499_4789_
+4790_4791_4792_4793_4794_4795_4796_4797_4798_4799_4801_4802_4803_
+4804_4805_4806_4807_

set !layer_custom 1
set !custom _NONE_YET_

; --------------  SETUP ----------------------
set !range %1

set !debug #FALSE

set !temp layer_ , %2
set !layer ! . !temp

; What type of tiley do you want to search?
set !search_for ! . %2
; ------------ END SETUP --------------------

set !centerX %3
set !centerY %4

; declare the return-value-name
if %0 < 5
   set %return found_location
Else
   set %return %5

; Clear the positions and vars:
set !Q_count 0
set !merged $
set !output_count 0
set !search_for_in

; calculate the quare
set !direction2 !range
set !direction1 !direction2 * -1

; Scan the square (able to reach)
for !cnt_x !direction1 !direction2
   {
   for  !cnt_y !direction1 !direction2
      {
      set !X_tile_to_get !centerX + !cnt_x
      set !Y_tile_to_get !centerY + !cnt_y
      tile get !X_tile_to_get !Y_tile_to_get !layer
      set !check_type _ , #TileType , _
      if !check_type in !search_for
         {
         if %log_all = #FALSE
            {
            gosub quanticer !centerX !centerY
            if ( #Result <> 0 ) && ( #Result notin !search_for_in )
               {
               set !search_for_in !search_for_in , #Result , _
               set !merged !merged , !X_tile_to_get , _ , !Y_tile_to_get , $
               set !output_count !output_count + 1
               set % . %return , _X_ . !output_count !X_tile_to_get
               set % . %return , _Y_ . !output_count !Y_tile_to_get
               set % . %return , _Z_ . !output_count #TileZ
               set % . %return , _title_ . !output_count #TILETYPE
               }
            }
         if %log_all = #TRUE && #Result <> 0
            {
            set !merged !merged , !X_tile_to_get , _ , !Y_tile_to_get , $
            set !output_count !output_count + 1
            set % . %return , _X_ . !output_count !X_tile_to_get
            set % . %return , _Y_ . !output_count !Y_tile_to_get
            set % . %return , _Z_ . !output_count #TileZ
            set % . %return , _title_ . !output_count #TILETYPE
            }
         }
      }
   }

if !debug
{
display yes found tiles in reach in grids: !search_for_in $$ Remember the grids:$
+(Tilted by 45 degrees to represent the UO-world)$
+________1$
+$
+____4______2$
+$
+7______5_______3$
+$
+___8_______6$
+$
+_______9$$
+Coordinates of the spots: !merged
}
set %found_locations !output_count
; restore old LPC and namespace
set #LPC !old_lpc
nameSpace Clear
nameSpace Pop
return %found_locations
; ------------------------------------

; ------------------------------------
sub quanticer
;* @param   %1  startX    req  centerposition X to start scan (normally #CharPosX)
;* @param   %2  startY    req  centerposition Y to start scan (normally #CharPosY)

; Get the borders of actual 8x8-grid

set !actual_grid_Y_0 %2 - ( %2 % 8 )
set !actual_grid_Y_8 %2 - ( %2 % 8 ) + 7
set !actual_grid_X_0 %1 - ( %1 % 8 )
set !actual_grid_X_8 %1 - ( %1 % 8 ) + 7

if  ( !X_tile_to_get >= !actual_grid_X_0 ) && ( !X_tile_to_get <= !actual_grid_X_8 )
   {
   ; actual 8x8
   if  ( !Y_tile_to_get >= !actual_grid_Y_0 ) && ( !Y_tile_to_get <= !actual_grid_Y_8 )
      return 5
   ; N 8x8
   if  ( !Y_tile_to_get >= !actual_grid_Y_0 - 8 ) && ( !Y_tile_to_get <= !actual_grid_Y_8 - 8 )
      return 2
   ; S 8x8
   if  ( !Y_tile_to_get >= !actual_grid_Y_0 + 8 ) && ( !Y_tile_to_get <= !actual_grid_Y_8 + 8 )
      return 8
   }

if ( !Y_tile_to_get >= !actual_grid_Y_0 ) && ( !Y_tile_to_get <= !actual_grid_Y_8 )
   {
   ; W 8x8
   if  ( !X_tile_to_get >= !actual_grid_X_0 - 8 ) && ( !X_tile_to_get <= !actual_grid_X_8 - 8 )
      return 4
   ; E 8x8
   if  ( !X_tile_to_get >= !actual_grid_X_0 + 8 ) && ( !X_tile_to_get <= !actual_grid_X_8 + 8 )
      return 6
   }

if  ( !X_tile_to_get >= !actual_grid_X_0 - 8 ) && ( !X_tile_to_get <= !actual_grid_X_8 - 8 )
   {
   ; NW 8x8
   if  ( !Y_tile_to_get >= !actual_grid_Y_0 - 8 ) && ( !Y_tile_to_get <= !actual_grid_Y_8 - 8 )
      return 1
   ; SW 8x8
   if  ( !Y_tile_to_get >= !actual_grid_Y_0 + 8 + 8 ) && ( !Y_tile_to_get <= !actual_grid_Y_8 + 8 + 8 )
      return 7
   }

if  ( !X_tile_to_get >= !actual_grid_X_0 + 8 ) && ( !X_tile_to_get <= !actual_grid_X_8 + 8 )
   {
   ; NE 8x8
   if  ( !Y_tile_to_get >= !actual_grid_Y_0 - 8 ) && ( !Y_tile_to_get <= !actual_grid_Y_8 - 8 )
      return 3
   ; SE 8x8
   if  ( !Y_tile_to_get >= !actual_grid_Y_0 + 8 ) && ( !Y_tile_to_get <= !actual_grid_Y_8 + 8 )
      return 9
   }
return 0
; ------------------------------------

Anion - Wojownik
Kanion - Rzemieślnik

Offline

 

Stopka forum

RSS
Powered by PunBB
© Copyright 2002–2008 PunBB
Polityka cookies - Wersja Lo-Fi


Darmowe Forum | Ciekawe Fora | Darmowe Fora
www.sm2013.pun.pl www.elliteofdestiny.pun.pl www.darots.pun.pl www.seekanddestroy.pun.pl www.fr1012.pun.pl