Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
thegto
Beginner


Joined: 12 Jun 2007
Posts: 20

PostPosted: Wed Jul 11, 2007 8:41 pm   

ask about record alias
 
how can I convert record alias from n;n;n;n;n;n;n;n;e;e;e;e;e;e;e;e; -->8n8e
or I have to change by myself ? Embarassed
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Wed Jul 11, 2007 9:28 pm   
 
The best you will be able to get is the %pathcompress() function, but it takes a stringlist as an argument. You'd have to change the ; to |, which, if you don't want to do by hand can be done via the %replace() function
_________________
EDIT: I didn't like my old signature
Reply with quote
thegto
Beginner


Joined: 12 Jun 2007
Posts: 20

PostPosted: Thu Jul 12, 2007 2:15 am   
 
Thank you,MattLofton for your advise
I try to do something like this script
Code:

#trigger {^~((*)~)$} {#var StoreAl {%1} }
#alias convert {#show %pathcompress(%replace(@StoreAl,~;,~|));#var StoreAl {}}


If I'd like to recored like this alias

e;e;e;e;e;enter portal

I have to type something like

#say (e;e;e;e;e;enter portal)

then it will be kept in variable "StoreAl"
after that I type "convert"
but the result I got is

.5e;.(enter portal)

can't is be like this --> 5e;enter portal ?

Smile
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Thu Jul 12, 2007 4:30 am   
 
The issue is that %pathcompress() uses zscript directions as created by #direction, which are one-letter macros specially designed to work with the automapper. "enter portal" thus becomes an undefined direction and is subsequently ignored for processing (special code splits the defined directions away from the undefined ones, which is why the period appears).

There are two ways to fix this. One, you could set up a new #direction that equates to "enter portal". It'd look something like this (o = other direction):

#direction pp "enter portal" other

That will make %pathcompress() happy, but the basic version of this direction might cause other problems (particularly with the automapper). You CAN use zscript code for the command in quotes, but it's been several years, lots of experience, and several zmud versions since I last attempted that and at the time I don't think I was able to get it fully working so I gave up.

The other way is to simply use a loop of some kind to iterate through each direction in the list and apply your own logic. The below can replace the trigger you created (you'll have to fill in the bolded parts):

#trigger {the pattern you had} {
olddir = ""
dircount = 1
NewPathVariable = ""
#forall %replace("%1",";","|") {#if (%ismember(%i,"n|ne|nw|e|w|se|sw|s|u|d")) {#if (%i = @olddir) {#add dircount 1} {NewPathVariable = %concat(@NewPathVariable,%if(@dircount > 1,@dircount)@olddir);olddir = %i;dircount = 1}} {NewPathVariable = %concat(@NewPathVariable,";",%i)}}
}
_________________
EDIT: I didn't like my old signature
Reply with quote
thegto
Beginner


Joined: 12 Jun 2007
Posts: 20

PostPosted: Thu Jul 12, 2007 7:14 pm   
 
Thank you I will try again
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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

© 2009 Zugg Software. Hosted by Wolfpaw.net