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
braumen
Beginner


Joined: 28 May 2002
Posts: 17
Location: USA

PostPosted: Wed May 29, 2002 2:32 am   

2 ?s concerning variables
 
1: how can i remove something from a variable IE: the word TEST is in the variable TESTING.... how can i remove the word from the variable

2: How can i replace words in a variable with a new word IE: the word TEST is inthe variable TESTING. How can i replace TEST with NOTEST?
Thanks!
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Wed May 29, 2002 2:41 am   
 
1. For a normal variable, just set it to a nullstring.
testing = %null
testing := ""
#VAR testing {}

2. Just reassign the value
#VAR TESTING NOTEST

LightBulb
Vague questions get vague answers
Reply with quote
braumen
Beginner


Joined: 28 May 2002
Posts: 17
Location: USA

PostPosted: Wed May 29, 2002 2:44 am   
 
ok i got that.... now how do i keep the rest of the things i have in the variable:
example: variable TESTING has text TEST and NOW i want to get rid of TEST but keep NOW

asme for replacing: i want to replace TEST with NOTEST and keep NOW in the variable....
Reply with quote
dacheeba
Adept


Joined: 29 Oct 2001
Posts: 250

PostPosted: Wed May 29, 2002 3:42 am   
 
Is it a regular variable with the text TEST and NOW in it, or a stringlist variable? IE:

testing = TEST and NOW ?

If this is the case, the best thing to do isset the variable to just NOW like this:
1.testing = NOW
2.#VAR testing {NOW}

If its a stringlist, IE:
testing = TEST|NOW

There are a number of ways to do it, but the easist would be:
1.#DELI testing TEST
2.#DELNITEM testing 1
The second one will remove the first value of the stringlist, you could change it to 2 and it would delete NOW.

There also a huge number of functions that do the same things, allowing for better composed scripting. You really should check the help files and learn the scripting language a bit.
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