|
remus Wanderer
Joined: 06 Jul 2002 Posts: 53 Location: Australia
|
Posted: Sun Sep 04, 2005 2:14 pm
Database records help |
Ok this will sound long winded but its pretty simple what I am trying to do.
I have a trigger like this:
Trigger: landed a yellow perch weighing (%d) pounds and (%d) ounces.
Value: #NEW Fishing {Type of Fish=Catfish|Pounds=%1|Ounces=%2}
Now that all works fine.
What I want it to do is only do the #NEW if %1+%2 is greater than any catfish ever caught by me before.
The problem is as always with Achaea that it can line wrap at any of these points.
#TRIGGER {^landed a yellow perch weighing (%d) poun[ds] and (%d) ounc[es]} {#NEW Fishing {Type of Fish=Yellow Perch|Pounds=%1|Ounces=%2}} "FISHINGDB"
#TRIGGER {^perch weighing (%d) poun[ds] and (%d) ounc[es]} {#NEW Fishing {Type of Fish=Yellow Perch|Pounds=%1|Ounces=%2}} "FISHINGDB"
#TRIGGER {^perch weighing (%d) poun[ds]} {#NEW Fishing {Type of Fish=Yellow Perch|Pounds=%1|Ounces=%2}} "FISHINGDB"
At Present I have a heap of fish all in the database when really all I need is the biggest ones. Sort of like my own trophy room of big fish. I probably could do it just with variables but I cant seem to work it out and I figure that Zmud has a Database I may as well learn to use it as it is one of the features I have always wanted to learn.
Thanks in Advance
Remus |
|
_________________ Once the Known was unknown now its Known...
Do you know it??? |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Sun Sep 04, 2005 4:48 pm |
Start by upping your pagewidth in the config. This solves most triggering problems not related to the room text.
|
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
remus Wanderer
Joined: 06 Jul 2002 Posts: 53 Location: Australia
|
Posted: Sun Sep 04, 2005 5:52 pm |
No, that doesnt work I am sorry. By upping pagewidth all you do is cause it to wrap at a different location in the sentence. This still breaks it up into odd lengths and so multitriggers are still needed. Anyways I can do the mutlitriggers. Its the Database part I need help with.
UPDATE:
Here is my class folder which seems to do what I want but not perfectly. It seems to work fine for a few but then stops working or works sporatically. At present it is only for the Small fish on Achaea. I am sure there are more efficent ways to do this but this is what I have managed.
Any help is greatly appreciated!
#CLASS {FISHINGDB}
#VAR allfish {(type=blue eel|pounds=1|ounces=13)|(type=landed a blue eel|pounds=1|ounces=13)|(type=striped shad|pounds=4|ounces=10)|(type=landed a striped shad|pounds=4|ounces=10)|(type=perch|pounds=2|ounces=1)|(type=2|pounds=5|ounces=)|(type=perch|pounds=2|ounces=5)|(type=yellow perch|pounds=2|ounces=5)|(type=landed a yellow perch|pounds=2|ounces=5)|(type=yellow perch|pounds=1|ounces=14)|(type=landed a yellow perch|pounds=1|ounces=14)|(type=shad|pounds=4|ounces=7)|(type=perch|pounds=1|ounces=9)|(type=blue eel|pounds=2|ounces=5)|(type=landed a blue eel|pounds=2|ounces=5)|(type=blue eel|pounds=2|ounces=12)|(type=landed a blue eel|pounds=2|ounces=12)}
#TRIGGER {^landed a yellow perch weighing (%d) poun[ds] and (%d) ounc[es]{!|.}$} {#NEW Fishing {Type=Yellow Perch|Pounds=%1|Ounces=%2}} "" {disable}
#TRIGGER {^landed a longnose darter weighing (%d) poun[ds] and (%d) ounc[es]{!|.}$} {#NEW Fishing {Type=Longnose Darter|Pounds=%1|Ounces=%2}} "" {disable}
#TRIGGER {^landed a (*) weighing (%d) poun[ds] and (%d) ounc[es]{!|.}$} {#VAR Fishingdb/pounds %2;#VAR Fishingdb/ounces %3;#VAR Fishingdb/type "";#IF (%1="blue eel") {Fishingdb/type=Eel};#IF (%1="striped shad") {Fishingdb/type=Shad};#IF (%1="yellow perch") {Fishingdb/type=Perch};#IF (%1="longnose darter") {Fishingdb/type=darter};#IF (%1="bearded pikefish") {Fishingdb/type=Pikefish};#IF (%1="catfish") {Fishingdb/type=catfish};#MATH Fishingdb/biggest@type ((@Fishingdb/pounds*16)+@Fishingdb/ounces);#IF (@Fishingdb/biggest@type>@Fishingdb/biggest2@type) {#NEW fishing {type=@type|pounds=%2|ounces=%3}} {#addi fishingdb/allfish {type=%1|pounds=%2|ounces=%3}}}
#TRIGGER {weighing (%d) pounds and (%d) ounces!} {Fishingdb/pounds=%1;Fishingdb/ounces=%2;Fishingdb/type=Eel;#MATH Fishingdb/biggestEel ((@Fishingdb/pounds*16)+@Fishingdb/ounces);#IF (@Fishingdb/biggestEel>@Fishingdb/biggest2Eel) {#NEW fishing {type=Eel|pounds=%1|ounces=%2};Fishingdb/biggest2Eel=@Fishingdb/biggestEel} {#addi fishingdb/allfish {type=%1|pounds=%2|ounces=%3}}}
#TRIGGER {^landed a blue eel weighing (%d) poun[ds] and (%d) ounc[es]{!|.}$} {#NEW Fishing {Type=Blue eel|Pounds=%1|Ounces=%2}} "" {disable}
#TRIGGER {^landed a rock shad weighing (%d) poun[ds] and (%d) ounc[es]{!|.}$} {#NEW Fishing {Type=Rock Shad|Pounds=%1|Ounces=%2}} "" {disable}
#TRIGGER {^landed a catfish weighing (%d) poun[ds] and (%d) ounc[es]{!|.}$} {#NEW Fishing {Type=Catfish|Pounds=%1|Ounces=%2}} "" {disable}
#TRIGGER {^(%w) weighing (%d) poun[ds]{!|.}$} {Fishingdb/pounds=%2;Fishingdb/ounces=%3;Fishingdb/type=%1;#MATH Fishingdb/biggest%1 ((@Fishingdb/pounds*16)+@Fishingdb/ounces);#IF (@Fishingdb/biggest%1>@Fishingdb/biggest2%1) {#NEW fishing {type=%1|pounds=%2|ounces=%3};Fishingdb/biggest2%1=@Fishingdb/biggest%1} {#addi fishingdb/allfish {type=%1|pounds=%2|ounces=%3}}}
#TRIGGER {^pikefish weighing (%d) poun[ds] and (%d) ounc[es]{!|.}$} {#NEW Fishing {Type of Fish=Bearded Pikefish|Pounds=%1|Ounces=%2}} "" {disable}
#TRIGGER {^(*) weighing (%d) poun[ds] and (%d) ounc[es]{!|.}$} {Fishingdb/pounds=%2;Fishingdb/ounces=%3;#IF (%1="Blue eel") {Fishingdb/type=Eel};#IF (%1="Striped Shad") {Fishingdb/type=Shad};#IF (%1="Yellow Perch") {Fishingdb/type=Perch};#IF (%1="Longnose Darter") {Fishingdb/type=darter};#IF (%1="Bearded Pikefish") {Fishingdb/type=Pikefish};#IF (%1="catfish") {Fishingdb/type=catfish};#MATH Fishingdb/biggest@type ((@Fishingdb/pounds*16)+@Fishingdb/ounces);#IF (@Fishingdb/biggest@type>@Fishingdb/biggest2@type) {#NEW fishing {type=@type|pounds=%2|ounces=%3}} {#addi fishingdb/allfish {type=%1|pounds=%2|ounces=%3}}}
#TRIGGER {^(*) weighing (%d) poun[ds]{.|!}$} {Fishingdb/pounds=%2;Fishingdb/ounces=%3;#IF (%1="Blue eel") {Fishingdb/type=Eel};#IF (%1="Striped Shad") {Fishingdb/type=Shad};#IF (%1="Yellow Perch") {Fishingdb/type=Perch};#IF (%1="Longnose Darter") {Fishingdb/type=darter};#IF (%1="Bearded Pikefish") {Fishingdb/type=Pikefish};#IF (%1="catfish") {Fishingdb/type=catfish};#MATH Fishingdb/biggest@type ((@Fishingdb/pounds*16)+@Fishingdb/ounces);#IF (@Fishingdb/biggest@type>@Fishingdb/biggest2@type) {#NEW fishing {type=@type|pounds=%2|ounces=%3}} {#addi fishingdb/allfish {type=%1|pounds=%2|ounces=%3}}}
#TRIGGER {^a striped shad weighing (%d) poun[ds] and (%d) ounc[es]{.|!}$} {#NEW Fishing {Type=Striped Shad|Pounds=%1|Ounces=%2}} "" {disable}
#TRIGGER {^(%w) weighing (%d) poun[ds] and (%d) ounc[es]{!|.}$} {Fishingdb/pounds=%2;Fishingdb/ounces=%3;Fishingdb/type=%1;#MATH Fishingdb/biggest%1 ((@Fishingdb/pounds*16)+@Fishingdb/ounces);#IF (@Fishingdb/biggest%1>@Fishingdb/biggest2%1) {#NEW fishing {type=%1|pounds=%2|ounces=%3};Fishingdb/biggest2%1=@Fishingdb/biggest%1} {#addi fishingdb/allfish {type=%1|pounds=%2|ounces=%3}}}
#CLASS 0 |
|
_________________ Once the Known was unknown now its Known...
Do you know it??? |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Mon Sep 05, 2005 4:26 pm |
How far can you up it? If you can reach a point where not even Achaea will be able to wrap the text then ZMud treats whatever it wraps as a single line. This single line is then easily triggered on.
|
|
_________________ EDIT: I didn't like my old signature |
|
|
|
remus Wanderer
Joined: 06 Jul 2002 Posts: 53 Location: Australia
|
Posted: Tue Sep 06, 2005 1:40 pm |
Matt you so rock! It let me go out to 250 characters which makes it work.
I now have just 2 triggers that capture all the fish I catch, this is much better anyways because I can look at them all.
All I need now is a way to go through the lists and grab the biggest of each and #echo them. Is this possible? What I am looking for is a way to echo something like this.
Code: |
Type Pounds ounces date
catfish 12 1 2nd Mirian 451
Shapa 15 15 13th Mirian 451
Bigfish 12 1 21st Mirian 451
|
UPDATE:
Here is my triggers, I have worked out the date part too now :)
FISH PART (Triggers off this)
You reel in the last bit of line and your struggle is over. You've landed a marble carp weighing 13 pounds and 10 ounces.
#TRIGGER {lan[ded] {an|a} (*) weighing (%d) poun[ds] and (%d) ounc[es]{!|.}$} {Type=%1;pounds=%2;ounces=%3;date}
or this
You reel in the last bit of line and your struggle is over. You've landed a marble carp weighing 13 pound.
#TRIGGER {lan[ded] a (*) weighing (%d) poun[ds]{!|.}$} {Type=%1;pounds=%2;ounces=%3;date}
DATE CAPTURE AND DB SENDING (triggers off this)
Today is the 1st of Phaestian, 401 years after the fall of the Seleucarian Empire. The phase of the moon is that of the Waning Gibbous.
#TRIGGER {Today is the (*) of (%w), (%d) years} {#var date "%1 of %2, %3";#NEW Fishing {Type=@type|pounds=@pounds|ounces=@ounces|date=@date}}
*This part is working perfectly now*
*Still need the database data help above though* |
|
_________________ Once the Known was unknown now its Known...
Do you know it??? |
|
|
|
remus Wanderer
Joined: 06 Jul 2002 Posts: 53 Location: Australia
|
Posted: Sat Sep 10, 2005 2:00 pm |
Anyone have any ideas. As I said I am not familar with the database system. I figure there has to be a way to compare all the Pounds and Ounces columns while using the Type column as the point of reference. So that it will parse through all Type that are say Catfish and then move the one that has the largest Pounds and Ounces into a variable so I can display it. Does that make sense?
|
|
_________________ Once the Known was unknown now its Known...
Do you know it??? |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Sat Sep 10, 2005 6:09 pm |
Set up a view for the database with Type in the sort. Also enter the formula "&Pounds*16+&Ounces" in the sort. You can the use %query with that view to get a list of records for any given type all sorted by weight.
|
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
remus Wanderer
Joined: 06 Jul 2002 Posts: 53 Location: Australia
|
Posted: Sun Sep 11, 2005 6:03 am |
Ah ok, I think I will go back to variables and string lists. The database is a great storage idea but doesnt seem to do effectively what I need. Thanks for all the help anyways!
|
|
_________________ Once the Known was unknown now its Known...
Do you know it??? |
|
|
|
alaric Novice
Joined: 13 Aug 2005 Posts: 32 Location: Cherry Point, NC
|
Posted: Sun Sep 11, 2005 11:03 am |
call me stupid, but I can't find where the config is to change the pagewidth.....where can I find it?
|
|
|
|
remus Wanderer
Joined: 06 Jul 2002 Posts: 53 Location: Australia
|
Posted: Sun Sep 11, 2005 11:13 am |
#TRIGGER {lan[ded] {an|a} (*) weighing (%d) poun[ds] and (%d) ounc[es]{!|.}$} {Type=%1;pounds=%2;ounces=%3;date}
using the above trigger I have a string that I am trying to compare. It is a list of fish names like this:
#VAR fname {Giant chubsucker|Striped Shad|Blue eel}
I capture the matching name from a trigger and what I need is a way to #IF check.
[code]
#TR {lan[ded] {an|a} (*) weighing (%d) poun[ds] and (%d) ounc[es]{!|.}$} {Fish_records/Type=%proper( %1);Fish_records/pounds=%2;Fish_records/ounces=%3;#math Fish_records/Fchecker (@pounds*16+@ounces);#IF (@Fish_records/type="%item( @Fish_records/fname, 1)") {#IF (@Fish_records/Fchecker>%item( @Fish_records/current, 1)) {#Addi records {%proper( @type) @pounds @ounces @date}};#VAR current %replaceitem( "@Fish_records/fchecker", 1, @current)} {All the blue part is repeated here 16 times, each time the red +1}}
Should the above work? I cant seem to see why it doesnt. Syntax wise it seems ok according to Zmud.
Oh @current has a value in it that is checked against that is @Fchecker. If Fchecker is larger than current it is supposed to replace corresponding current value with fchecker value. |
|
_________________ Once the Known was unknown now its Known...
Do you know it??? |
|
|
|
alaric Novice
Joined: 13 Aug 2005 Posts: 32 Location: Cherry Point, NC
|
Posted: Sun Sep 11, 2005 11:52 am |
I am having a similar problem. My MUD doesn't have a way to adjust the page width, and I am having difficulting figuring out the database stuff. I can follow some of it, but a lot is confusing me and all....If someone could explain how it works or show me something to help me out it would be most appreciated. This is an example of what my identify command looks like....
Quote: |
This is a sky-blue band, a small platinum treasure, weighing
approximately 1 lbs. It is of above average quality and is worth
approximately 300 silver. It bears an enchantment to moderately increase
constitution. |
The problem I have is trying to figure out how to make multiple triggers to throw the info into the database....I can catch the first line no problem...but when trying for the second line...I am trying to figure out how to make it add to the first lines #NEW record and all....the variables confuse me in how exactly they work and paste the info into the database....so I was just using it without the variables..but as far as I can gather...you have to have a variable to put a name to the second and third lines... :( The wordwrap on my MUD keeps the items from wrapping on the same spot....which complicates things a bit, but mostly its just the variable thingy I need help with...thanks in advance. |
|
|
|
|
|