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


Joined: 19 Apr 2001
Posts: 10

PostPosted: Mon Jul 29, 2002 2:28 am   

An interesting problem I've been having
 
I'm having an interesting little problem with string lists. We have a spell on the mud I play at called 'analyze' which lays out the RIS of a target. I made a trigger to trap that into a string variable...using %replace to turn the spaces into |'s. This made it appear as a string list. But so far I have had utterly no luck adding or deleting anything from lists made this way. Any ideas?

oxxx[== X_calibur ==-
Reply with quote
X_calibur
Beginner


Joined: 19 Apr 2001
Posts: 10

PostPosted: Mon Jul 29, 2002 2:30 am   
 
Ugh...correction...it doesn't want to do add/delete to lists with my attacks.

ie: #var attacklist {c 'acid breath'|c fireball|c flamestrike}
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Mon Jul 29, 2002 3:16 am   
 
quote:

Ugh...correction...it doesn't want to do add/delete to lists with my attacks.

ie: #var attacklist {c 'acid breath'|c fireball|c flamestrike}



What's the trigger or whatever that does the adding/deleting (I'd ask for just the lines that attempt the add and remove, but that might be too incomplete)? I can do this all day long with no problems, so I'm wondering if you have some sort of syntax or other error (such as a case-not-matched error) happening with #ADDITEM or #DELITEM.

This is how it'd look for both commands using the variable quoted above:

#ADDITEM attacklist stuff
#DELITEM attacklist @variable-containing-stuff

you'll note that the stringlist variable does not require the @ character for variables in the above two functions. You can, however, specify a variable in place of stuff and for that you would use the @ character.

li'l shmoe of Dragon's Gate MUD
Reply with quote
X_calibur
Beginner


Joined: 19 Apr 2001
Posts: 10

PostPosted: Mon Jul 29, 2002 3:46 am   
 
Ah, but the problem with mine is that I'm not using text strings to wipe, I'm trying to wipe out record numbers. Because underneath I'm doing a type comparison matched with spells and the like to limit my attacks based on mobs.

Here's the stuff:
=================
view alias:
-----------
#math viewID %1*6
#echo :
#echo : Data record ~#: %1
#echo :-----------------------------.
#echo : Name: %read( 6, @viewID)
#echo : Immunes: %read( 6, @viewID-1)
#echo : Resists: %read( 6, @viewID-2)
#echo : Suscept: %read( 6, @viewID-3)
#echo :-----------------------------'
#var analyze %read( 6, @viewID-1)
#var analyzea %read( 6, @viewID-2)
#var analyzeb %read( 6, @viewID-3)
--------------
Prepare alias:
--------------
#var inita %numwords( @analyze, "|")
#var initb %numwords( @attacktype, "|")
#var attacklist @attack
#while (@inita <> 0) {
#while (@initb <> 0) {
#IF (%item( @analyze, @inita) = %item( @attacktype, @initb)) {#DELITEM attacklist %item( @attacktype, @inintb)}
#math initb @initb-1
}
#math inita @inita-1
}
---------------
Pickup trigger:
---------------
pattern: Immune: (*)
action: #write 6 {%replace( %1, " ", "|")} @record-1
---------------
Variable contents:
---------------
attacktype: acid|energy|none|acid|none|poison|summon|paralysis
attack: c 'acid rain'|c lunar|c spiral|c toxic|c whirlwind|summon asp|summon gnome|c freeze
analyze: fire|cold|electricity|acid|poison|drain
viewID, inita, initb are just number storing variables.

There's the chunk. =P
Reply with quote
X_calibur
Beginner


Joined: 19 Apr 2001
Posts: 10

PostPosted: Mon Jul 29, 2002 3:47 am   
 
I can also read and #show out indivitual elements, so I know the database file and lists seem to partially work at least. o.o
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon Jul 29, 2002 5:09 pm   
 
It's probably spaces in the item you are trying to add or delete. Most commands, including #VAR, #DELITEM, and #ADDITEM, interpret spaces as the end of a parameter unless they are enclosed in other delimiters.
#var attacklist @attack should be
#var attacklist {@attack}

#IF (%item( @analyze, @inita) = %item( @attacktype, @initb)) {#DELITEM attacklist %item( @attacktype, @inintb)}
should be
#IF (%item( @analyze, @inita) = %item( @attacktype, @initb)) {#DELITEM attacklist {%item( @attacktype, @initb)}}

There may be other statements needing similar corrections.

LightBulb
Senior Member
Reply with quote
X_calibur
Beginner


Joined: 19 Apr 2001
Posts: 10

PostPosted: Tue Jul 30, 2002 5:45 am   
 
Hmm, I think I'll try a different route than string lists. I've had some luck using arrays, and considering I haven't done much, it should be easy to adapt. For some reason it's still being fussy about it. Thanks for your time though, I know your advice is gonna come in handy for me down the road. =D

oxxx[== X_calibur ==-
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