Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 9th, 2012  |  syntax: Ruby  |  size: 6.01 KB  |  hits: 21  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. # Ropiderz library v 0.0.1 #
  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 one 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 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 does not exists on Ropiderz 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.  end
  61.  end
  62.  return tileeach
  63. end
  64.  
  65. def healfriend(friend_name, percent) # heal friend with sio in health percent rule #
  66.  while true
  67.  creature("ps").each do |player|
  68.  if player.Name == friend_name && player.hppc < percent
  69.  cast("exura sio " + friend_name)
  70.  sleep 1.5
  71.  end
  72.  end
  73.  end
  74. end
  75.  
  76. def emptycount() # return amount of empty slots on all backpacks #
  77.  while true
  78.  backpack.each do |bp|
  79.  return bp.maxcount
  80.  end
  81.  end
  82. end
  83.  
  84. def itemcounton(id, bpname) # count items with id "item id" on backpack "backpack name" #
  85.  backpack.each do |bp|
  86.  bp.item.each do |i|
  87.  i.itemid do |item|
  88.  if item == id and i.container_name == bpname
  89.  return countitems(id)
  90.  end
  91.  end
  92.  end
  93.  end
  94. end
  95.  
  96. def mpcount() # returns amount of mana potions all types #
  97.  return itemcount(getid("mana potion")) + itemcount(getid("strong mana potion")) + itemcount(getid("great mana potion"))
  98. end
  99.  
  100. def hpcount() # returns amount of health potions all types #
  101.  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"))
  102. end
  103.  
  104. def usemacheteon(x, y, z) # cuts grass on tile xyz defined #
  105.  if itemcount("machete") > 0
  106.   mach = getid("machete")
  107.  elsif itemcount("whacking driller of fate") > 0
  108.   mach = getid("whacking driller of fate")
  109.  elsif itemcount("sneaky stabber of eliteness") > 0
  110.   mach = getid("sneaky stabber of eliteness")
  111.  elsif itemcount("squeezing gear of girlpower") > 0
  112.   mach = getid("squeezing gear of girlpower")
  113.  end
  114.  useitemfrombpon(mach, x, y, z)
  115. end
  116.  
  117. def usepickon(x, y, z) # uses pick on tile xyz defined #
  118.  if itemcount("pick") > 0
  119.   pickid = getid("pick")
  120.  elsif itemcount("whacking driller of fate") > 0
  121.   pickid = getid("whacking driller of fate")
  122.  elsif itemcount("sneaky stabber of eliteness") > 0
  123.   pickid = getid("sneaky stabber of eliteness")
  124.  elsif itemcount("squeezing gear of girlpower") > 0
  125.   pickid = getid("squeezing gear of girlpower")
  126.  end
  127.  useitemfrombpon(pickid, x, y, z)
  128. end
  129.  
  130. def useshovelon(x, y, z) # uses shovel on tile xyz defined #
  131.  if itemcount("shovel") > 0
  132.   shovelid = getid("shovel")
  133.  elsif itemcount("light shovel") > 0
  134.   shovelid = getid("light shovel")
  135.  elsif itemcount("whacking driller of fate") > 0
  136.   shovelid = getid("whacking driller of fate")
  137.  elsif itemcount("sneaky stabber of eliteness") > 0
  138.   shovelid = getid("sneaky stabber of eliteness")
  139.  elsif itemcount("squeezing gear of girlpower") > 0
  140.   shovelid = getid("squeezing gear of girlpower")
  141.  end
  142.  useitemfrombpon(shovelid, x, y, z)
  143. end
  144.  
  145. def useropeon(x, y, z) # uses rope on tile xyz defined #
  146.  if itemcount("rope") > 0 {
  147.   ropeid = getid("rope") }
  148.  elsif itemcount("elvenhair rope") > 0 {
  149.   ropeid = getid("elvenhair rope") }
  150.  elsif itemcount("whacking driller of fate") > 0 {
  151.   ropeid = getid("whacking driller of fate") }
  152.  elsif itemcount("sneaky stabber of eliteness") > 0 {
  153.   ropeid = getid("sneaky stabber of eliteness") }
  154.  elsif itemcount("squeezing gear of girlpower") > 0 {
  155.   ropeid = getid("squeezing gear of girlpower") }
  156.  end
  157.  useitemfrombpon(ropeid, x, y, z)
  158. end
  159.  
  160. def antiidle(timefrom, timeto) # it will turn directions randomly between time 'from' and 'to' #
  161.  while true
  162.  rin = timefrom * 1000
  163.  out = timeto * 1000
  164.  randomly = 0 + rand(4)
  165.  if randomly == 1
  166.   turn("n")
  167.   wait(rin, out)
  168.  end
  169.  if randomly == 2
  170.   turn("s")
  171.   wait(rin, out)
  172.  end
  173.  if randomly == 3
  174.   turn("w")
  175.   wait(rin, out)
  176.  end
  177.  if randomly == 4
  178.   turn("e")
  179.   wait(rin, out)
  180.  end
  181.  end
  182. end