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


Joined: 11 Sep 2005
Posts: 124

PostPosted: Thu Dec 15, 2005 12:15 am   

A couple of Database questions
 
How do I go about:
1.Determining wether or not a database is FULLY loaded
2.Determining whether or not any %query's are in progress

Tried running a while loop on the contents of a known result to query, but the database doesnt seem to load while a query is in progress.
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Thu Dec 15, 2005 6:57 pm   
 
I don't think it's possible to do it directly you can kludge it though? For example, if you issue a #DBSAVE after every #DBLOAD , or do
Code:
 #LOOPVIEW { #NOOP }
after each one. It's a real kludge but that's the best I can think of.

As for %query I don't think there's much you can do there but wait for it to return it's values. (Usually not an issues unless they're running in parallel.)

What exactly are you trying to do? Maybe we could help with that.
_________________
Asati di tempari!
Reply with quote
Iceclaw
Apprentice


Joined: 11 Sep 2005
Posts: 124

PostPosted: Thu Dec 15, 2005 7:21 pm   
 
yeah, Its a speed issue up to 10*3 parallel requests, tried to cut it down abit by storing the record# from the 1st query for each item, but I still have problems with those running in parallel.

The inital wait in the trigger was necessary to get it not to set all the Target varables to the same (wrong) passage from @canuse_servant, all %db/%query calls work correct if executed as the only call.

Current Code:
alias: passage_use
#var canuse_servant ""
#forall @index_%1 {#if %db( @%-1, {%i})<=@servant_level {#additem canuse_servant {%i}} {#NOOP}}

Trigger:
(%d)~)(%s)~[(*)~](%s)~[(*)~](%s)~[(*)~]
Value:
#WAIT 1500
passage_use %5
#var Target_Trim_%1_Short_Desc {%trim( %3)}
#var Target_Trim_%1_Target_Area {%trim( %7)}
#addkey Target_%1 Record -1
#var queryinprog 0
#while %db( @Target_%1, Record)=-1 {
#if @queryinprog=1 {#NOOP} {
#addkey Target_%1 Record %if( %query( ((&Short_Desc=@Target_Trim_%1_Short_Desc)&(&Area_Name=@Target_Trim_%1_Target_Area)), Mobiles_AotC)="", -1, %query( ((&Short_Desc=@Target_Trim_%1_Short_Desc)&(&Area_Name=@Target_Trim_%1_Target_Area)), Mobiles_AotC))
#var queryinprog 1
}
}
#var queryinprog 0
#addkey Target_%1 Passage_Use {%item( @canuse_servant, %numitems( @canuse_servant))}
#addkey Target_%1 Number {%1}
#addkey Target_%1 Short_Desc {%3}
#addkey Target_%1 Passage_Group {%5}
#addkey Target_%1 Target_Area {%7}
#addkey Target_%1 Long_Desc {%db( %db( @Target_%1, Record),Long_Desc)}
#addkey Target_%1 Name {%db( %db( @Target_%1, Record), Name)}
#additem currentlongdescs_descs {%db( @Target_%1, Long_Desc)}
#addkey serv_namesbydesc {%db( @Target_%1, Long_Desc)} {%db( @Target_%1, Name)}
#if %ismember( %5, @passage_group_have)>0 {#additem can_do_target_list {%1}} {#noop}



Parsing this

____________________________________________________________________________

Servant Duty List
----------------------------------------------------------------------------
Name Group Area

1) [A cackling witch ] [Courage ] [Cargan Ruins ]
2) [a centipede ] [Compassion ] [Moria ]
3) [a flying squirrel ] [Compassion ] [Gerighelm ]
4) [hobgoblin flunky ] [Compassion ] [Crystalmir Lake ]
5) [a wood elf ranger ] [Confession ] [Myre Forests ]
6) [A githyanki guardian ] [Compassion ] [Astral Plane ]
7) [the fanatic cultist ] [Compassion ] [Divided Souls ]
8) [the zombie gnome ] [Blessings ] [Gnome Village ]
9) [sleeping barbarian ] [Exhortation ] [Arctic Wasteland ]
10) [a chanting troll ] [Death ] [Troll Den ]
____________________________________________________________________________
Reply with quote
Iceclaw
Apprentice


Joined: 11 Sep 2005
Posts: 124

PostPosted: Thu Dec 15, 2005 7:23 pm   
 
Example of a Target Varable that It should be able to Generate <NOT FOR THE example data I gave you that its trying to parse, from an earlier one I did by hand, for reference>

#showdb @Target_1

Number: 1
Name: dolphin
Passage_Use: 1 Corinthians 6:19
Short_Desc: a dolphin
Passage_Group: Devotion
Target_Area: Candyland
Long_Desc: A dolphin is here swimming around in this clear blue water.
Record: 2484mo
Reply with quote
Iceclaw
Apprentice


Joined: 11 Sep 2005
Posts: 124

PostPosted: Thu Dec 15, 2005 7:25 pm   
 
initially I had a trigger off of Servant Duty List to #DBCLOSE;#DBOPEN mo, and then #alarm +100 #DBCLOSE
Running 3 seperate Databases on this Character, so I need to ensure the right one is open before parsing.
Reply with quote
chris-74269
Magician


Joined: 23 Nov 2004
Posts: 364

PostPosted: Thu Dec 15, 2005 11:25 pm   
 
anyway to check if database is already open? like #if (%database...) {#NOOP} {#DBOPEN name}
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