Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Tips and tricks ➜ Useful scripts

Useful scripts

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


Posted by Robert Mituniewicz   (5 posts)  Bio
Date Sun 08 Apr 2001 07:23 PM (UTC)

Amended on Sun 08 Apr 2001 09:46 PM (UTC) by Nick Gammon

Message
I would like users that made cool scripts or have good ideas to share over here. Here is my GPS + autosneaking + autocomming back to location where you stareted you GPS.
(It's made to polish mud so it will have polish script names and stuff) Here we go:



World.addalias "zmiana", "zmiana", "", 1025, "onprzemykaniezmiana"
'Then I putted that alias into macro with "send now" checked. It will change between sneaking and walking

sub onprzemykaniezmiana(straliasname,stroutput,arrwildcards)
if world.getvariable("przemykanie") = 0 then
world.setvariable "przemykanie", 1
world.note "Sneaking ON"
exit sub
end if
if world.getvariable("przemykanie") = 1 then
world.setvariable "przemykanie", 0
world.note "Sneaking OFF"
exit sub
end if
end sub


world.addalias "kierunek", "kierunek *", "", 1025, "onprzem"
'Then I add in keypad on KP8 "kierunek north", KP4 "kierunek west" and so on.
sub onprzem(straliasname,stroutput,arrwildcards)
dim kier
dim X
dim Y
dim Z
X = world.getvariable("X")
Y = world.getvariable("Y")
Z = world.getvariable("Z")
kier = arrwildcards (1)
if world.getvariable("przemykanie") = 1 then
world.send "sneak " & kier
else
world.send kier
end if
dim last
dim last2
last2 = world.GetMappingCount
if last2 = 0 then
world.addtomapper "health", "health"
last2 = last2 + 1
end if
last = world.GetMappingItem (last2 - 1)
if world.getvariable("GPS") = 1 then
	world.setvariable "cofnij", kier
        if kier = "nw" then
        	x=x-1
        	y=y+1
        	if last <> "se/nw" then
        	world.AddToMapper "nw", "se"
        	else world.DeleteLastMapItem
        	end if
        end if
	if kier = "n" then
		y=y+1
		if last <> "s/n" then
		world.AddToMapper "n", "s"
		else world.DeleteLastMapItem
		end if
	end if
	if kier = "ne" then
		y=y+1
		x=x+1
		if last <> "sw/ne" then
		world.AddToMapper "ne", "sw"
		else world.DeleteLastMapItem
		end if
	end if
	if kier = "e" then
		x=x+1
		if last <> "w/e" then
		world.AddToMapper "e", "w"
		else world.DeleteLastMapItem
		end if
	end if
	if kier = "se" then
		y=y-1
		x=x+1
		if last <> "nw/se" then
		world.AddToMapper "se", "nw"
		else world.DeleteLastMapItem
		end if
	end if
	if kier = "s" then
		y=y-1
		if last <> "n/s" then
		world.AddToMapper "s", "n"
		else world.DeleteLastMapItem
		end if
	end if
	if kier = "sw" then
		y=y-1
		x=x-1
		if last <> "ne/sw" then
		world.AddToMapper "sw", "ne"
		else world.DeleteLastMapItem
		end if
	end if
	if kier = "w" then
		x=x-1
		if last <> "e/w" then
		world.AddToMapper "w", "e"
		else world.DeleteLastMapItem
		end if
	end if
	if kier = "u" then
		z=z+1
		if last <> "d/u" then
		world.AddToMapper "u", "d"
		else world.DeleteLastMapItem
		end if
	end if
	if kier = "d" then
		z=z-1
		if last <> "u/d" then
		world.AddToMapper "d", "u"
		else world.DeleteLastMapItem
		end if
	end if
world.setvariable "X", x
world.setvariable "Y", y
world.setvariable "Z", z
World.setstatus "GPS: [" & Cstr (world.getvariable ("X")) & "," & Cstr (world.getvariable ("Y")) & "," & Cstr (world.getvariable ("Z")) & "]"
end if
end sub

World.addalias "wroc", "wroc", "", 1025, "onwroc"
'That alias is used to come back to starting location

sub onwroc(straliasname,stroutput,arrwildcards)
world.send world.EvaluateSpeedwalk (world.ReverseSpeedwalk (world.GetMappingString))
world.DeleteAllMapItems
end sub

'That subroutine is used to cancel last move in GPS (Because you where to tired to go ther or there was no such exit)
sub oncofnij(strtriggername,stroutput,arrwildcards)
if world.getvariable("GPS") = 1 then
	dim X
	dim Y
	dim Z
	X = world.getvariable("X")
	Y = world.getvariable("Y")
	Z = world.getvariable("Z")
	world.DeleteLastMapItem
	dim kier
	kier = world.getvariable("cofnij")
	        if kier = "nw" then
	        	x=x+1
	        	y=y-1
	        end if
		if kier = "n" then
			y=y-1
		end if
		if kier = "ne" then
			y=y-1
			x=x-1
		end if
		if kier = "e" then
			x=x-1
		end if
		if kier = "se" then
			y=y+1
			x=x-1
		end if
		if kier = "s" then
			y=y+1
		end if
		if kier = "sw" then
			y=y+1
			x=x+1
		end if
		if kier = "w" then
			x=x+1
		end if
		if kier = "u" then
			z=z-1
		end if
		if kier = "d" then
			z=z+1
		end if
	world.setvariable "X", x
	world.setvariable "Y", y
	world.setvariable "Z", z
	World.setstatus "GPS: [" & Cstr (world.getvariable ("X")) & "," & Cstr (world.getvariable ("Y")) & "," & Cstr (world.getvariable ("Z")) & "]"
end if
end sub

'That alias is used to set starting location

world.addalias "gpson", "gps", "", 1025, "ongpson"
sub ongpson(straliasname,stroutput,arrwildcards)
if world.getvariable("GPS") = 0 then
world.setvariable "GPS", 1
world.note "GPS - ON"
world.setvariable "X", 0
world.setvariable "Y", 0
world.setvariable "Z", 0
world.DeleteAllMapItems
'We add these trigger to cancel last move in GPS
World.addtrigger "GPS1", "*There is no such exit*", "", 1, 13, 0, "", "oncofnij"
World.addtrigger "GPS2", "*you are to tired to go there*", "", 1, 13, 0, "", "oncofnij"
exit sub
end if
if world.getvariable("GPS") = 1 then
world.setvariable "GPS", 0
world.note "GPS - off"
World.DeleteTrigger "GPS1"
World.DeleteTrigger "GPS2"
exit sub
end if
end sub





There. It works cool
___
Robert Mituniewicz
Top

Posted by Robert Mituniewicz   (5 posts)  Bio
Date Reply #1 on Mon 09 Apr 2001 07:58 PM (UTC)

Amended on Sat 14 Apr 2001 09:19 PM (UTC) by Nick Gammon

Message
How to replace text in output window:

Step 1:
Make trigger for the word you want to replace with other string.
For example we will change from "You massacre someone" to "*** YOU ANNIHILATE *** someone"

Trigger on "You massacre *"
Flags: Omit from output
Enabled

Step 2:
Make subroutine


sub masacre(strtriggername,stroutput,arrwildcards)
dim wild
wild = arrwildcards (1)
world.notecolour 1  'Change notes color to match output text color
world.note "*** YOU ANNIHILATE *** " & wild
world.notecolour 16  'Switch back color to original notes color
end sub



____
Robert Mituniewicz
Top

Posted by Robert Mituniewicz   (5 posts)  Bio
Date Reply #2 on Sat 14 Apr 2001 08:31 AM (UTC)

Amended on Sat 14 Apr 2001 09:22 PM (UTC) by Nick Gammon

Message
How to make kill logs? That easy:

Firstly make trigger "You killed *"

Then make script:


onkills(strtriggername,stroutput,arrwildcards)
dim wild
wild = arrwildcards (1)
world.AppendToNotepad "Killlog", "*** " & wild & "*** Time: " & now() & vbcrlf

end sub




If you wanna have a kill counter you may add this:


dim kills
dim all
kills = World.GetVariable ("kills")
all = World.GetVariable ("all")
kills = kills + 1
all = all + 1
world.note " Kills: [ " & kills & "/" & all & "]"




'You have to zero that stats when you open world so You just have to add following things in "OnWorldOpen" subroutine


world.setvariable "kills", 0
world.setvariable "all", 0

____
Robert Mituniewicz



Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #3 on Sat 14 Apr 2001 09:24 PM (UTC)
Message
Thanks for the scripts, Robert.

BTW - for the kill counter to work you would have to put the numbers back into the variables, like this:


kills = World.GetVariable ("kills")
all = World.GetVariable ("all")
kills = kills + 1
all = all + 1
World.SetVariable "kills", kills  ' save result
World.SetVariable "all", all  ' save result


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Riven   (2 posts)  Bio
Date Reply #4 on Wed 18 Apr 2001 01:13 AM (UTC)
Message
Here's an attempt to make a sort of auto-attack trigger. This'll basically be as simple as possible, but can be easily made more complex and more useful. Just laying down the structure for it first. And by the way I haven't bug tested it yet, so not sure if it works yet or not.

Alias: gimp *            -sets who you want to kill.
Script: gimp

Alias: killtype *        -sets how you want to kill them.
Script: killtype

Trigger: ^@gimp (walks|limps|crawls) *
Send: %1;@killtype @gimp

The trigger will go in the direction @gimp goes (this is basically assuming you're already fighting them and they flee) and attack them with whatever killtype you set. Expand variables needs to be checked. It'll only fire if it matches at the beginning of the screen, so you don't get people who know your scripts sending you tells with Blah walks east in them and stuff to get you to walk into aggy mobs.


Script:
sub gimp (strAliasName, strOutput, arrWildCards)
world.setvariable "gimp", arrWildCards (1)
end.sub

sub killtype (strAliasName, strOutput, arrWildCards)
world.setvariable "killtype", arrWildCards (1)


I think that about covers it. This setup breaks down with characters that sneak, since you can't see which direction they go and the trigger never fires. Most prefer to set up a trigger that will scan, then walk in the direction and attack, which is more complicated and depends on the MUD.

Personally, I don't care for using the trigger since if you start losing but the person you're fighting flees anyway, you'll automatically track them and kill yourself. I use an alias instead, where I just type a quick command (I usually have it set to kc) to put the whole @killtype @gimp in. kc is a lot easier to type than murder somelongidiotplayersname.

So anyways, there ya go. Basis for a pk script. I wasn't entirely clear on some of the coding so there's probably bugs to work out. Oh well.

Riven
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #5 on Wed 18 Apr 2001 10:40 PM (UTC)
Message
You can't use a variable in the trigger string, like this:


Trigger: ^@gimp (walks|limps|crawls) *


However you can work around this by getting the "gimp" subroutine to do an "addtrigger" and (by using wildcard (1)) set up the trigger with the correct monster name.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
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.


24,248 views.

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

Go to topic:           Search the forum


[Go to top] top

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