|
hpoonis2010 Adept
Joined: 18 Jun 2019 Posts: 279
|
Posted: Thu Aug 15, 2019 9:48 am
Attempts to use a database - even silently! |
Dear community (and this usually means shalimar),
I am trying to populate an equipment database.
DB will be loaded manually so I am not fussed about performing opens and closes.
I have an alias 'shid' for shop identify. In the case of aardwolf identify in shops is 'appraise'.
#ALIAS shid {#T+ identify;#VAR Item;app %1}
#TR {Keywords : } {&Item.keywords} identify
#TR {Name : } {%Item.name} identify
#TR {Id : } {&Item.id} identify
...
etc
...
#TR {^[} {#IF (#FIND &Item.id &Item.type equip id) {#IF (!%null(@NewItem)) {#NEW @Item.type @Item}} {#NOOP} identify;#T- identify |
|
Last edited by hpoonis2010 on Thu Aug 22, 2019 10:35 am; edited 1 time in total |
|
|
|
hpoonis2010 Adept
Joined: 18 Jun 2019 Posts: 279
|
Posted: Thu Aug 22, 2019 10:17 am |
OK. I have refined things.
I have aliases to fire up the data capture process. Triggers which activate and statements which write data.
#ALIAS cort {#T+ identify;#DBLOAD equip;cast 'object read' %1}
This enables the 'identify' class which contains triggers to capture data.
Code: |
+-----------------------------------------------------------------+
| Keywords : woolen shawl polished |
| Name : (Polished) a woolen shawl |
| Id : 2172598197 |
| Type : Armor Level : 29 |
| Worth : 0 Weight : 3 |
| Wearable : neck |
| Score : 40 |
| Material : wool |
| Flags : unique, magic, held, V3 |
+-----------------------------------------------------------------+
| Stat Mods : Intelligence : +1 Luck : +2 |
| Damage roll : +2 |
+-----------------------------------------------------------------+
[2247/2247hp 1687/1699mn 2136/2136mv 0qt 1790tnl] > |
There are now just two problems.
1. The capture grabs not only the data I want, but also all of the data after it to the end of the line
From the debugger:
Code: |
0.0003 | a Aardwolf || Keywords : woolen shawl polished |
0.0006 | f Aardwolf | Pattern: Keywords : &Item.keywords : (%1="woolen shawl polished |")
0.0006 | a Aardwolf || Name : (Polished) a woolen shawl |
0.0005 | f Aardwolf | Pattern: Name : &Item.name : (%1="(Polished) a woolen shawl |")
0.0006 | a Aardwolf || Id : 2172598197 |
0.0006 | f Aardwolf | Pattern: Id : &Item.id : (%1="2172598197 |")
0.0005 | a Aardwolf || Type : Armor Level : 29 |
0.0004 | f Aardwolf | Pattern: Type : &Itemtype : (%1="Armor Level : 29 |")
0.0004 | f Aardwolf | Pattern: Level : &Item.level : (%1=" 29 |")
0.0016 | a Aardwolf || Worth : 0 Weight : 3 |
0.0004 | f Aardwolf | Pattern: Worth : &Item.worth : (%1="0 Weight : 3 |")
0.0004 | f Aardwolf | Pattern: Weight : &Item.weight : (%1=" 3 |")
0.0004 | a Aardwolf || Wearable : neck |
0.0004 | f Aardwolf | Pattern: Wearable : &Item.wearable : (%1="neck |")
0.0004 | a Aardwolf || Score : 40 |
0.0004 | f Aardwolf | Pattern: Score : &Item.score : (%1="40 |")
0.0004 | a Aardwolf || Material : wool |
0.0004 | f Aardwolf | Pattern: Material : &Item.material : (%1="wool |")
0.0004 | a Aardwolf || Flags : unique, magic, held, V3 |
0.0004 | a Aardwolf |+-----------------------------------------------------------------+
0.0016 | a Aardwolf || Stat Mods : Intelligence : +1 Luck : +2 |
0.0005 | f Aardwolf | Pattern: Intelligence : &Item.int : (%1="+1 Luck : +2 |")
0.0004 | f Aardwolf | Pattern: Luck : &Item.luck : (%1="+2 |")
0.0004 | a Aardwolf || Damage roll : +2 |
0.0004 | f Aardwolf | Pattern: Damage roll : &Item.dr : (%1="+2 |")
0.0004 | a Aardwolf |+-----------------------------------------------------------------+
0.0003 | a Aardwolf |
0.0002 | a Aardwolf ][2247/2247hp 1687/1699mn 2136/2136mv 0qt 1790tnl] >
0.0000 | f Aardwolf | Pattern: \+$\n\n^\[
0.0002 | c Aardwolf | exec : Pattern "\+$\n\n^\[" : #NEW @Itemtype @Item #DBSAVE |
The final trigger saves the data and disables the class.
As you can see, I am capturing data but, it is adding doublequotes to the strings.
It is NOT capturing the hr, dr, int, con, etc data as is is treating those as strings and not numbers - probably due to the plus or minus signs. I set the fields in the database to be numbers. I had the fields set as number with plus/minus checked but altered them to general. It made no difference.
Current triggers are like those shown in the debugger output.
How do I refine the capture so it only grabs the real data and not the ascii layout formatting? All else appears to now be functioning.
Thanks in advance. |
|
|
|
hpoonis2010 Adept
Joined: 18 Jun 2019 Posts: 279
|
Posted: Thu Aug 22, 2019 12:03 pm |
...and again. I amended the variables to certain specifics
EG.,
#TR {Dexterity : &%n{Item.dex}} {} identify
There exists a problem in the item NAME and item KEYWORDS contain spaces. One space is fine but after the last word there is a bunch of spaces before the line ends with a pipe ('|').
I narrowed a regex down to \w\s? but this will not work in regular cMUD scripting unless I flag it as a regex. Then, of course, the rest of the variable does not work as we are now using regex delimiters. So it seems I may have to revert to old style but I think the problem is not only with the separation of words but also with the triggers that exist further along the line now not firing.
trigger pattern (&d)
variable =%1 |
|
|
|
hpoonis2010 Adept
Joined: 18 Jun 2019 Posts: 279
|
Posted: Thu Aug 22, 2019 8:49 pm |
Currently,
Most of the fields are populating - the important ones anyway. The item names in aardwolf have an annoying feature, some of them are bounded by characters such as ':', '+', '~' and so on. This makes it very difficult to create a pattern expression that is likely to work for that field. I have tried various pattern matching symbols.
Several of the other fields are not populating which is strange as other fields which appear on the right of the item display. Field 'WORTH' does not populate due to the ',' in use. I tried to use %d%p%d but this fails to gather the data. Or it is some other thing causing the lack of data population. Oh, and in som cases (this is one), the TYPE field is being populated with the data from the WEAPON TYPE capture.
Debug Output:
Code: |
+-----------------------------------------------------------------+
| Keywords : axe 181crusader tomahawk crusader |
| Name : Tomahawk of the Warrior |
| Id : 2154756294 |
| Type : Weapon Level : 181 |
| Worth : 18,100 Weight : 15 |
| Wearable : wield |
| Score : 1922 |
| Material : iron |
| Flags : unique, hum, invis, magic, anti-evil, nodisarm, V3 |
| Clan Item : From Crusaders of the Nameless One |
+-----------------------------------------------------------------+
| Weapon Type: axe Average Dam : 423 |
| Inflicts : divine power Damage Type : Holy |
| Specials : vorpal |
+-----------------------------------------------------------------+
| Stat Mods : Strength : +8 Dexterity : +8 |
| Damage roll : +14 Hit points : +90 |
| Moves : -180 |
+-----------------------------------------------------------------+
[2247/2247hp 1662/1699mn 2136/2136mv 0qt 1078tnl] >
0.0018 | n Aardwolf | Exec Alias "shid"
0.0006 | k Aardwolf | [1] Var "Item" changed from "keywords=warhammer of pure annihilation ..." to ""
0.0045 | a Aardwolf |app 1
0.0016 | i Aardwolf >app 1<CR><LF>
0.0004 | d Aardwolf | [1] Aardwolf Comline : stopped
0.1547 | i Aardwolf *You appraise the true value of Tomahawk of the Warrior.<LF><CR><LF><CR>
0.0000 | +-----------------------------------------------------------------+<LF><CR>
0.0000 | | Keywords : axe 181crusader tomahawk crusader |<LF><CR>
0.0000 | | Name : Tomahawk of the Warrior |<LF><CR>
0.0000 | | Id : 2154756294 |<LF><CR>
0.0000 | | Type : Weapon Level : 181 |<LF><CR>
0.0000 | | Worth : 18,100 Weight : 15 |<LF><CR>
0.0000 | | Wearable : wield |<LF><CR>
0.0000 | | Score : 1922 |<LF><CR>
0.0000 | | Material : iron |<LF><CR>
0.0000 | | Flags : unique, hum, invis, magic, anti-evil, nodisarm, V3 |<LF><CR>
0.0000 | | Clan Item : From Crusaders of the Nameless One |<LF><CR>
0.0000 | +-----------------------------------------------------------------+<LF><CR>
0.0000 | | Weapon Type: axe Average Dam : 423 |<LF><CR>
0.0000 | | Inflicts : divine power Damage Type : Holy |<LF><CR>
0.0000 | | Specials : vorpal |<LF><CR>
0.0000 | +-----------------------------------------------------------------+<LF><CR>
0.0000 | | Stat Mods : Strength : +8 Dexterity : +8 |<LF><CR>
0.0000 | | Damage roll : +14 Hit points : +90 |<LF><CR>
0.0000 | | Moves : -180 |<LF><CR>
0.0000 | +-----------------------------------------------------------------+<LF><CR><LF><CR>
0.0000 | [2247/2247hp 1653/1699mn 2136/2136mv 0qt 1098tnl] >
0.0033 | a Aardwolf |You appraise the true value of Tomahawk of the Warrior.
0.0018 | a Aardwolf |
0.0013 | a Aardwolf |+-----------------------------------------------------------------+
0.0013 | a Aardwolf || Keywords : axe 181crusader tomahawk crusader |
0.0013 | k Aardwolf | Var "Item" changed from "" to "keywords=axe 181crusader tomahawk crusader "
0.0013 | f Aardwolf | Pattern: %sKeywords%s: &{Item.keywords} : (%1="axe 181crusader tomahawk crusader ")
0.0018 | a Aardwolf || Name : Tomahawk of the Warrior |
0.0014 | k Aardwolf | Var "Item" changed from "keywords=axe 181crusader tomahawk crusader " to "keywords=axe 181crusader tomahawk crusader ..."
0.0013 | f Aardwolf | Pattern: %sName%s: &{Item.name} : (%1="Tomahawk of the Warrior |")
0.0017 | a Aardwolf || Id : 2154756294 |
0.0011 | k Aardwolf | Var "Item" changed from "keywords=axe 181crusader tomahawk crusader ..." to "keywords=axe 181crusader tomahawk crusader ..."
0.0008 | f Aardwolf | Pattern: %sId%s: &%a{Item.id} : (%1=2154756294)
0.0021 | a Aardwolf || Type : Weapon Level : 181 |
0.0012 | k Aardwolf | Var "Item" changed from "keywords=axe 181crusader tomahawk crusader ..." to "keywords=axe 181crusader tomahawk crusader ..."
0.0008 | f Aardwolf | Pattern: Type%s: &%w{Item.type} : (%1="Weapon")
0.0008 | k Aardwolf | Var "Item" changed from "keywords=axe 181crusader tomahawk crusader ..." to "keywords=axe 181crusader tomahawk crusader ..."
0.0008 | f Aardwolf | Pattern: %sLevel :%s&%d{Item.level} : (%1=181)
0.0010 | a Aardwolf || Worth : 18,100 Weight : 15 |
0.0009 | k Aardwolf | Var "Item" changed from "keywords=axe 181crusader tomahawk crusader ..." to "keywords=axe 181crusader tomahawk crusader ..."
0.0010 | f Aardwolf | Pattern: %sWeight :%s&%d{Item.weight} : (%1=15)
0.0010 | a Aardwolf || Wearable : wield |
0.0009 | k Aardwolf | Var "Item" changed from "keywords=axe 181crusader tomahawk crusader ..." to "keywords=axe 181crusader tomahawk crusader ..."
0.0008 | f Aardwolf | Pattern: Wearable%s: &%w{Item.wearable} : (%1="wield")
0.0011 | a Aardwolf || Score : 1922 |
0.0009 | k Aardwolf | Var "Item" changed from "keywords=axe 181crusader tomahawk crusader ..." to "keywords=axe 181crusader tomahawk crusader ..."
0.0008 | f Aardwolf | Pattern: %sScore%s: &%d{Item.score} : (%1=1922)
0.0010 | a Aardwolf || Material : iron |
0.0009 | k Aardwolf | Var "Item" changed from "keywords=axe 181crusader tomahawk crusader ..." to "keywords=axe 181crusader tomahawk crusader ..."
0.0008 | f Aardwolf | Pattern: %sMaterial%s: &%w{Item.material} : (%1="iron")
0.0011 | a Aardwolf || Flags : unique, hum, invis, magic, anti-evil, nodisarm, V3 |
0.0010 | k Aardwolf | Var "Item" changed from "keywords=axe 181crusader tomahawk crusader ..." to "keywords=axe 181crusader tomahawk crusader ..."
0.0009 | f Aardwolf | Pattern: %sFlags%s: &{Item.flags} : (%1="unique, hum, invis, magic, anti-evil, nodisarm, V3 |")
0.0018 | a Aardwolf || Clan Item : From Crusaders of the Nameless One |
0.0012 | a Aardwolf |+-----------------------------------------------------------------+
0.0008 | a Aardwolf || Weapon Type: axe Average Dam : 423 |
0.0009 | k Aardwolf | Var "Item" changed from "keywords=axe 181crusader tomahawk crusader ..." to "keywords=axe 181crusader tomahawk crusader ..."
0.0008 | f Aardwolf | Pattern: %sAverage Dam :%s&%n{Item.avedam} : (%1=423)
0.0009 | k Aardwolf | Var "Item" changed from "keywords=axe 181crusader tomahawk crusader ..." to "keywords=axe 181crusader tomahawk crusader ..."
0.0007 | f Aardwolf | Pattern: %sWeapon Type:%s&%w{Item.weaptype} : (%1="axe")
0.0010 | a Aardwolf || Inflicts : divine power Damage Type : Holy |
0.0009 | k Aardwolf | Var "Item" changed from "keywords=axe 181crusader tomahawk crusader ..." to "keywords=axe 181crusader tomahawk crusader ..."
0.0008 | f Aardwolf | Pattern: Type%s: &%w{Item.type} : (%1="Holy")
0.0009 | k Aardwolf | Var "Item" changed from "keywords=axe 181crusader tomahawk crusader ..." to "keywords=axe 181crusader tomahawk crusader ..."
0.0008 | f Aardwolf | Pattern: %sInflicts%s: &{Item.inflicts}%s : (%1="divine power Damage Type : Holy ")
0.0010 | a Aardwolf || Specials : vorpal |
0.0010 | k Aardwolf | Var "Item" changed from "keywords=axe 181crusader tomahawk crusader ..." to "keywords=axe 181crusader tomahawk crusader ..."
0.0008 | f Aardwolf | Pattern: Specials%s: &{Item.specials} : (%1="vorpal |")
0.0011 | a Aardwolf |+-----------------------------------------------------------------+
0.0017 | a Aardwolf || Stat Mods : Strength : +8 Dexterity : +8 |
0.0010 | k Aardwolf | Var "Item" changed from "keywords=axe 181crusader tomahawk crusader ..." to "keywords=axe 181crusader tomahawk crusader ..."
0.0007 | f Aardwolf | Pattern: Strength%s: &%n{Item.str} : (%1=+8)
0.0009 | k Aardwolf | Var "Item" changed from "keywords=axe 181crusader tomahawk crusader ..." to "keywords=axe 181crusader tomahawk crusader ..."
0.0007 | f Aardwolf | Pattern: %sDexterity%s: &%n{Item.dex} : (%1=+8)
0.0010 | a Aardwolf || Damage roll : +14 Hit points : +90 |
0.0009 | k Aardwolf | Var "Item" changed from "keywords=axe 181crusader tomahawk crusader ..." to "keywords=axe 181crusader tomahawk crusader ..."
0.0008 | f Aardwolf | Pattern: %sDamage roll%s: &%n{Item.dr} : (%1=+14)
0.0009 | k Aardwolf | Var "Item" changed from "keywords=axe 181crusader tomahawk crusader ..." to "keywords=axe 181crusader tomahawk crusader ..."
0.0007 | f Aardwolf | Pattern: %sHit points%s: &%n{Item.hp} : (%1=+90)
0.0010 | a Aardwolf || Moves : -180 |
0.0011 | k Aardwolf | Var "Item" changed from "keywords=axe 181crusader tomahawk crusader ..." to "keywords=axe 181crusader tomahawk crusader ..."
0.0008 | f Aardwolf | Pattern: %sMoves%s: &%n{Item.mv} : (%1=-180)
0.0010 | a Aardwolf |+-----------------------------------------------------------------+
0.0008 | a Aardwolf |
0.0007 | a Aardwolf ][2247/2247hp 1653/1699mn 2136/2136mv 0qt 1098tnl] >
0.0006 | f Aardwolf | Pattern: \+$\n\n^\[
0.0009 | c Aardwolf | exec : Pattern "\+$\n\n^\[" : #ADDKEY @Item room %roomkey() #ADD...
0.0006 | n Aardwolf | Exec Trigger "\+$\n\n^\["
0.0000 |
|
The actual datbase record for the above is as follows. Roomvnum (gmcp mud room), zone (mapper area), and room (mapper room number) are populated by direct calls to cMUD script functions:-
Code: |
roovnum 31156
zone Crusader Clan
room 7215
keywords axe 181crusader tomahawk crusader
name "Tomahawk of the Warrior |"
id 2154756294
type
level 181
worth 0
weight 15
wearable wield
score 1922
material ironwood
flags "unique, hum, invis, magic, anti-evil, nodisarm, V3 |"
dr +14
hr 0
str +8
dex +8
int +0
wis +0
con +0
luck +0
mv -180
mn +0
hp +90
all physical 0
allmagic 0
weapontype axe
averagedam 423
damagetype divine power Damage Type : Holy
specials "vorpal |"
saveslash +0
savemagic +0
savepierce +0
savebash +0
savenegative +0
|
It's a baffling thing, to be sure. |
|
|
|
|
|
|
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
|
|