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


Joined: 25 Feb 2008
Posts: 13

PostPosted: Tue Feb 26, 2008 10:49 am   

Dabase - creating triggers for monsters.
 
Dabase - creating triggers for monsters.

Hi

Here is a typical room :

Une vaste salle de reception se trouve la. Son sol est de bonne facture, bien que
poussiereux. Des meubles uses et abimes sont eparpilles dans tous les coins. Malgre
les murs epais, un peu de lumiere parvient a entrer. Il y a eu une bataille ici, comme
en temoignent les squelettes en morceaux et les armes brisees. La salle se poursuit
a l'est.
> Sorties: est ouest
* un squelette est la.
* un squelette est la.
* un squelette est la.
* un squelette est la.
- une piece d'or (x400) est posee la.
- un cimeterre rouille (x41) est pose la.
- un bouclier d'os (x41) est pose la.

Ok So i would like to put monsters in database.

Here is a pseudo-script

Code:
Each time i enter a room
If there are monsters (marqued with *) :
   For each monster
      - remove the last words ("est la")
      [So it keeps "squelette" in the above example]

      - then scan the database
         - if the monster does not exist
            - create a record with the name of the monster and
            - put the room number in the room field
         - if the monster does exist
            - scan the record
            - if the room number is the same as the room we are in do nothing. It is already in database
            - else add the room number we are in into the room number (so for example a skeleton in rooms 16, 22 and 26)


So Above is something right i think
But i absolutely don't know how to tell that to zmud.

Could you help me ? Help really appreciated,
Thanks,
sudin
Reply with quote
Progonoi
Magician


Joined: 28 Jan 2007
Posts: 430

PostPosted: Tue Feb 26, 2008 9:38 pm   
 
You mean ZMud Database, not Database variable, right? In which case I wouldn't be much help because I haven't really done any extensive database scripting (yet), but I suppose few general things might come handy for you, too.

You can manipulate the trigger pattern to the point where it'd exclude words/phrases you don't want to capture.

Code:


#regex {^(?:un|une|)*(.*).*(?:est la|est posse la)$} {do stuff to add %1 to database}



The regex above excludes un or une if its at the start, even if none of those are at the start of string it still captures only the phrase coming after. And it also excludes certain strings coming after the phrase you need.

Other than that, unless you're actually meaning database variable instead, I'm outta help ;)


Prog
_________________
The Proud new owner of CMud.

--------------------------------
Intel Core i5-650 3,2GHz
4 DD3 RAM
GTX 460 768MB
Win 7 Home Premium 64x
--------------------------------
Reply with quote
sudin
Beginner


Joined: 25 Feb 2008
Posts: 13

PostPosted: Wed Feb 27, 2008 7:47 am   
 
Thanks for your answer Progonoi. It will be helpful i think.

Well Zmud Database or Database variable. I really don't know the difference.
For me, it's the same (maybe it's a shame but...)

What i want to do is :
- store the information into a readable format without doing it manually...

So maybe i mean "database variable". You know i would like to create the structure of the database (by hand not by script) and i want to populate it automatically:) (the "search" part for avoiding duplicates is more or less important)

So thanks for the regex (i will use it for sure :)
I will try to start with that :)

If someone (or you Progonoi) has some other advices, don't hesitate - post them :) Thanks a lot, sudin
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