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


Joined: 10 Oct 2002
Posts: 11
Location: Poland

PostPosted: Thu Apr 15, 2004 7:27 am   

why it doesn't work
 
#FO "one |two |three |four |five " {tempvar=%replace( "one cat and four dogs", %i, %item("1 |2 |3 |4 |5 ", %ismember( %i, "one |two |three |four |five ")))};#sh @tempvar

I'd like to see "1 cat and 4 dogs" but I still see "one cat and four dogs"

Can anybody help me?
Reply with quote
jessew
Apprentice


Joined: 03 Mar 2003
Posts: 141

PostPosted: Thu Apr 15, 2004 7:36 am   
 
Because your setting tempvar back to %replace("one cat and four dogs"...) every iteration, its never "really" getting changed the way you want it to , till the fifth/final iteration when it checks for "five" and theres no five in your phrase so it stays the same.


#va tempvar = "one cat and four dogs";#FO "one|two|three|four|five " {tempvar=%replace( @tempvar, %i, %item("1|2|3|4|5", %ismember( %i, "one|two|three|four|five ")))};#sh @tempvar



Plus you can clean that up alot to make it easier one thing that stands out that you made a seperate list for the actual digits , but you could just use the return of %ismember(%i,"one|two|three") because one will return 1, two returns 2 etc,


Cheers Jesse
Reply with quote
ulmus
Beginner


Joined: 10 Oct 2002
Posts: 11
Location: Poland

PostPosted: Thu Apr 15, 2004 7:55 am   
 
I did this:
#va tempvar "one cat and four dogs";#va tempnumbers "1|2|3|4|5"; #FO "one|two|three|four|five " {tempvar=%replace( @tempvar, %i, %item(@tempnumbers;%ismember( %i, "one|two|three|four|five ")))};#sh @tempvar
And I still see "one cat and four dogs"
Reply with quote
jessew
Apprentice


Joined: 03 Mar 2003
Posts: 141

PostPosted: Thu Apr 15, 2004 8:08 am   
 
quote:
Originally posted by ulmus

I did this:
#va tempvar "one cat and four dogs";#va tempnumbers "1|2|3|4|5"; #FO "one|two|three|four|five " {tempvar=%replace( @tempvar, %i, %item(@tempnumbers;%ismember( %i, "one|two|three|four|five ")))};#sh @tempvar
And I still see "one cat and four dogs"


You have ; where you should have a comma but lets clean this up :)


#var numlist "one|two|three|four|five";#VAR tempvar "one cat and four dogs";#FORALL @numlist {tempvar = %replace(@tempvar,%i,%ismember(%i,@numlist))};#show @tempvar


Jesse
Reply with quote
ulmus
Beginner


Joined: 10 Oct 2002
Posts: 11
Location: Poland

PostPosted: Thu Apr 15, 2004 8:16 am   
 
I'm going mad.
I STILL SEE "one cat and four dogs"
I didn't make any changes in this order..... wrrrrrrrrrrrrr
Reply with quote
ulmus
Beginner


Joined: 10 Oct 2002
Posts: 11
Location: Poland

PostPosted: Thu Apr 15, 2004 9:10 am   
 
I got something else:
VAR tempvar "one cat and four dogs";#fo "one|two|three|four" {tempvar=%i;#show @tempvar}
It always shows "one cat and four dogs"!
But if I make this in the end: #sh @tempvar - i see four.

Hmmmmmmm
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Thu Apr 15, 2004 2:37 pm   
 
quote:
#var numlist "one|two|three|four|five";#VAR tempvar "one cat and four dogs";#FORALL @numlist {tempvar = %replace(@tempvar,%i,%ismember(%i,@numlist))};#show @tempvar

I tested this one and it seems to do just what you wanted it to do *outputs 1 cat 4 dogs*
quote:
VAR tempvar "one cat and four dogs";#fo "one|two|three|four" {tempvar=%i;#show @tempvar}

I tested this and it outputs
one
two
three
four
as it should

Is it possible your special chars got changed view-prefs-special chars
Issue this before you run the script to set them to default
#DEF
and to go back to what you had
#NODEF
Reply with quote
ulmus
Beginner


Joined: 10 Oct 2002
Posts: 11
Location: Poland

PostPosted: Thu Apr 15, 2004 2:56 pm   
 
quote:
Originally posted by nexela


Is it possible your special chars got changed view-prefs-special chars
Issue this before you run the script to set them to default
#DEF
and to go back to what you had
#NODEF




Hmm, it does'n work.
I have the same output.
Reply with quote
ulmus
Beginner


Joined: 10 Oct 2002
Posts: 11
Location: Poland

PostPosted: Thu Apr 15, 2004 3:09 pm   
 
But i tested this on clear setting and than it works!
So I have something corrupt, hyh, but what?
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Fri Apr 16, 2004 1:11 am   
 
Remane your .mud file for you char and repoen zmud then import from your old .mud should clear up corrupted settings

http://www.zuggsoft.com/zmud/migrating.htm
has step by step instructions
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