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
mrtpyo
Newbie


Joined: 14 Dec 2005
Posts: 2

PostPosted: Sat Dec 17, 2005 8:20 am   

Newbie Variable Question
 
Greetings,

Let @name1 variable be a string or word like "large dog."

Is there a way to tell ZMud to only return X number of characters of the variable?

For example, instead of kill @name1 returning "kill 'large dog'", I want it to return "kill 'larg'" (first 4 characters) of the variable.

Thanks
Reply with quote
darkspot
Apprentice


Joined: 29 Jul 2002
Posts: 105

PostPosted: Sat Dec 17, 2005 11:02 am   
 
From the help file

left

Syntax: %left(s,n)

return the leftmost n characters of the string s
Examples:
#SHOW %left(0815,2)
displays: 08

#SHOW %left("abc~~def",4)

displays

abc~

memory aid:
%left(anystring,@anynumber) plus %right(anystring,@anynumber) is 'anystring'

----------------------------
Therefore
kill %left(@name1, 4)
would be what you want
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