[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  VBscript
. . -> [Subject]  help needed
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

help needed

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Unknownwanderer   (6 posts)  [Biography] bio
Date Sun 04 Apr 2004 01:29 AM (UTC)
Message
I need scipt that shows my prots and how long those have been on. I tried to do it myself but no success =(
here is how someone has done it in zmud:

#echo ### StatusBar Triggers (Camping and Prots) ###
#var prots {} {}
#var protstimed {} {}
#alias check {#if (@prots<>"") {party report say Prots: @{prots}} {party report say Prots: NONE}}
#alias clear {#var prots {} {};#var campstatus {Available} {}}
#alias timer {#math %1 (%time(yyyy)-1970)*365*24*60*60);#math %1 @%1+(%time(m)*30*24*60*60);#math %1 @%1+(%time(d)*24*60*60);#math %1 @%1+(%time(h)*60*60);#math %1 @%1+(%time(n)*60);#math %1 @%1+%time(s)}
#alias formattime {timer currenttime;#math tmptime @currenttime-@%1;#math tmpmin @tmptime/60;#math tmpsek @tmptime-(@tmpmin*60)];#if (@tmpmin=0) {#var timed [@{tmpsek}s]} {#var timed [@{tmpmin}m@{tmpsek}s]}}
#echo ### Prot Triggers ###
#trigger {You suddenly feel magically heavier.} {timer hwtime;party report say Heavy Weight Active.;#if !%ismember(HW,@prots) {#var prots %additem(HW,@prots)}} {prot-t}
#trigger {You feel lighter, but it doesn't seem to affect your weight!} {formattime hwtime;party report say Heavy Weight Expires. ~[[@{timed}]~];#var prots %delitem(HW,@prots)} {prot-t}


shows in game something like:
xxx [party]: Prots: HW (1:31) Unstun (0:20)
[Go to top] top

Posted by Ked   Russia  (524 posts)  [Biography] bio
Date Reply #1 on Sun 04 Apr 2004 07:43 AM (UTC)
Message
This looks like something that displays the duration a spell's been active, but unfortunately the script is a non-comprehensible maze. Can you specify how the information should be displayed, and what the lines are exactly for individual spells becoming active and fading? Looks like the information is sent to some channel, but if so then how often does that happen?
[Go to top] top

Posted by Unknownwanderer   (6 posts)  [Biography] bio
Date Reply #2 on Sun 04 Apr 2004 02:10 PM (UTC)
Message
ok, hope this is bit clearer =)

#var protstimed {} {}
#alias check {#if (@prots<>"") {party report say Prots: @{prots}} {party report say Prots: NONE}}
#alias clear {#var prots {} {}}
#alias timer {
#math %1 (%time(yyyy)-1970)*365*24*60*60);
#math %1 @%1+(%time(m)*30*24*60*60);
#math %1 @%1+(%time(d)*24*60*60);
#math %1 @%1+(%time(h)*60*60);
#math %1 @%1+(%time(n)*60);
#math %1 @%1+%time(s)
}
#alias formattime {
timer currenttime;
#math tmptime @currenttime-@%1;
#math tmpmin @tmptime/60;
#math tmpsek @tmptime-(@tmpmin*60)];
#if (@tmpmin=0)
{#var timed [@{tmpsek}s]}
{#var timed [@{tmpmin}m@{tmpsek}s]}
}
#echo ### Prot Triggers ###
#trigger {
You suddenly feel magically heavier.} {
timer hwtime;
party report say Heavy Weight Active.;
#if !%ismember(HW,@prots) {
#var prots %additem(HW,@prots)}} {prot-t
}
#trigger {
You feel lighter, but it doesn't seem to affect your weight!} {
formattime hwtime;
party report say Heavy Weight Expires. ~[[@{timed}]~];
#var prots %delitem(HW,@prots)} {prot-t
}

+ triggers for n+1 others spells.

so this script should display only spells that are casted and theirs times, and only from players demand. So theres no need to make it report every 10sec or so.
so it shouldnt look like:
xxx [party]: unstun (1:20) unpain (0:20) fabs N/A flexshield N/A etc.... cos it would be too damn long
the way it should be:
check
xxx [party]: prots: NONE or
check
xxx [party]: prots: unstun (0:10) flexshield (0:12)

hope this wasnt too messy =)
[Go to top] top

Posted by Gore   (207 posts)  [Biography] bio
Date Reply #3 on Mon 05 Apr 2004 03:38 AM (UTC)

Amended on Mon 05 Apr 2004 10:29 PM (UTC) by Nick Gammon

