 |
phillip Newbie
Joined: 16 Aug 2003 Posts: 6 Location: Ireland
|
Posted: Sat Aug 23, 2003 10:56 am
Help with a locating script |
Many moons ago in the mud i played, a great man called charbal had an excellent script that when i located objects, i could report easily what i located to others. Below is an example of what i see when i locate an item called "pack"
an embroidered, cotton shoulder bag - [WmxudSA5IDQ5MGE1ZGFiZGQgNDY=] - somewhere around here, carried by a human.
a backpack - [VGVkcDAgOSA0MGYxNjdjZDU0IDY2] - somewhere far north of here, carried by a trolloc.
a belt pack - [WmxudSA5IDQ5MGE1ZGFiZGQgMTA=] - somewhere around here, carried by a human.
a backpack - [YmdsdiA5IDhhNDNiYTUxMDcgNjI=] - somewhere far north of here, carried by a human.
a backpack - [YmdsdiA5IDhhNDNiYTUxMDcgOTY=] - somewhere far north of here, carried by a human.
a backpack - [VGZpbTAgOSBmMjkwZTNmMzE4IDE0] - somewhere very far west of here, carried by a trolloc.
a backpack - [VGZpbTAgOSBmMjkwZTNmMzE4IDky] - somewhere very far west of here, carried by a trolloc.
a backpack - [WWlzcyA5IDNkMzRiZDZiZTIgNTU=] - somewhere far north of here, carried by a trolloc.
a backpack - [VGZpbTAgOSBmMjkwZTNmMzE4IDMw] - somewhere very far west of here, carried by a trolloc.
a backpack - [VGZpbTAgOSBmMjkwZTNmMzE4IDM1] - somewhere very far west of here, carried by a trolloc.
a backpack - [WmxudSA5IDQ5MGE1ZGFiZGQgNzA=] - somewhere around here, carried by a human.
a backpack - [VGZpbTAgOSBmMjkwZTNmMzE4IDI2] - somewhere very far west of here, carried by a trolloc.
a backpack - [WmxsdyA5IDdjNDRjZWQ1YTkgMjA=] - somewhere around here.
a backpack - [WmxtdSA5IGE4MDJlNmZkNGYgNA==] - somewhere around here, carried by a human.
a backpack - [VGZpbTAgOSBmMjkwZTNmMzE4IDU3] - somewhere very far west of here, carried by a trolloc.
a backpack - [WmluMSA5IDE0NjhkYjAyMmMgMzg=] - somewhere far south of here, carried by a human.
a belt pack - [WmxtcyA5IGU1OWM5YTNmYjcgMTI=] - somewhere around here, carried by a human.
a belt pack - [WmxtcyA5IGU1OWM5YTNmYjcgMjM=] - somewhere around here, carried by a human.
a backpack - [WmxtcyA5IGU1OWM5YTNmYjcgMzM=] - somewhere around here, carried by a human.
a backpack - [WmxtcyA5IGU1OWM5YTNmYjcgNzY=] - somewhere around here, carried by a human.
a backpack - [WmlzdCA5IGNiMTE1NDEyMzAgNzA=] - somewhere far south of here, carried by a human.
a backpack - [WmlzdCA5IGNiMTE1NDEyMzAgNjg=] - somewhere far south of here, carried by a human.
what i would like to be able to do is type some command like dirnarr pack, which would locate pack,bring up the above info, then return it as one nice handy narrate, filtering out humans and nones, only reporting bad people (trollocs myradalas dreadlords etc, i can clairfy if someone can figure this out). what i should hope to narrate at the end would be narrate packs located 2fn 6vfw. The original script stopped working when the immortals of the game changed the locate code (the long gibberish string after each item you see) from all one case to one that was case sensitive and now had extra symbols.
old script as follows if it helps
zMUD 6.x script:
#CLASS {Report}
#ALIAS internalcomm {#say %-1}
#ALIAS remreport {#deli spreadout {%-1};#say %-1 removed from the Scout Report.}
#ALIAS addreport {#addi spreadout {%-1};#say %-1 added to the Scout Report.}
#ALIAS listreport {#say The script is currently reporting to:;#if (%numitems( @spreadout)=0) {#say No-one!} { #forall @spreadout {#say %i}}}
#ALIAS locaterep {#if (@reporting=1) {#var locstr %null;embrace;channel 'locate object' %-1;#wa 8000;#if (@locstr<>%null) {rel;#var loc1str %pick( 'p:Select who to report', %sort( @locstr));#var loc2str %null;#var loc4str %null;#forall @loc1str {#if (%i =~ "%a (*)") { #additem loc2str {%%%%1}}};#forall @loc2str {#var loc4str %concat( @loc4str, " ", %i, ":");#var loc3str %i;#forall @loc1str {#if (%i =~ "(%a) @loc3str") {#var loc4str %concat( @loc4str, " ", %%%%1, ",")}}};#if (%len( @loc4str)>5) {#forall @spreadout {%i Loc~:%leftback( @loc4str, 1)}}} {#echo No information received in time.};#var locstr %null} {#say Reporting is off. Aborting operation.}}
#VAR scoutstr {Names of things scouted}
#VAR narstr {Almost final scout output}
#VAR processing {0}
#VAR currentscouted {some room name}
#VAR previousscouted {some room name}
#VAR scoutedcount {1}
#VAR incrementor {1}
#VAR spreadout {internalcomm}
#VAR locstr {Name and zone stringlist}
#VAR nar2str {Essentially final output for scout report}
#VAR roomtemp {Temporary room variable}
#VAR pre {}
#VAR suff {}
#VAR zonetemp {Temporary zone variable}
#VAR loc1str {Intermediary step stringlist}
#VAR loc2str {Intermediary step stringlist}
#VAR loc3str {Intermediary step}
#VAR loc4str {Near final result}
#VAR scout2str {Name and Room stringlist}
#VAR scouttemp1 {Current name to parse}
#VAR reporting {0}
#TRIGGER {^(*)The master of scouts bellows '(%a) was spotted in (*)'} {#var prompttemp {%1};#IF ((@prompttemp =~ "^[o~*] * >$") or (@prompttemp=%null)) {#var roomtemp {%3};#if (@roomtemp=~ "^&{pre}The Dusty Road&{suff}$") {#var roomtemp %concat( @pre, Dusty, @suff)};#if (@roomtemp=~ "^&{pre}Borderlands&{suff}$") {#var roomtemp %concat( @pre, BLs, @suff)};#if (@roomtemp=~ "^&{pre}A Winding Road&{suff}$") {#var roomtemp %concat( @pre, Winding, @suff)};#if (@roomtemp=~ "^&{pre}Fal Dara&{suff}$") {#var roomtemp %concat( @pre, FD, @suff)};#if (@roomtemp=~ "^&{pre}FalDara&{suff}$") {#var roomtemp %concat( @pre, FD, @suff)};#if (@roomtemp=~ "^&{pre}Tarwins Gap&{suff}$") {#var roomtemp %concat( @pre, Gap, @suff)};#if (@roomtemp=~ "^&{pre}FDRoad&{suff}$") {#var roomtemp %concat( @pre, FD Road, @suff)};#var scout2str %additem( @scout2str, {%2 @roomtemp});#ADDI scoutstr %2}}
#TRIGGER {^(*)([A-Z]%a) tells you 'state'} {#var prompttemp {%1};#IF ((@prompttemp =~ "^[o~*] * >$") or (@prompttemp=%null)) {%concat( "tell ", %2, " Reporting state is currently (0 off, 1 on) ", %eval( -@processing+1))}}
#TRIGGER {^(*)The master of scouts bellows 'was spotted in (*)'} {#var prompttemp {%1};#IF ((@prompttemp =~ "^[o~*] * >$") or (@prompttemp=%null)) {#var scout2str %additem( @scout2str, {0 %2})}}
#TRIGGER {^(*)([A-Z]%a) tells you 'remove me'} {#var prompttemp {%1};#IF ((@prompttemp =~ "^[o~*] * >$") or (@prompttemp=%null)) {tell %2 You have been removed from the reports. (add me to add);remreport tell %2}}
#TRIGGER {^(*)([A-Z]%a) tells you 'add me'} {#var prompttemp {%1};#IF ((@prompttemp =~ "^[o~*] * >$") or (@prompttemp=%null)) {tell %2 You have been added to the reports. (remove me to remove);addreport tell %2}}
#TRIGGER {* - ~[%a~] - (*), Carried by (%a).} {#if (@reporting=1) {#var zonetemp {%1};#if (@zonetemp =~ "^&{pre}Borderland&{suff}$") {#var zonetemp %concat( @pre, BL, @suff)};#if (@zonetemp=~ "^&{pre}Parched Ground&{suff}$") {#var zonetemp %concat( @pre, Parched, @suff)};#if (@zonetemp =~ "^&{pre}Fal Dara&{suff}$") {#var zonetemp %concat( @pre, FD, @suff)};#if (@zonetemp =~ "^&{pre}Mountain&{suff}$") {#var zonetemp %concat( @pre, Mtn, @suff)};#if (@zonetemp =~ "^&{pre}Tarwin's Gap&{suff}$") {#var zonetemp %concat( @pre, Gap, @suff)};#if (@zonetemp =~ "^&{pre}Village of Lockshear&{suff}$") {#var zonetemp %concat( @pre, LS, @suff)};#if (@zonetemp =~ "^&{pre}Northern&{suff}$") {#var zonetemp %concat( @pre, N, @suff)};#if (@zonetemp =~ "^&{pre}North&{suff}$") {#var zonetemp %concat( @pre, N, @suff)};#if (@zonetemp =~ "^&{pre}West&{suff}$") {#var zonetemp %concat( @pre, W, @suff)};#additem locstr {%concat( %2, " ", @zonetemp)}}}
#TRIGGER {^(*)([A-Z]%a) tells you 'details'} {#var prompttemp {%1};#IF ((@prompttemp =~ "^[o~*] * >$") or (@prompttemp=%null)) {tell %2 %right( %leftback( @narstr, 1), 1)}} "" {case}
#TRIGGER {^(*)The master of scouts bellows 'Incoming message!!'} {#if (@reporting=1) {#var prompttemp {%1};#IF ((@prompttemp =~ "^[o~*] * >$") or (@prompttemp=%null)) { #if (@processing<>1) {#var processing 1;#var scoutstr %null;#var narstr %null;#var scout2str %null;#wa 5000;#if (%numitems( @scoutstr)<>0) {#forall @scoutstr {#var narstr %concat( @narstr, " ", %i, " seen");#var incrementor 0;#var scouttemp1 %i;#var previousscouted %null;#loop 0,%eval( %numitems( @scout2str)-1) { #if (%item( @scout2str, %numitems( @scout2str)-%i) =~ "^@scouttemp1 (*)$") {#var currentscouted {%%%%%%1};#add incrementor 1;#if (@incrementor=1) {#var previousscouted @currentscouted;#var scoutedcount 0};#if (@currentscouted=@previousscouted) {#add scoutedcount 1} {#var narstr %concat( @narstr, " ", @previousscouted);#if (@scoutedcount<>1) {#var narstr %concat( @narstr, " ~[", @scoutedcount, "~],")} {#var narstr %concat( @narstr, ",")};#var previousscouted @currentscouted;#var scoutedcount 1}}};#var narstr %concat( @narstr, " ", @previousscouted);#if (@scoutedcount<>1) {#var narstr %concat( @narstr, " ~[", @scoutedcount, "~],")} {#var narstr %concat( @narstr, ",")}};#if (%len( @narstr)<=200) {#var nar2str @narstr} {#var nar2str %null;#forall @scoutstr {#var nar2str %concat( @nar2str, %i, ", ")};#var nar2str %concat( " ", %leftback( @nar2str, 2), " scouted (details for report) ")};#if (%len( @narstr)>10) { #forall @spreadout { %i %right( %leftback( @nar2str, 1), 1)}}};#var processing 0}}}}
#BUTTON 1 {Report Off} {#var reporting 1;#var processing 0} {Report On} {#var reporting 0} {} {1} {} {} {} {} {} {} {} {} {} {} {} "" {} {} {}
#CLASS 0
Summary:
Scout script hears FD scout yelling and starts a 5 second window to listen for reports. After that, it sends it to the parsing alias (in 5.55, it is built in to the trigger in the 6.x ver). This is the part that changes it into a nice and efficient form. It has 3 levels of spam protection.
The first is changing the text of sightings into mutually understood acronyms and foreshortenings. For example, Fal Dara becomes FD, A Dusty Road goes to Dusty. The second was changing consecutive sightings of a trollie in the same place into [2], etc. I only did consecutive so that chronology of movement would be preserved. That is, if a trolloc went by a winding scout, then a dusty, then winding again, it wouldn't do Winding Road [2] so others can tell direction of travel. The third level of spam control makes sure no outputted string is over 200 characters in length. If it is, the script will revert to a list of names instead.
The locaterep script essentially uses the same type of engine (I copied and pasted and modified to meet my needs), but functions much differently. When executed, it locs whatever object you put in the argument and strips the PCs out of the loc into a list (some NPCs fool it like Cyril and Erol in TV which look like PCs on loc). It then allows you to choose which ones you want to report via pick list and then proceeds to report them by zone.
How to use and examples:
Common elements:
The report button:
It defaults in the off position, hit it when you load the script to start actually using the script.
addreport
Adds an outlet to report scout/locates to.
addreport tell Groofin
remreport
Removes something from receiving locs
remreport tell Groofin
listreport
Tells what you are reporting to.
internalcomm
The default method of communication. It merely echoes to your screen.
Scout specific:
None, all handled automagically once common setup is complete and button is on.
Locate specific:
locaterep
The way to report locates (if button is on and common elements are set up).
locaterep pack
That will embrace (all you mcs can change the script to seize, put an alias on the mud so embrace is seize, or burn in the pit of doom.... your choice), locate pack and wait 8 seconds for the timer to go and the text to come up. After that, the process is rather straightforward.
thanks for any and all help! |
|
|
 |
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Sat Aug 23, 2003 5:07 pm |
The original trigger is:
#TRIGGER {* - ~[%a~] - (*), Carried by (%a).} {#if (@reporting=1) {#var zonetemp {%1};#if (@zonetemp =~ "^&{pre}Borderland&{suff}$") {#var zonetemp %concat( @pre, BL, @suff)};#if (@zonetemp=~ "^&{pre}Parched Ground&{suff}$") {#var zonetemp %concat( @pre, Parched, @suff)};#if (@zonetemp =~ "^&{pre}Fal Dara&{suff}$") {#var zonetemp %concat( @pre, FD, @suff)};#if (@zonetemp =~ "^&{pre}Mountain&{suff}$") {#var zonetemp %concat( @pre, Mtn, @suff)};#if (@zonetemp =~ "^&{pre}Tarwin's Gap&{suff}$") {#var zonetemp %concat( @pre, Gap, @suff)};#if (@zonetemp =~ "^&{pre}Village of Lockshear&{suff}$") {#var zonetemp %concat( @pre, LS, @suff)};#if (@zonetemp =~ "^&{pre}Northern&{suff}$") {#var zonetemp %concat( @pre, N, @suff)};#if (@zonetemp =~ "^&{pre}North&{suff}$") {#var zonetemp %concat( @pre, N, @suff)};#if (@zonetemp =~ "^&{pre}West&{suff}$") {#var zonetemp %concat( @pre, W, @suff)};#additem locstr {%concat( %2, " ", @zonetemp)}}}
Just change the pattern to reflect the new possibilities. %a already matches both upper and lowercase letters, as well as digits, so all that's really needed is match the occasional symbol (= is the only one I see). I don't see any spaces anywhere, so probably %x.
#TRIGGER {* - ~[%x~] - (*), Carried by (%a).} {#if (@reporting=1) {#var zonetemp {%1};#if (@zonetemp =~ "^&{pre}Borderland&{suff}$") {#var zonetemp %concat( @pre, BL, @suff)};#if (@zonetemp=~ "^&{pre}Parched Ground&{suff}$") {#var zonetemp %concat( @pre, Parched, @suff)};#if (@zonetemp =~ "^&{pre}Fal Dara&{suff}$") {#var zonetemp %concat( @pre, FD, @suff)};#if (@zonetemp =~ "^&{pre}Mountain&{suff}$") {#var zonetemp %concat( @pre, Mtn, @suff)};#if (@zonetemp =~ "^&{pre}Tarwin's Gap&{suff}$") {#var zonetemp %concat( @pre, Gap, @suff)};#if (@zonetemp =~ "^&{pre}Village of Lockshear&{suff}$") {#var zonetemp %concat( @pre, LS, @suff)};#if (@zonetemp =~ "^&{pre}Northern&{suff}$") {#var zonetemp %concat( @pre, N, @suff)};#if (@zonetemp =~ "^&{pre}North&{suff}$") {#var zonetemp %concat( @pre, N, @suff)};#if (@zonetemp =~ "^&{pre}West&{suff}$") {#var zonetemp %concat( @pre, W, @suff)};#additem locstr {%concat( %2, " ", @zonetemp)}}}
ADDED: Based on your sample, the = shows up whenever the item is carried by a human or none, so if you use the old trigger the filtering is already done. |
|
|
 |
phillip Newbie
Joined: 16 Aug 2003 Posts: 6 Location: Ireland
|
Posted: Sun Aug 24, 2003 10:24 am |
thanks, now im getting a message sayin no information received at this time
|
|
|
 |
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Sun Aug 24, 2003 4:59 pm |
That's because you're trying to match multi-word patterns (a human, an orc, a trolloc) with a single-word wildcard (%a). Change it to (*).
#TRIGGER {* - ~[%x~] - (*), Carried by (%a).}
#TRIGGER {* - ~[%x~] - (*), Carried by (*).}
This gets you to a pick list, but I don't see anything happening after that.
It would probably be simpler to redo the entire script than to keep fixing it one piece at a time. I might have a look at it later, if Charbal doesn't speak up. |
|
|
 |
Bruner Beginner
Joined: 17 Dec 2002 Posts: 18 Location: USA
|
Posted: Mon Oct 13, 2003 11:00 pm |
*BUMP*
I would really like to see both of the scritps he mentioned in a finished product. The one where he locates a bunch of stuff, then publicly annouces it and the one where he reports when a scoutish guy list a bunch of enemies it sees.
Thanks
Bruner |
|
|
 |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|