stormtov
12-29-2008, 03:22 PM
OK thought i would make a thread for putting any useful sorcery related scripts. I've just seen that Gib's pickup and phase script seems to of gone so if he could repost(or some one on his behalf) that would be good.
First off here is a script for lich to track the duration left on phased containers. Here is a quick pic to show what it looks like:
http://img136.imageshack.us/img136/8424/704monitorsm8.jpg
It currently should cut off the long description on items as shown above, only got the one item to test that with though.
Shown is just the default window size, you can adjust the height of it by opening up the script(more info on this in the script notes).
=begin
704 monitor
Will pop up a window when the script starts and write to it when ever you phase a container showing it's name and duration left.
Currently does not save anything between runs of the script. If you close the script(like when you log off) it will not remember phased containers and their durations
If you would like to change the window height open up the script(notepad will do) and change the line at the top that reads height = 55
***Bug Fixes***
30/12/08 - Fixed a bug where casting any spell at a phased item would clear it from the monitor
***Updates***
30/12/08 - Will save durations for when you log off. If you kill the script but stay logged into game the durations it will greatly effect the accuracy of the duration(it only counts down while the script is running).
30/12/08 - Added a clear command. The format is ";send 704monitor clear (all|1|2|3....)" The bit in the brackets responds to what it is clearing. All to clear the whole window or if using a number it will clear that line only(entering 2 clears the 2nd line).
30/12/08 - Detects the phase duration being ended earlier(by dropping, recasting phase or by using dispel. I don't know of any other ways) even when an item is still an another container.
29/12/08 - Will detect you ending the duration of phase early if the item is in your hand when it happens. Like if your trying to drop it
***Future updates***
Look into tracking items my ID, but looking unlikely as phasing changes the container ID. Currently if you have two items with the same name it will track them both but when ending the duration early it will remove the first ocurance of the item from the tracker no matter which one you unphase.
***Contact Me***
If there is a problem with the script or you have suggestions feel free to contact Dalzashel on psinet or lich or "ed002002" on aim/yahoo
=end
Settings.load
Settings[Char.name] = Hash.new unless Settings[Char.name].kind_of? Hash
before_dying{;puts("<closeDialog id=\"704_monitor\"\/>");Settings.save;}
height = 55 #Change the height of the window here(deafult 55, enough for 3 lines. With default font size add 11 for any extra line). If window is already open will need to be closesd before thsi change can take effect.
def save_durations()
if $time_phased.empty?
Settings[Char.name]["time"] = "empty"
else
x=0
saved_time = Array.new
loop{
saved_time[x] = Time.now - $time_phased[x]
x = x + 1
break if x > ($time_phased.length - 1)
}
Settings[Char.name]["time"] = saved_time
$container_full.compact!
Settings[Char.name]["saved_container_full"] = $container_full.compact
$container_short.compact!
Settings[Char.name]["saved_container_short"] = $container_short.compact
end
end
def load_duration()
if Settings[Char.name]["time"] == "empty"
clear_arrays()
else
x = 0
$time_phased = Array.new
loop{
$time_phased[x] = Time.now - Settings[Char.name]["time"][x]
x = x + 1
$x = x
break if x > (Settings[Char.name]["time"].length - 1)
}
$container_full = Settings[Char.name]["saved_container_full"]
$container_short = Settings[Char.name]["saved_container_short"]
end
end
def shorten()
x = 0
y = 0
$container_split = $container_full[$x].split(" ")
$container_split.compact!
$check = false
loop {
if $container_split[x]== $container_short[$x]
$check = true
x = x + 1
end
if $check == true
$container_split[x] = nil
end
x = x + 1
break if x > ($container_split.length - 1)
}
$container_full[$x] = $container_split.compact! * " "
end
def remove()
x = 0
loop {
if $container_full[x] =~ /#{$remove_item}/
$time_phased[x] = $time_phased[x] - $duration
break
else
x = x + 1
break if x > ($container_full.length - 1)
end
}
end
def clear_arrays()
$container_full = Array.new
$container_short = Array.new
$time_phased = Array.new
$x = 0
end
puts("<openDialog type='dynamic' id='704_monitor' title='Phase Duration Monitor' location='center' height='#{height}' width='300'><dialogData id='espWindowControl'><label id='lblHeader' value='' top='0' left='0' width='138'/></dialogData></openDialog>")
if Settings[Char.name]["first_time?"] != "no"
echo "This script should track your durations fine unless you kill the script and stayed logged into game. It will save the durations though so if you log out it will remember the durations. Just make sure to add the script to your favourates so it runs on startup"
respond "If for what ever reason the timing is off you can remove them from the window manually using ';send 704monitor clear (all/1/2/3...)' Entering all clears all the window entering a number clears just the line only(ie entering 2 will clear just the second line)"
respond "This message will only display once so hope you were paying attention"
clear_arrays()
else
load_duration()
end
Settings[Char.name]["first_time?"] = "no"
Settings.save
$duration = 600 + (Spells.sorcerer * 6)
phase_monitor = Thread.new {
loop {
line = get
if line =~ /You gesture at a shifting (.+)\./
$remove_item = $1
line = get
if line =~ /Your spell has no effect/
$remove_item = nil
else
remove()
end
elsif line =~ /You gesture at (a|an) (.+)\./
$container_full[$x] = $2
elsif line =~ /The (.+) becomes momentarily insubstantial and appears lighter\.|The (.+) becomes somewhat insubstantial and appears lighter\./
if $1.empty? == false
$container_short[$x] = $1
else
$container_short[$x] = $2
end
$time_phased[$x] = Time.now
shorten()
$x = $x + 1
elsif line =~ /Your (.+) feels somewhat heavier./
#ill get there
elsif line =~ /(Your|The) (.+) flickers in and out of existence for a moment but then stabilizes. It seems heavier./
$remove_item = $2
remove()
elsif line =~ /^704monitor clear (\w+)$/
clear = $1
if clear == "all"
x = 0
loop {
$time_phased[x] = $time_phased[x] - $duration
x = x + 1
break if x > ($time_phased.length - 1)
}
else
$time_phased[clear.to_i-1] = $time_phased[clear.to_i-1] - $duration
end
end
z = 0
loop {
z=z+1
break if z > ($container_short.length - 1)
}
}
}
duration_thread = Thread.new {
loop {
if $container_short.length > 0
time_now = Time.now
z=0
loop {
time_elapsed = time_now - $time_phased[z]
$time_left = $duration - time_elapsed
mins = $time_left/60
secs = $time_left%60
if $time_left > 0
puts("<dialogData id='704_monitor'><label id='duration#{z}' value='#{$container_full[z]}: #{mins.to_i}M #{secs.to_i}' top='#{z*15}' left='0' height='20' align='n' width='300' tooltip='Meh'/></dialogData>")
z=z+1
else
a=z
$container_short[a] = nil
$container_short.compact!
$container_full[a] = nil
$container_full.compact!
$time_phased[a] = nil
$time_phased.compact!
loop {
puts("<dialogData id='704_monitor'><label id='duration#{a}' value='' top='0' left='0' height='20' align='n' width='300' tooltip='Meh'/></dialogData>")
a = a + 1
break if a > ($container_short.length)
}
$x = $x - 1
#z=z+1
end
#sleep 1
break if z > ($container_short.length - 1)
}
else
sleep 1
end
sleep 1
}
}
save_thread = Thread.new {
loop {
save_durations()
Settings.save
sleep 1
}
}
phase_monitor.join
duration_thread.join
save_thread.join
If you find any bugs please feel free to point them out here or message Dalzashel in game on psinet/lich
First off here is a script for lich to track the duration left on phased containers. Here is a quick pic to show what it looks like:
http://img136.imageshack.us/img136/8424/704monitorsm8.jpg
It currently should cut off the long description on items as shown above, only got the one item to test that with though.
Shown is just the default window size, you can adjust the height of it by opening up the script(more info on this in the script notes).
=begin
704 monitor
Will pop up a window when the script starts and write to it when ever you phase a container showing it's name and duration left.
Currently does not save anything between runs of the script. If you close the script(like when you log off) it will not remember phased containers and their durations
If you would like to change the window height open up the script(notepad will do) and change the line at the top that reads height = 55
***Bug Fixes***
30/12/08 - Fixed a bug where casting any spell at a phased item would clear it from the monitor
***Updates***
30/12/08 - Will save durations for when you log off. If you kill the script but stay logged into game the durations it will greatly effect the accuracy of the duration(it only counts down while the script is running).
30/12/08 - Added a clear command. The format is ";send 704monitor clear (all|1|2|3....)" The bit in the brackets responds to what it is clearing. All to clear the whole window or if using a number it will clear that line only(entering 2 clears the 2nd line).
30/12/08 - Detects the phase duration being ended earlier(by dropping, recasting phase or by using dispel. I don't know of any other ways) even when an item is still an another container.
29/12/08 - Will detect you ending the duration of phase early if the item is in your hand when it happens. Like if your trying to drop it
***Future updates***
Look into tracking items my ID, but looking unlikely as phasing changes the container ID. Currently if you have two items with the same name it will track them both but when ending the duration early it will remove the first ocurance of the item from the tracker no matter which one you unphase.
***Contact Me***
If there is a problem with the script or you have suggestions feel free to contact Dalzashel on psinet or lich or "ed002002" on aim/yahoo
=end
Settings.load
Settings[Char.name] = Hash.new unless Settings[Char.name].kind_of? Hash
before_dying{;puts("<closeDialog id=\"704_monitor\"\/>");Settings.save;}
height = 55 #Change the height of the window here(deafult 55, enough for 3 lines. With default font size add 11 for any extra line). If window is already open will need to be closesd before thsi change can take effect.
def save_durations()
if $time_phased.empty?
Settings[Char.name]["time"] = "empty"
else
x=0
saved_time = Array.new
loop{
saved_time[x] = Time.now - $time_phased[x]
x = x + 1
break if x > ($time_phased.length - 1)
}
Settings[Char.name]["time"] = saved_time
$container_full.compact!
Settings[Char.name]["saved_container_full"] = $container_full.compact
$container_short.compact!
Settings[Char.name]["saved_container_short"] = $container_short.compact
end
end
def load_duration()
if Settings[Char.name]["time"] == "empty"
clear_arrays()
else
x = 0
$time_phased = Array.new
loop{
$time_phased[x] = Time.now - Settings[Char.name]["time"][x]
x = x + 1
$x = x
break if x > (Settings[Char.name]["time"].length - 1)
}
$container_full = Settings[Char.name]["saved_container_full"]
$container_short = Settings[Char.name]["saved_container_short"]
end
end
def shorten()
x = 0
y = 0
$container_split = $container_full[$x].split(" ")
$container_split.compact!
$check = false
loop {
if $container_split[x]== $container_short[$x]
$check = true
x = x + 1
end
if $check == true
$container_split[x] = nil
end
x = x + 1
break if x > ($container_split.length - 1)
}
$container_full[$x] = $container_split.compact! * " "
end
def remove()
x = 0
loop {
if $container_full[x] =~ /#{$remove_item}/
$time_phased[x] = $time_phased[x] - $duration
break
else
x = x + 1
break if x > ($container_full.length - 1)
end
}
end
def clear_arrays()
$container_full = Array.new
$container_short = Array.new
$time_phased = Array.new
$x = 0
end
puts("<openDialog type='dynamic' id='704_monitor' title='Phase Duration Monitor' location='center' height='#{height}' width='300'><dialogData id='espWindowControl'><label id='lblHeader' value='' top='0' left='0' width='138'/></dialogData></openDialog>")
if Settings[Char.name]["first_time?"] != "no"
echo "This script should track your durations fine unless you kill the script and stayed logged into game. It will save the durations though so if you log out it will remember the durations. Just make sure to add the script to your favourates so it runs on startup"
respond "If for what ever reason the timing is off you can remove them from the window manually using ';send 704monitor clear (all/1/2/3...)' Entering all clears all the window entering a number clears just the line only(ie entering 2 will clear just the second line)"
respond "This message will only display once so hope you were paying attention"
clear_arrays()
else
load_duration()
end
Settings[Char.name]["first_time?"] = "no"
Settings.save
$duration = 600 + (Spells.sorcerer * 6)
phase_monitor = Thread.new {
loop {
line = get
if line =~ /You gesture at a shifting (.+)\./
$remove_item = $1
line = get
if line =~ /Your spell has no effect/
$remove_item = nil
else
remove()
end
elsif line =~ /You gesture at (a|an) (.+)\./
$container_full[$x] = $2
elsif line =~ /The (.+) becomes momentarily insubstantial and appears lighter\.|The (.+) becomes somewhat insubstantial and appears lighter\./
if $1.empty? == false
$container_short[$x] = $1
else
$container_short[$x] = $2
end
$time_phased[$x] = Time.now
shorten()
$x = $x + 1
elsif line =~ /Your (.+) feels somewhat heavier./
#ill get there
elsif line =~ /(Your|The) (.+) flickers in and out of existence for a moment but then stabilizes. It seems heavier./
$remove_item = $2
remove()
elsif line =~ /^704monitor clear (\w+)$/
clear = $1
if clear == "all"
x = 0
loop {
$time_phased[x] = $time_phased[x] - $duration
x = x + 1
break if x > ($time_phased.length - 1)
}
else
$time_phased[clear.to_i-1] = $time_phased[clear.to_i-1] - $duration
end
end
z = 0
loop {
z=z+1
break if z > ($container_short.length - 1)
}
}
}
duration_thread = Thread.new {
loop {
if $container_short.length > 0
time_now = Time.now
z=0
loop {
time_elapsed = time_now - $time_phased[z]
$time_left = $duration - time_elapsed
mins = $time_left/60
secs = $time_left%60
if $time_left > 0
puts("<dialogData id='704_monitor'><label id='duration#{z}' value='#{$container_full[z]}: #{mins.to_i}M #{secs.to_i}' top='#{z*15}' left='0' height='20' align='n' width='300' tooltip='Meh'/></dialogData>")
z=z+1
else
a=z
$container_short[a] = nil
$container_short.compact!
$container_full[a] = nil
$container_full.compact!
$time_phased[a] = nil
$time_phased.compact!
loop {
puts("<dialogData id='704_monitor'><label id='duration#{a}' value='' top='0' left='0' height='20' align='n' width='300' tooltip='Meh'/></dialogData>")
a = a + 1
break if a > ($container_short.length)
}
$x = $x - 1
#z=z+1
end
#sleep 1
break if z > ($container_short.length - 1)
}
else
sleep 1
end
sleep 1
}
}
save_thread = Thread.new {
loop {
save_durations()
Settings.save
sleep 1
}
}
phase_monitor.join
duration_thread.join
save_thread.join
If you find any bugs please feel free to point them out here or message Dalzashel in game on psinet/lich