Message
Well, first off, you didn't document anything about your script. I can sort of get some of the gist of it (not the timing part) but that's it. I'm not sure what your "prot members" string is, but in vbscript you'd have to use arrays. See

http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=3754

it's a good post on arrays :p I don't know anything about times in vbscript at all, is there anychance you could post a -walk- through of what your code does as opposed to pasting your undocumented zmud code?

When I switched from zmud to mushclient, I originally tried to convert all of my scripts over, now I realize it's just best not to even look at the zmud scripts, and rewrite your scripts for mushclient on their own :p
[Go to top] top

Posted by Ked   Russia  (524 posts)  [Biography] bio
Date Reply #4 on Mon 05 Apr 2004 05:38 AM (UTC)
Message
Yep, that makes a bit more sense. Oookay... the 'timer' alias looks like some twisted way of getting a timediff, lets see...

Here's a plugin that does all the same things as your script, has the same 'check' and 'clear' aliases to control it, plus 2 triggers to add/remove the Heavy Weight prot. Both triggers should send to scripting, adding trigger should call the AddProt sub and send the report directly to the world, this is the contents of its Send box:


call AddProt("prot_name")
world.send "party report say prot_name active!"


removing trigger calls the RemoveProt sub and do an opposite announce:


call RemoveProt("prot_name")
world.send "party report say prot_name expires!"


You can copy the bellow code, paste it into an empty text file, save as "ProtsReport.xml" in your plugins folder, and install the resulting file as Mushclient's plugin. Note that only the script was tested - triggers and aliases might be off.


<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE muclient >

<muclient>
   <plugin name="ProtsReport" author="Keldar" language="vbscript" purpose="Reporting the status of prots"
     save_state="y" date_written="2004-04-05" requires="3.42" version="1.0" id="783968f7b4c746ec0f6d2bdf">
   </plugin>

<aliases>
<alias
 name="check_prots"
 match="check"
 enabled="y"
 send_to="12"
 sequence="100"
 ><send>call ReportProts</send></alias>
<alias
 name="clear_prots"
 match="clear"
 enabled="y"
 send_to="12"
 sequence="100"
 ><send>call ClearProts</send></alias>
</aliases>

<triggers>
<trigger
 match="You suddenly feel magically heavier\."
 regexp="y"
 enabled="y"
 send_to="12"
 sequence="100"
><send>call AddProt(&quot;HW&quot;)
world.send &quot;party report say Heavy Weight Active.&quot;</send></trigger>
<trigger
 match="You feel lighter, but it doesn't seem to affect your weight\!"
 regexp="y"
 enabled="y"
 send_to="12"
 sequence="100"
><send>call RemoveProt(&quot;HW&quot;)
world.send &quot;party report say Heavy Weight Expires.&quot;</send></trigger>
</triggers>

<script> 
<![CDATA[
dim start_times
set start_times = CreateObject("Scripting.Dictionary")

function GetTimeDiff(prot)
	time_now = Timer
	if start_times.Exists(prot) then
		GetTimeDiff = time_now - start_times.Item(prot)
	end if
end function

function FormatTime(diff)
	tmp_time = cint(diff)
	if (tmp_time) < 60 then
		mins = "0"
		secs = tmp_time
	else
		mins = cint((tmp_time)/60)
		secs = tmp_time Mod 60
	end if
	if secs < 10 then
		secs = "0" & secs
	end if
	FormatTime = cstr(mins) & ":" & cstr(secs)
end function

sub ReportProts
	dim tmp_time, prot, output
	output = ""
	for each prot in start_times.Keys
		tmp_time = FormatTime(GetTimeDiff(prot))
		output = output & prot & " (" & tmp_time & ") " 
	next
	world.send "party report say " & output
end sub

sub AddProt(prot)
	if (not start_times.Exists(prot)) then
		start_times.Add prot, Timer
	end if
end sub

sub RemoveProt(prot)
	if start_times.Exists(prot) then
		start_times.Remove(prot)
	end if
end sub

sub ClearProts
	start_times.RemoveAll
end sub
]]>        
</script>

</muclient>
[Go to top] top

Posted by Unknownwanderer   (6 posts)  [Biography] bio
Date Reply #5 on Mon 05 Apr 2004 06:45 AM (UTC)
Message
wow! it worked like a charm! just the way I wanted it =) many many many thanks to you =)
[Go to top] top

Posted by Bjoernar   (1 post)  [Biography] bio
Date Reply #6 on Mon 19 Jul 2004 12:10 PM (UTC)
Message
First of all, thank you!
I was also looking for exactly what this plugin does.

