Joseph
07-27-2010, 08:50 AM
some modification required, but this script stores different jars in different containers, so you can easily modify it to do what you want it to.
#!/usr/bin/env ruby
=begin
By Blueland ~Joseph@Joseph.Net
Will stick gems into jars (will also do bottles and beakers)- useful for adventure guild gem hoarding
To do:
Full jars on lists. (fix_jar_list and count)
=end
# To get the GameObj.name for a container use ;e respond GameObj.inv.find {|obj| obj.noun == 'cloak'}.name
# container1 = Unprocessed gems -
$jargem_gemsack = GameObj.inv.find {|obj| obj.name == 'storm grey elven tunic'}
# container2 = Your primary jar container (not full jars Gems) -
$jargem_primejarsack = GameObj.inv.find {|obj| obj.name == 'glowing golvern pouch suspended from a thin golvern chain'}
#container 2.5 = Your primary jar container (not full jars Alchemy) *may be the same as gems if you wish
$jargem_primejarsack_alch = GameObj.inv.find {|obj| obj.name == 'storm grey elven tunic'}
# container3 = Empty jar container -
$jargem_emptyjarsack = GameObj.inv.find {|obj| obj.name == 'well-tailored elven linen shirt'}
# container4 = Full jar container (full jar storage) -
$jargem_fulljarsack = GameObj.inv.find {|obj| obj.name == 'veniom threaded harness'}
# number of gems to sell down to when you use ;jargem sell
$jargem_keepnum = 21
silence_me
def jargems_help
echo("Will stick gems into jars (will also do bottles and beakers) - useful for adventure guild gem hoarding")
echo("You MUST can change the hardcoded settings to use this script!")
echo("To sell all except #{$jargem_keepnum} of each type of gem in your #{$jargem_primejarsack.name} type ;jargem sell")
echo("To sell all except a different number type \";jargem sell num\"")
echo("To transfer all jars with > #{$jargem_keepnum} type \";jargem transfer\"")
echo("To transfer jars with a different number of gems type \";jargem transfer num\"")
exit
end
def jars_message(message)
if $fake_stormfront then puts("\034GSL\r\n") else puts("<pushBold\/>") end
puts("===========================================")
puts("| " + message)
puts("===========================================")
if $fake_stormfront then puts("\034GSM\r\n") else puts("<popBold\/>") end
end
#does some chopping and swapping to make sure that .names line up (and it might even get you on a cruse to the tropical paradise!)
def mul_tee_pass_gems(name)
name = name.sub(/\A(piece of|some|small|tiny|medium|large) /, '')
name = name.sub(/ies\z/, 'y')
name = name.sub(/zes\z/, 'z')
name = name.sub(/xes\z/, 'x')
name = name.sub(/s\z/, '')
name = name.sub(/motes\sof\sessence\z/, 'mote of essence')
return name
end
#gets a new jar for (type) of gem type can be (mul_tee_pass_gems(Gameobj.name)) or type for a function elsewhere in this script
def jargem_get_empty(type)
if $jargem_emptyjarsack.contents.find {|item| item.noun =~ /jar|bottle|beaker/}
empty = $jargem_emptyjarsack.contents.find {|item| item.noun =~ /jar|bottle|beaker/}
fput "get ##{empty.id}"
emptyresult = waitfor("Get what", "You remove")
else
jars_message(" You are out of empty jars")
exit
end
if emptyresult =~ /Get what/
jars_message("**** SCRIPT ERROR exiting ****")
exit
else
c= Array.new
c.push(0)
c.push(type)
c.push(GameObj.right_hand.id)
$jars_list.push(c)
return GameObj.right_hand.id
end
end
def jargem_get_jar(gem)
if find_jar(gem)
jar = find_jar(gem)
unless GameObj.right_hand.id == jar
put "get ##{jar} "
waitfor("You remove", "You put ", "won't fit in the", "You are unable to handle the additional load ", "I could not find what you were referring to.", "You drop ", "Get what?")
end
return jar
else
return jargem_get_empty(gem)
end
end
#takes a gem from any location and puts it in the jar in your hand.
def gem_to_jar(gem, id)
jar = jargem_get_jar(gem)
put "_drag ##{id} ##{jar}"
jarresult = waitfor("into your jar", "into your beaker", "into your bottle", "to the contents of", "into your empty", "is full!", "better of mixing", "holding the beaker", "holding the jar", "holding the bottle")
if jarresult =~ /into your empty|into your beaker|into your jar|into your bottle|to the contents of/
elsif jarresult =~ /better of mixing/
jars_message("**** SCRIPT ERROR exiting ****")
exit
elsif jarresult =~ /is full!/
jars_message("**** SCRIPT ERROR exiting ****")
exit
end
if jar_add_one(jar) == 50
full_jar(jar)
stow_jar
end
end
#adds one to the jar id provided
def jar_add_one(jarid)
$jars_list.find {|num, type, id| id == jarid}[0] += 1
return $jars_list.find {|num, type, id| id == jarid}[0]
end
def full_jar(jar)
unless $full_jars
$full_jars = Array.new
end
$full_jars.push("#{$jars_list.find {|num, type, id| id == jar}[2]}")
$jars_list.delete_if {|num, type, id| id == jar}
end
#subtracts 1 from the jar id provided
def jar_take_one(jarid)
$jars_list.find {|num, type, id| id == jarid}[0] -= 1
return $jars_list.find {|num, type, id| id == jarid}
end
#returns the ID of the jar containg (gem) type gems
def find_jar(gem)
if(obj = $jars_list.find {|num, type, id| type == gem}.dup)
return obj[2]
else
return false
end
end
#returns the total number of gems in all jars
#this needs to be changed to include full jars
def gem_count_all
acount = 0; gcount = 0
$jars_list.each {|num, type, id|
if $jars_isitagem.include?("#{type}")
gcount += num
else
acount += num
end
}
return "#{acount} Alchemy items | #{gcount} Gems"
end
#return the number of gems currently in jars based off of GameObj.name or type
#this needs to be changed to include full jars
def gem_count_type(name)
obj = $jars_list.find {|num, type, id| (mul_tee_pass_gems(name) == type)}.dup
return obj[0]
end
def stow_jar
if $jars_list.find {|num, type, id| id == GameObj.right_hand.id}
if $jars_isitagem.include?($jars_list.find {|num, type, id| id == GameObj.right_hand.id}[1])
put "_drag ##{GameObj.right_hand.id} ##{$jargem_primejarsack.id}"
else
put "_drag ##{GameObj.right_hand.id} ##{$jargem_primejarsack_alch.id}"
end
elsif $full_jars.include?(GameObj.right_hand.id)
put "_drag ##{GameObj.right_hand.id} ##{$jargem_fulljarsack.id}"
end
unless GameObj.right_hand.noun == 'Empty'
waitfor("You remove", "You put ", "won't fit in the", "You are unable to handle the additional load ", "I could not find what you were referring to.", "You drop ", "Get what?")
end
if GameObj.right_hand.noun =~ /Empty/
jars_message("**** SCRIPT ERROR exiting ****")
exit
end
end
def jargem_sort(key, val)
$jargem_gem = mul_tee_pass_gems(key)
val.each {|gem|
gem_to_jar($jargem_gem, gem)
}
if GameObj.right_hand.noun != 'Empty'
stow_jar
end
end
def sort
unless defined? $jars_list
fix_jar_list
end
$jargem_first = Hash.new
$jaralch_first = Hash.new
$jargem_gemsack.contents.collect {|gem| if !$jargem_first.key?(gem.name);$jargem_first[gem.name] = Array.new;end;$jargem_first[gem.name].push(gem.id)}
$jaralch_first = $jargem_first.dup
$jargem_first.delete_if {|name, objs| !$gemnames.include?(name)}
$jaralch_first.delete_if {|name, objs| !$alchnames.include?(name)}
$jargems_num = 0
$jaralchs_num = 0
$jargem_first.each {|gem| $jargems_num += gem[1].length}
$jaralch_first.each {|alch| $jaralchs_num += alch[1].length}
start_time = Time.now
fput "open ##{$jargem_primejarsack.id}"
jars_message(" #{$jaralchs_num} Alchemy items || #{$jargems_num} Gems")
$jaralch_first.each {|key, val| jargem_sort(key, val)}
$jargem_first.each {|key, val| jargem_sort(key, val)}
fput "close ##{$jargem_primejarsack.id}"
jars_message("That took #{Time.now - start_time} Seconds.. And we're done! Exiting.")
end
#This needs to check jars in the full container aswell.
def fix_jar_list
fput "open ##{$jargem_primejarsack.id}"
fput "look in ##{$jargem_primejarsack.id}"
wait until $jargem_primejarsack.contents != nil
$jars_list = Array.new
$jargem_primejarsack.contents.each {|jar|
if jar.noun =~ /jar|bottle|beaker/
look_rest = Regexp.new(["you see ([^\D]+) portion(|s) of ([^\.]+)"
].join('|'), "i")
fput "look in ##{jar.id}"
look_result = matchwait(/#{look_rest}/)
if look_result =~ /you see ([^\D]+) portion(|s) of ([^\.]+)/
num = $1
type = $3
type = mul_tee_pass_gems(type)
jarobj = jar.id
c = Array.new
c.push(num.to_i)
c.push(type)
c.push(jarobj)
$jars_list.push(c)
end
end
}
fput "close ##{$jargem_primejarsack.id}"
fput "look in ##{$jargem_primejarsack_alch.id}"
wait until $jargem_primejarsack_alch.contents != nil
$jargem_primejarsack_alch.contents.each {|jar|
if jar.noun =~ /jar|bottle|beaker/
look_rest = Regexp.new(["you see ([^\D]+) portion(|s) of ([^\.]+)"
].join('|'), "i")
fput "look in ##{jar.id}"
look_result = matchwait(/#{look_rest}/)
if look_result =~ /you see ([^\D]+) portion(|s) of ([^\.]+)/
num = $1
type = $3
type = mul_tee_pass_gems(type)
jarobj = jar.id
c = Array.new
c.push(num.to_i)
c.push(type)
c.push(jarobj)
$jars_list.push(c)
end; end
}
end
def sell
$jars_list.each {|num, type, id|
if num > $jargem_keepnum
put "get ##{id}"
(num - $jargem_keepnum).times {
put "shake ##{id}"
waitfor "You give your"
jar_take_one(id)
put "sell my #{GameObj.left_hand.noun}"
}
put "_drag ##{id} ##{$selljar_primejarsack.id}"
waitfor("You put a")
end
}
end
def transfer(num)
if GameObj.pcs.find {|person| person.name == 'Emislity'}
person = GameObj.pcs.find {|person| person.name == 'Emislity'}.dup
$jars_list.each {|num, type, id|
if((num > $jargem_keepnum) and ($jars_isitagem.include?(type)))
fput "take ##{id}"
until GameObj.right_hand.noun =~ /(jar|beaker|bottle)/
end
fput "give ##{person.id}"
until GameObj.right_hand.noun !~ /(jar|beaker|bottle)/
end
$jars_list.delete_if {|numa, typea, ida| id == ida}
end
}
end
end
def jargem_check_vars
if(variable[1] =~ /help|man/i)
jargems_help
elsif((variable[1] =~ /sort/i) or variable[1].nil?)
sort
elsif(variable[1] =~ /sell/i)
if(!variable[2].nil?)
$jargem_keepnum = variable[2].to_i
end
sell
elsif(variable[1] =~ /transfer/i)
if(!variable[2].nil?)
transfer(variable[2].to_i)
else
transfer($jargem_keepnum)
end
elsif(variable[1] =~ /count/i)
if(!variable[2].nil?)
variable.shift
variable.shift
jars_message("#{gem_count_type(mul_tee_pass_gems(variable.join(' ').to_s))} #{mul_tee_pass_gems(variable.join(' ').to_s)}")
else
jars_message("#{gem_count_all}")
end
else
end
end
#loads the database of GameObj.names
unless $gemnames.defined?
start_script('database_setup')
sleep 1
unless $gemnames.defined?
jars_message('Unable to define $gemnames please download database_setup.lic')
exit
end
end
unless $jars_isitagem.defined?
$jars_isitagem = Array.new
$gemnames.each {|gem|
$jars_isitagem.push(mul_tee_pass_gems(gem))
}
$jars_isitanalch = Array.new
$alchnames.each {|alch|
$jars_isitanalch.push(mul_tee_pass_gems(alch))
}
end
#look in the sacks on the first run of each login to get all ids
unless $jargem_thisrun
sacks = [$jargem_gemsack, $jargem_primejarsack, $jargem_emptyjarsack, $jargem_fulljarsack, $jargem_nonsellsack]
sacks.each {|sack|
if sack.contents == nil
fput "look in #{sack}"
end}
fix_jar_list
$jargem_thisrun = true
end
#do what it was told to do
jargem_check_vars
exit
And the database script you can create on your own or chop the parts of this script that you need and put them into jars2
#!/usr/bin/env ruby
=begin
This script simply sets up database arrays for different GameObjs using the .name method
I use it for many scripts, some of which are publicly available (ex. snaggle.lic, jars.lic, peeky.lic) and some that are not yet completed (global_sell.lic etc..)
if you would like any GameObj.names added to the list please feel free to submit them to Joseph@Joseph.Net
=end
##################### ADD NAMES OR NOUNS OF ANY ADDITIONAL LEWTS#########
$gemnames = ["chameleon agate", "fire agate", "piece of golden amber", "deep purple amethyst", "azure blazestar", "crimson blazestar", "emerald blazestar", "golden blazestar", "olivine faenor-bloom", "deep red carbuncle", "piece of white chalcedony", "some polished pink coral", "some polished red coral", "black deathstone", "scarlet despanal", "blue diamond", "uncut diamond", "dragon's-tear diamond", "uncut maernstrike diamond", "black dreamstone", "blue dreamstone", "green dreamstone", "pink dreamstone", "red dreamstone", "white dreamstone", "yellow dreamstone", "dragon's-tear emerald", "dragonfire emerald", "star emerald", "uncut emerald", "periwinkle feystone", "bright violet feystone", "firestone", "green garnet", "orange spessartine garnet", "aquamarine gem", "golden beryl gem", "bright chrysoberyl gem", "green chrysoprase gem", "clear glimaerstone", "cerulean glimaerstone", "golden glimaerstone", "green glimaerstone", "brilliant lilac glimaerstone", "peach glimaerstone", "smoky glimaerstone", "ultramarine glimaerstone", "pale yellow heliodor", "yellow hyacinth", "fiery jacinth", "some blue lapis lazuli", "black moonstone", "blue moonstone", "pale blue moonstone", "cats-eye moonstone", "golden moonstone", "pale green moonstone", "grey moonstone", "opaline moonstone", "silvery moonstone", "piece of spiderweb obsidian", "black opal", "dragonfire opal", "fire opal", "moonglae opal", "white opal", "piece of banded onyx", "piece of black onyx", "large black pearl", "medium black pearl","small black pearl", "tiny black pearl", "large grey pearl", "medium grey pearl","small grey pearl", "tiny grey pearl", "large pink pearl", "medium pink pearl", "small pink pearl", "tiny pink pearl", "large white pearl", "medium white pearl", "small white pearl", "tiny white pearl", "blue peridot", "green peridot", "pink peridot", "some asterfire quartz", "piece of citrine quartz", "piece of cat's eye quartz", "some dragonfire quartz", "shard of rainbow quartz", "piece of rose quartz", "star ruby", "sylvarraend ruby", "uncut ruby", "dragon's-tear ruby", "blue sapphire", "dragonsbreath sapphire", "dragonseye sapphire", "green sapphire", "pink sapphire", "blue shimmarglin sapphire", "lavender shimmarglin sapphire","star sapphire", "violet sapphire", "pale water sapphire", "yellow sapphire", "shimmertine shard", "blue spinel", "pink spinel", "red spinel", "violet spinel", "blue starstone", "green starstone", "red starstone", "white starstone", "polished jet stone", "green malachite stone", "light pink morganite stone", "pink rhodochrosite stone", "turquoise stone", "red sunstone", "white sunstone", "yellow sunstone", "green errisian topaz", "golden topaz", "orange imperial topaz", "pink topaz", "smoky topaz", "black tourmaline", "blue tourmaline", "clear tourmaline", "green tourmaline", "pink tourmaline", "spiderweb turquoise", "green zircon", "yellow zircon"]
$alchnames = ["crystal core", "ayanad crystal", "n'ayanad crystal", "s'ayanad crystal", "t'ayanad crystal", "some radiant essence dust", "some radiant crimson essence dust", "radiant mote of essence", "glimmering blue mote of essence", "radiant crimson mote of essence", "tiny golden seed"]
$boxnouns = [ "box", "coffer", "chest", "strongbox", "trunk"]
$magicnames = ["crystal amulet", "ruby amulet", "black crystal", "blue crystal", "white crystal", "moonstone cube", "solid moonstone cube", "white flask", "quartz orb", "heavy quartz orb", "small statue"]
$magicnouns = [ "palimpsest", "paper", "papyrus", "parchment", "scroll", "vellum", "wand"]
$herbnames =[ "some basal moss", "some ephlox moss", "some ambrominas leaf", "some acantha leaf", "some woth flower", "some cactacae spine", "some sovyn clove", "wingstem potion", "bur-clover potion", "some calamia fruit", "brostheras potion", "some wolifrew lichen", "rose-marrow potion", "some haphip root", "bolmara potion", "some aloeas stem", "talneo potion"]
$normalnames = ["copper lockpick", "steel lockpick"]
$junknames = ["arrow", "stained crystal-edged handaxe", "stained handaxe", "heavy crystal-studded mace", "spiral-hafted handaxe", "polished steel shield", "charcoal grey shield", "heavy star-flanged mace", "curved crystal-edged blade", "curved silvery blade", "gleaming crystal-edged longsword", "gleaming crystal-edged broadsword", "spiral-hafted crystal-edged handaxe", "twisted crystal-tipped staff", "gleaming steel longsword", "gleaming steel broadsword", "severed gremlock arm", "severed gremlock leg", "severed taint arm", "severed taint leg", "moldy bone", "tattered knapsack", "filthy knapsack", "dusty knapsack", "ragged knapsack", "stained knapsack", "table leg", "steel spring", "smooth stone"]
$junknouns = ["bark", "brick", "cloth", "coin", "cookie", "cupcake", "disk", "donut", "doughnut", "doorknob", "fork", "horseshoe", "iron", "muffin", "nail", "spoon", "tart",]
$skinnames = []
$skinnouns = [ "antlers", "bone", "beard", "carapace", "claw", "crest", "ear", "eye", "eyeball", "fang", "feather", "firethorn", "hide", "jawbone", "knuckle", "leg", "mandible", "mane", "nose", "paw", "pelt", "pincer", "scalp", "scraping", "shell", "skin", "skull", "snout", "stinger", "tail", "talon", "thumb", "toe", "tooth", "tongue", "tusk", "wing"]
$roomnames = ["large faenor-chased basket", "long flight of stairs ascending up the outer edge of the wall", "some invading roots", "some vegetation", "some decomposing leaves"]
$roomnouns = ["arch", "door", "stairs", "steps", "portal", "web", "bench", "barrel", "bin", "vortex"]
drakeferas = ["falchion", "scimitar", "greatsword", "hammer", "mace", "mattock", "rapier", "dagger", "yierka-spur", "tiger-claw", "greataxe"]
drakeferas.each {|type|
$junknames.push("drake #{type}")
$junknames.push("feras #{type}")
}
junkjewelry = ["anklet", "bracelet", "coin", "cup", "earring", "medallion", "plate", "ring"]
junkadj = ["bent", "corroded", "dented", "polished", "rusty", "scratched", "shiny", "tarnished", ]
junkjewelry.each {|type|
junkadj.each {|adj|
$junknames.push("#{adj} #{type}")
}
}
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.