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
user0101
Apprentice


Joined: 01 Aug 2003
Posts: 100
Location: USA

PostPosted: Fri Aug 01, 2003 10:41 am   

Transfering String Lists
 
I want to transfer a string from one variable to another. Lets say variable "test1" has strings "string1" and "string2" in it. I want to transfer string1 and string2 into a completely new variable. Also, I want the transferred strings to be deleted from the original variable also.

Any ideas on how to do it?
Reply with quote
user0101
Apprentice


Joined: 01 Aug 2003
Posts: 100
Location: USA

PostPosted: Fri Aug 01, 2003 12:59 pm   
 
Just to expand on that, I'm looking for a command that will retrieve the data stored in, let's say for example, Variable1 then transfer it to Variable2 in the manner I want - the first string, the entire string, the nth string, etc.
Reply with quote
teknocide
Beginner


Joined: 15 Jul 2003
Posts: 25
Location: Sweden

PostPosted: Fri Aug 01, 2003 2:06 pm   
 
#ALIAS transfer {#IF (!%null( %2)) {#IF (!%isnumber( %3)) {#VARIABLE %1 {@%2};#VARIABLE %2 {}} {#VARIABLE %1 {%item( @%2, %3)};#DELNITEM %2 (%3)}}}

will let you type transfer var1 var2 to take everything in var2 and move it to var1, or transfer var1 var2 4 to take the 4:th item of var2, and replace everything in var1 with it, while finally removing the 4:th item of stringlist var2
Reply with quote
user0101
Apprentice


Joined: 01 Aug 2003
Posts: 100
Location: USA

PostPosted: Sat Aug 02, 2003 2:32 am   
 
Thanks Teknocide, but I need something that transfers strings onto a working string list. For example, Var2 has a list of all afflictions currently on my enemy, and Var1 has a list of afflictions I will be giving him. Every time I attack, it will give him 2 more afflictions, which I want added onto the *current* list he has. I need to transfer the first 2 strings on Var1, onto Var2, then have the transferred strings from Var1 be deleted. Every time I attack, I #echo what is contained inside Variable 2 (var2 is a real-time list of everything i've afflicted my opponent with).

Any way to transfer 2 strings into a variable without erasing everything in that target var?
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sat Aug 02, 2003 3:10 am   
 
Use #ADDItem if you don't want the variable to have duplicate items.
Use %additem if you do want the variable to have duplicate items.

#AL ListXfer1 {#ADDI test2 {%item( @test1, 1)};#ADDI test2 {%item( @test1, 2)};#DELN test1 1;#DELN test1 1}

#AL ListXfer2 {#VAR test2 {%additem( %item( @test1, 1), @test2)};#VAR test2 {%additem( %item( @test1, 2), @test2)};#DELN test1 1;#DELN test1 1}
Reply with quote
user0101
Apprentice


Joined: 01 Aug 2003
Posts: 100
Location: USA

PostPosted: Sat Aug 02, 2003 4:36 am   
 
It works like a charm. Thanks!
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