Useful scripts

Posted by Robert Mituniewicz on Sun 08 Apr 2001 07:23 PM — 6 posts, 25,435 views.

#0
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
Amended on Sun 08 Apr 2001 09:46 PM by Nick Gammon
#1
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
Amended on Sat 14 Apr 2001 09:19 PM by Nick Gammon
#2
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



Amended on Sat 14 Apr 2001 09:22 PM by Nick Gammon
Australia Forum Administrator #3
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

#4
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
Australia Forum Administrator #5
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.