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
rwfrk
Wanderer


Joined: 26 Feb 2002
Posts: 81
Location: USA

PostPosted: Sun Oct 27, 2002 4:25 pm   

Help with substitue
 
I'd like to be able to automattically convert returned text such as sssseeees into 4s4es automatically ;)...thanks in advance
Zmud 616
W95
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun Oct 27, 2002 7:09 pm   
 
#VAR DirCount 0
#VAR LastDirection {}
#VAR WalkString {}
#VAR TempWalkString {}
#ALIAS ConvertWalk {DirCount=1;LastDirection="";TempWalkString="";#LOOP %len(@WalkString) {#IF (%copy(@WalkString,%i,1)=@LastDirection) {#ADD DirCount 1} {TempWalkString=%concat(@TempWalkString,%if(@DirCount>1,@DirCount),@LastDirection);DirCount=1;LastDirection=%copy(@WalkString,%i,1)}};WalkString=@TempWalkString}

To use just put what you want to convert into WalkString then call the alias.
Reply with quote
rwfrk
Wanderer


Joined: 26 Feb 2002
Posts: 81
Location: USA

PostPosted: Sun Oct 27, 2002 8:42 pm   
 
Um...you can probbly guess this is for that guide bot you wrote ;)....any easy ways of doing this keeping that in mind..
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Mon Oct 28, 2002 1:16 am   
 
Guessed as much that is why I formatted it like I did, test it out with a few sample strings then if all is well in the !buy trigger make the following changes.

Before this line:
Teller=%concat(%1," Your path to ",%word(@Teller,1,"=")," is ",%word(@Teller,2,"=")," ",%item(@{@CompareTarget},1)," credits deducted.")
Add these 2 lines:
WalkString=%word(@Teller,2,"=")
ConvertWalk

Next change the teller= line above to:
Teller=%concat(%1," Your path to ",%word(@Teller,1,"=")," is ",@WalkString," ",%item(@{@CompareTarget},1)," credits deducted.")
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