Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
bair
Beginner


Joined: 31 Oct 2006
Posts: 22

PostPosted: Sun Jun 03, 2007 7:36 pm   

assigning multiple lines to an array
 
I have 2 quest cards, which each can have a total of 4 items on them, which i would like to capture to 2 different arrays (separated by card) so I can put them into a window.

[558199 exp] <11105hp 11105m 11105mv> <69bl> complete card
complete 2.card
[558199 exp] <11105hp 11105m 11105mv> <69bl> You still need to find the following:
Typhoeus' fallen dragon scales.
A metal helmet.
The Phantom Blade.
A gnoll slaver walks in from the east.
[558199 exp] <11105hp 11105m 11105mv> <69bl> You still need to find the following:
A brass handled, iron bladed shamshir.

^^Example of mud text. So pretty much when i type complete card, complete 2.card, I'd like it to assign the 3/4 items from the first card to @qcard1 and the 1/4 items from the second card to @qcard2. Any advice/code is appreciated.
Reply with quote
bair
Beginner


Joined: 31 Oct 2006
Posts: 22

PostPosted: Sat Jun 09, 2007 6:52 pm   
 
bump
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Sat Jun 09, 2007 10:22 pm   
 
Ok, when you are using Zmud/Cmud what most people think of as an array is what you do with a string list.
There are arrays yes. But they are not the best solution in this case. You want a database variable or a string list.

So you could do this.

Code:
Alias name: cardCap

Alias value:
#if (%1="1") {cardL=card1;complete card}
#if (%1="2") {cardL=card2;complete 2.card}

Trigger Pattern:
You still need to find the following:

Trigger Value:
#T+ CardCapt

#trigger Pattern:
(*)

Trigger ID:
CardCapt

Trigger Value:
#if (%match(%1,"^?%d exp? <%dhp %dm %dmv> <%dbl>")>0 and (!%null(@cardL)))
  {
   #if (@cardcaptV>=1) {
   #T- CardCapt
   cardcaptV=0
   cardL=%null} {#add cardcaptV 1}
  }
  {
   #additem @{cardL} %1
  }


Now this only does one card at a time. You would first type Cardcap 1, wait a moment then type cardcap 2.

This is a start. If you look around there are a few posts about using the status window with string lists around here.
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Sat Jun 09, 2007 10:26 pm   
 
BTW this set up also captures the "A gnoll slaver walks in from the east." as one of your items. There are several tricks you could use to get rid of that line. I just posted a quick example as no-one had responded in so long.
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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