However, since I'm clueless with scripting I'd like to ask how to do a little extra to that script:

Certain prots in BatMud, the game for which the above example was, give the same message when cast on you regardless of the protection type (fire,acid,mana,physical etc.)

When one of those is cast on you, you would see something like this:

--
Frodo utters the magic words 'hot hot not zeis daimons'
You sense a powerful protective aura around you.
--
The 'hot hot not zeis daimons' -part tells what type of spell has been cast, but the part that says it's been cast on you stays the same.

Here's an example of zmud-triggers someone made for this:

echo Loading Conjurer Prots...
#trigger {You sense a powerful protective aura around you.} {#if (@conjprot=force) {timer forcetime;p~' Force Absorbsion UP};#if (@conjprot=fire) {timer firetime;p~' Heat Reduction UP};#if (@conjprot=cold) {timer coldtime;p~' Frost Insulation UP};#if (@conjprot=poison) {timer poisontime;p~' Toxic Dilution UP};#if (@conjprot=magic) {timer magictime;p~' Magic Dispersion UP};#if (@conjprot=acid) {timer acidtime;p~' Corrosion Shield UP};#if (@conjprot=electric) {timer electrictime;p~' Energy channeling UP};#if (@conjprot=asphx) {timer asphxtime;p~' Ether Boundary UP};#if (@conjprot=psi) {timer psitime;p~' Psychic Sanctuary UP}} {prot}
#trigger {You sense an extra powerful protective aura around you.} {#if (@conjprot=force) {timer forcetime;p~' Force Absorbsion UP (Sticky)};#if (@conjprot=fire) {timer firetime;p~' Heat Reduction UP (Sticky)};#if (@conjprot=cold) {timer coldtime;p~' Frost Insulation UP (Sticky)};#if (@conjprot=poison) {timer poisontime;p~' Toxic Dilution UP (Sticky)};#if (@conjprot=magic) {timer magictime;p~' Magic Dispersion UP (Sticky)};#if (@conjprot=acid) {timer acidtime;p~' Corrosion Shield UP (Sticky)};#if (@conjprot=electric) {timer electrictime;p~' Energy channeling UP (Sticky)};#if (@conjprot=asphx) {timer asphxtime;p~' Ether Boundary UP (Sticky)};#if (@conjprot=psi) {timer psitime;p~' Psychic Sanctuary UP (Sticky)}} {prot}
#trigger {ztonez des deckers} {#var conjprot force} {prot}
#trigger {A skin brown flash momentarily surrounds you} {formattime forcetime;p~' Force Absorbsion DOWN ~[[@{timed}]~]} {prot}
#trigger {hot hot not zeis daimons} {#var conjprot fire} {prot}
#trigger {A burning red flash momentarily surrounds you} {formattime firetime;p~' Heat Reduction DOWN ~[[@{timed}]~]} {prot}
#trigger {skaki barictos yetz fiil} {#var conjprot cold} {prot}
#trigger {A cold white flash momentarily surrounds you} {formattime coldtime;p~' Frost Insulation DOWN ~[[@{timed}]~]} {prot}
#trigger {morri nam pantoloosa} {#var conjprot poison} {prot}
#trigger {A green flash momentarily surrounds you} {formattime poisontime;p~' Toxic Dilution DOWN ~[[@{timed}]~]} {prot}
#trigger {meke tul magic} {#var conjprot magic} {prot}
#trigger {A golden flash momentarily surrounds you} {formattime magictime;p~' Magic Dispersion DOWN ~[[@{timed}]~]} {prot}
#trigger {sulphiraidzik hydrochloodriz gidz zuf} {#var conjprot acid} {prot}
#trigger {A disgusting yellow flash momentarily surrounds you} {formattime acidtime;p~' Corrosion Shield DOWN ~[[@{timed}]~]} {prot}
#trigger {kablaaaammmmm bliitz zundfer} {#var conjprot electric} {prot}
#trigger {A crackling blue flash momentarily surrounds you} {formattime electrictime;p~' Energy channeling DOWN ~[[@{timed}]~]} {prot}
#trigger {qor monoliftus} {#var conjprot asphx} {prot}
#trigger {A dull black flash momentarily surrounds you} {formattime asphxtime;p~' Ether Boundary DOWN ~[[@{timed}]~]} {prot}
#trigger {toughen da mind reeez un biis} {#var conjprot psi} {prot}
#trigger {A transparent flash momentarily surrounds you} {formattime psitime;p~' Psychic Sanctuary DOWN ~[[@{timed}]~]} {prot}


I'd be happy to give you more information if someone is interested in helping out.
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


7,567 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]