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
SpiritWolf
Wanderer


Joined: 02 Jul 2002
Posts: 74
Location: USA

PostPosted: Tue Jul 02, 2002 12:32 am   

Database stuff
 
This is probably pretty simple, but I'm not into doing much scripting yet.
Anyway, this is what I need to do.. I need to grab things from diffrent lines and put them into one field in the database.

example:
Weight: 1, Value: 30000
Level 50 spells of:
protection from fire
protection from cold
protection from acid
Can affect you as :
Affects : SV_BREATH By -2

I need to grab the text in the "Level 50", "protection from fire", "protection from cold", and "protection from acid" spots. There isn't always three spells there though. There can be one through three.
The other things have other triggers to pick them up already, so not worried about them.
Any suggestions?
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5187

PostPosted: Tue Jul 02, 2002 2:40 am   
 
The case of the first letter letter seems to be useful in this instance. Also with a little more testing you may find a specfic order that these things are displayed. In any case both should be covered. There are many example of multi-line capture so I will say look up %proper, %word, and #IF. Also run a search on the forums for anything you can think of related to your sitution, such as id and affects, as well as multiline and capturing.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Tue Jul 02, 2002 7:04 pm   
 
#TR {Level %d spells of:} {#VAR dbspells %null;#T+ dbspells} {} {notrig}
#CLASS dbspells {disable}
#TR {(*)} {#IF ("%1" = "Can affect you as:") {#ADDKEY db affects {@dbspells};@#T- dbspells} {#IF (@dbspells) {#VAR dbspells {@dbspells, %1}} {#VAR dbspells {%1}}}
#CLASS 0


LightBulb
Senior Member
Reply with quote
SpiritWolf
Wanderer


Joined: 02 Jul 2002
Posts: 74
Location: USA

PostPosted: Tue Jul 02, 2002 8:27 pm   
 
Hmm.. guess I should have added that the weight and value are always there. The "Can affect you as :" is not always there. The spell listings are sometimes the last thing, and like in this case, they arn't.
There is a blank space when the spells are the last entry though, so I suppose that can be used to turn off a trigger.
Basicly what I'm looking for is to grab these things and stick it into a text field in the database in the form of "Level (whatever) spells of (spell1), (spell2), (spell3)." if there are three spells. would be spell1 and spell2 if there were only 2, and so on. I can prolly do most of that when I pull the info out of the database though.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Jul 05, 2002 7:40 am   
 
You only want to do this when the "Level..." line is there, so you can use that as your trigger phrase to start the script. You (not me) will have to find some way of identifying the end of the spells so that you can tell zMUD they are done. You might even need to use more than one trigger to cover all the possible lines that might come next.
HINT: You can use the last trigger for different possibilities by changing the comparison portion of the #IF.

LightBulb
Senior Member
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