Guest User

Untitled

a guest
May 8th, 2012
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 5.97 KB | None | 0 0
  1. # Ropiderz library v 0.0.3 #
  2.  
  3. # METHODS #
  4.  
  5. def explanation(string_method) # says on npc channel an explanation of method you put on #
  6.  method = {"explanation" => "explain the ropiderz lib method you put on", "countgold" => "return amount of gold you have", "reachandopendp" => "reach dp and open it if not true that is opened return to same waypoint", "depositall" => "says \'hi\', \'deposit all\', \'yes\'", "forwardwpt" => "go to next waypoint", "backwarkwpt" => "go to previous waypoint", "alltiles" => "return array of all tiles in visible screen", "aroundtiles" => "return array of all tiles around your character 1 sqm far", "hpcount" => "return amount of health potions you have all types", "mpcount" => "return amount of mana potions you have all types", "healfriend" => "will use sio to heal a friend named on method when he gots health percent on method", "emptycount" => "return amount of empty slots on all backpacks", "usemacheteon" => "cuts grass or other stuff on cords XYZ defined", "usepickon" => "uses pick or other stuff to open a hole on cords XYZ defined", "useshovelon" => "uses shovel or other stuff avaible to open loose stone pile on cord XYZ defined", "useropeon" => "uses rope or other stuff avaible on cord XYZ defined", "antiidle" => "will keeps turning into random direction in time between from and to"}
  7.  if string_method.include?(method)
  8.  say(method[string_method].to_s)
  9.  else
  10.  say("This method doesn\'t exists on Ropiderz\'s Library")
  11.  end
  12. end
  13.  
  14. def countgold() # return amount of gold you have #
  15.  return itemcount(3031) + (itemcount(3035) * 100) + (itemcount(3043) * 10000)
  16. end
  17.  
  18. def depositall() # says "hi", "deposit all", "yes" #
  19.  say("hi")
  20.  wait(1000, 1500)
  21.  npcsay("deposit all")
  22.  wait(1000, 1500)
  23.  npcsay("yes")
  24. end
  25.  
  26. def reachandopendp() # reach dp and open it, if not true that is opened return to same waypoint #
  27.  reachdp()
  28.  wait(2500, 3000)
  29.  if reacheddp() == false
  30.   gotoway(wpt())
  31.  else
  32.   opendepot()
  33.   wait(2500, 3000)
  34.  end
  35. end
  36.  
  37. def forwardwpt() # go to next waypoint #
  38.  gotoway(wpt() + 1)
  39. end
  40.  
  41. def backwardwpt() # go to previous waypoint #
  42.  gotoway(wpt() - 1)
  43. end
  44.  
  45. def alltiles() # return array of all tiles in visible screen #
  46.  while true
  47.  x = -7 + rand(14)
  48.  y = -5 + rand(10)
  49.  tile = gettile($posx + x, $posy + y, $posz)
  50.  end
  51.  return tile
  52. end
  53.  
  54. def aroundtiles() # return array of items in all tiles around your character 1 sqm far #
  55.  while true
  56.  x = -1 + rand(2)
  57.  y = -1 + rand(2)
  58.  tile = gettile($posx + x, $posy + y, $posz)
  59.  tile.items.each do |tileeach|
  60.  return tileeach
  61. end
  62.  
  63. def healfriend(friend_name, percent) # heal friend with sio in health percent rule #
  64.  while true
  65.  creature("ps").each do |player|
  66.  if player.Name == friend_name && player.hppc < percent
  67.  cast("exura ico " + """ + player.Name + """)
  68.  sleep 1.5
  69.  end
  70.  end
  71. end
  72.  
  73. def emptycount() # return amount of empty slots on all backpacks #
  74.  backpack.each do |bp|
  75.  return bp.maxcount
  76. end
  77.  
  78. def itemcounton(id, bpname) # count items with id "item id" on backpack "backpack name" #
  79.  backpack.each do |bp|
  80.  bp.item.each do |i|
  81.  i.itemid do |item|
  82.  if item == id and i.container_name == bpname
  83.  return countitems(id)
  84.  end
  85.  end
  86.  end
  87.  end
  88. end
  89.  
  90. def mpcount() # returns amount of mana potions all types #
  91.  return itemcount(getid("mana potion")) + itemcount(getid("strong mana potion")) + itemcount(getid("great mana potion"))
  92. end
  93.  
  94. def hpcount() # returns amount of health potions all types #
  95.  return return itemcount(getid("small health potion")) + itemcount(getid("health potion")) + itemcount(getid("strong health potion")) + itemcount(getid("great health potion")) + itemcount(getid("ultimate health potion"))
  96. end
  97.  
  98. def usemacheteon(x, y, z) # cuts grass on tile xyz defined #
  99.  if itemcount("machete") > 0
  100.   mach = getid("machete")
  101.  elsif itemcount("whacking driller of fate") > 0
  102.   mach = getid("whacking driller of fate")
  103.  elsif itemcount("sneaky stabber of eliteness") > 0
  104.   mach = getid("sneaky stabber of eliteness")
  105.  elsif itemcount("squeezing gear of girlpower") > 0
  106.   mach = getid("squeezing gear of girlpower")
  107.  end
  108.  useitemfrombpon(mach, x, y, z)
  109. end
  110.  
  111. def usepickon(x, y, z) # uses pick on tile xyz defined #
  112.  if itemcount("pick") > 0
  113.   pickid = getid("pick")
  114.  elsif itemcount("whacking driller of fate") > 0
  115.   pickid = getid("whacking driller of fate")
  116.  elsif itemcount("sneaky stabber of eliteness") > 0
  117.   pickid = getid("sneaky stabber of eliteness")
  118.  elsif itemcount("squeezing gear of girlpower") > 0
  119.   pickid = getid("squeezing gear of girlpower")
  120.  end
  121.  useitemfrombpon(pickid, x, y, z)
  122. end
  123.  
  124. def useshovelon(x, y, z) # uses shovel on tile xyz defined #
  125.  if itemcount("shovel") > 0
  126.   shovelid = getid("shovel")
  127.  elsif itemcount("light shovel") > 0
  128.   shovelid = getid("light shovel")
  129.  elsif itemcount("whacking driller of fate") > 0
  130.   shovelid = getid("whacking driller of fate")
  131.  elsif itemcount("sneaky stabber of eliteness") > 0
  132.   shovelid = getid("sneaky stabber of eliteness")
  133.  elsif itemcount("squeezing gear of girlpower") > 0
  134.   shovelid = getid("squeezing gear of girlpower")
  135.  end
  136.  useitemfrombpon(shovelid, x, y, z)
  137. end
  138.  
  139. def useropeon(x, y, z) # uses rope on tile xyz defined #
  140.  if itemcount("rope") > 0
  141.   ropeid = getid("rope")
  142.  elsif itemcount("elvenhair rope") > 0
  143.   ropeid = getid("elvenhair rope")
  144.  elsif itemcount("whacking driller of fate") > 0
  145.   ropeid = getid("whacking driller of fate")
  146.  elsif itemcount("sneaky stabber of eliteness") > 0
  147.   ropeid = getid("sneaky stabber of eliteness")
  148.  elsif itemcount("squeezing gear of girlpower") > 0
  149.   ropeid = getid("squeezing gear of girlpower")
  150.  end
  151.  useitemfrombpon(ropeid, x, y, z)
  152. end
  153.  
  154. def antiidle(timefrom, timeto) # it will turn directions randomly between time 'from' and 'to' #
  155.  while true
  156.  in = timefrom * 1000
  157.  out = timeto * 1000
  158.  randomly = 0 + rand(4)
  159.  if randomly == 1
  160.   turn(n)
  161.   wait(in, out)
  162.  end
  163.  if randomly == 2
  164.   turn(s)
  165.   wait(in, out)
  166.  end
  167.  if randomly == 3
  168.   turn(w)
  169.   wait(in, out)
  170.  end
  171.  if randomly == 4
  172.   turn(e)
  173.   wait(in, out)
  174.  end
  175. end
Advertisement
Add Comment
Please, Sign In to add comment