|
Indica Beginner
Joined: 25 Mar 2003 Posts: 18
|
Posted: Tue Mar 25, 2003 3:13 am
Item DB script - Nodeka |
Hi, I play a mud called nodeka. What I can't figure out is how to take an identify from an item and incert it into a database. Here is the output from the mud:
You chant the words, 'rlhgx hekmuehyrhogfu.'
Name: the helm of training
Keywords: helm training
Value: 5,000 gold
Type: head
Bonus: hit +2, damage +1, health +15, constitution +1, speed +1,
agility +1, dexterity +1, strength +1, willpower +1, intellect +1,
wisdom +1
----OR----
You chant the words, 'rlhgx hekmuehyrhogfu.'
Name: ( burnished ) the Vl'lakian Warlock's ring of vision
Keywords: burnished ring vision warlock
Value: 10,000,000 gold
Type: fingers
Class: warlock, witch, wizard, sorcerer, druid, bishop, necromancer, priestess
Attributes: level 80, strength 20, intellect 30, wisdom 30, willpower 30
Bonus: hit +2, damage +2, mana +32, spirit +30, health +23,
willpower +4
some items have class restrictions and/or attributes. I have tried to figure it out for a while now, and have read the help file more times than i like.
Thank you ahead of time,
Lord Indica of Nodeka
nodeka.com Port 23 |
|
|
|
megamog75 Enchanter
Joined: 20 Nov 2002 Posts: 627 Location: USA
|
Posted: Wed Mar 26, 2003 5:34 am |
oops
|
|
|
|
megamog75 Enchanter
Joined: 20 Nov 2002 Posts: 627 Location: USA
|
Posted: Wed Mar 26, 2003 6:27 am |
The equipment id script is your best bet, I think it is what your looking for to point you in the right direction.
I am sorry that i am not giving you the answer but I am a die hard when it comes to learning so this is what I have for you.
http://www.zuggsoft.com/forum/topic.asp?TOPIC_ID=2164&FORUM_ID=29&CAT_ID=1&Topic_Title=Realms+of+Despair+%2D%2D+Equipment+Database+Script&Forum_Title=Finished+MUD+Scripts
______________________________________________________________________________________
This above example is of corse only an example your would have to be a little bit different:
#CLASS {equip}
#ALIAS store_data {#IF !%null( %find( @newRecord.Name, All, Name)) {#YESNO "A duplicate item already exists, add anyway?" {#NOOP} {#ABORT 1}};eqprompt;#DBLOAD new;#NEW All @newRecord;#dbsave;#dbreset;#dbclose}
#ALIAS eqprompt {#PROMPT newRecord.Source "Source Mob or Shop?"}
#VAR newrecord {}
#TRIGGER {You chant the words, 'rlhgx hekmuehyrhogfu.'} {#var newrecord ""}
#TRIGGER {Name: (*)} {#DBLOAD new;#ADDKEY newRecord Name {%1}}
#TRIGGER {Keywords: (*)} {#addkey newrecord keywords "%1"}
#TRIGGER {Value: (*)} {#addkey newrecord Value "%1"}
#TRIGGER {Type: (%w)} {#addkey newrecord type %1}
#TRIGGER {Bonus:} {#temp {^$} {store_data};#t+ bonus}
#TRIGGER {Class: (*)} {#addkey newrecord Class "%1"}
#TRIGGER {Attributes:} {#t+ attributes}
#CLASS 0
#CLASS {equip|bonus}
#TRIGGER {hit (*)} {#addkey newrecord hit "%1"}
#TRIGGER {damage (*)} {#addkey newrecord damage "%1"}
#TRIGGER {health (*)} {#addkey newrecord health "%1"}
#TRIGGER {constitution (*)} {#addkey newrecourd con "%1"}
#CLASS 0
#CLASS {equip|attributes}
#TRIGGER {level (%D)} {#addkey newrecord lvl %1}
#TRIGGER {strength (%D)} {#addkey newrecord str %1}
#CLASS 0
So I gave you the key anyways :)
Just use the above examples to programm the rest and write me if you have anythnig more
megamog75
Keeper of the only printable help files for Zmud. |
|
|
|
Indica Beginner
Joined: 25 Mar 2003 Posts: 18
|
Posted: Wed Mar 26, 2003 8:12 am |
#CLASS {eqdb}
#ALIAS store_data {#IF !%null( %find( @newRecord.Name, All, Name)) {#YESNO "A duplicate item already exists, add anyway?" {#NOOP} {#ABORT 1}};#DBLOAD new;#NEW All @newRecord;#dbsave;#dbreset}
#VAR newrecord {}
#TRIGGER {You chant the words, 'rlhgx hekmuehyrhogfu.'} {#var newrecord ""}
#TRIGGER {Name: (*)} {#DBLOAD new;#ADDKEY newRecord Name {%1}}
#TRIGGER {Keywords: (*)} {#addkey newrecord Keywords "%1"}
#TRIGGER {Value: (*) gold} {#addkey newrecord Value "%1"}
#TRIGGER {Type: (%w)} {#addkey newrecord Type "%1"}
#TRIGGER {Weapon: (*)} {#addkey newrecord Weapon "%1"}
#TRIGGER {Bonus:} {#temp {^$} {store_data};#t+ bonus}
#TRIGGER {Class: (*)} {#addkey newrecord Class "%1"}
#TRIGGER {Attributes:} {#t+ attributes}
#CLASS 0
#CLASS {eqdb|attributes}
#TRIGGER {level (%D)} {#addkey newrecord A-lvl %1}
#TRIGGER {hit (*)} {#addkey newrecord A-hit %1}
#TRIGGER {damage (*)} {#addkey newrecord A-dam %1}
#TRIGGER {health (*)} {#addkey newrecord A-HP %1}
#TRIGGER {mana (*)} {#addkey newrecord A-mana %1}
#TRIGGER {spirit (*)} {#addkey newrecord A-spirit %1}
#TRIGGER {constitution (*)} {#addkey newrecord A-con %1}
#TRIGGER {speed (*)} {#addkey newrecord A-spe %1}
#TRIGGER {agility (*)} {#addkey newrecord A-agi %1}
#TRIGGER {dexterity (*)} {#addkey newrecord A-dex %1}
#TRIGGER {strength (*)} {#addkey newrecord A-str %1}
#TRIGGER {willpower (*)} {#addkey newrecord A-wil %1}
#TRIGGER {wisdom (*)} {#addkey newrecord A-wis %1}
#CLASS 0
#CLASS {eqdb|bonus}
#TRIGGER {hit (*)} {#addkey newrecord B-hit %1}
#TRIGGER {damage (*)} {#addkey newrecord B-dam %1}
#TRIGGER {health (*)} {#addkey newrecord B-HP %1}
#TRIGGER {mana (*)} {#addkey newrecord B-mana %1}
#TRIGGER {spirit (*)} {#addkey newrecord B-spirit %1}
#TRIGGER {constitution (*)} {#addkey newrecord B-con %1}
#TRIGGER {speed (*)} {#addkey newrecord B-spe %1}
#TRIGGER {agility (*)} {#addkey newrecord B-agi %1}
#TRIGGER {dexterity (*)} {#addkey newrecord B-dex %1}
#TRIGGER {strength (*)} {#addkey newrecord B-str %1}
#TRIGGER {willpower (*)} {#addkey newrecord B-wil %1}
#TRIGGER {wisdom (*)} {#addkey newrecord B-wis %1}
#CLASS 0
----------------------------------------
That is what i have so far, i have a field for each of the categories after newrecord.
But most of the fields are not getting entered into the database, if Bonus: is to lines long it will insert the very first one, but not any that it lists like this:
strength +2, constitution +1, etc....
willpower +2
it will enter the strength and willpower, but not con and anything following
Any suggestions, error's in my code (probably),
Lord Indica
nodeka.com port 23
Zmud version 6.4 |
|
|
|
Indica Beginner
Joined: 25 Mar 2003 Posts: 18
|
Posted: Wed Mar 26, 2003 7:34 pm |
Okay, i got it working!!!!!
Is their a way to print the Value of a record and print it in a window?
Hence i use an alias lkup, and have it followed by an item name and have it print the item name on the screen?
And THANK'S for all your help megamog75 |
|
|
|
TonDiening GURU
Joined: 26 Jul 2001 Posts: 1958 Location: Canada
|
Posted: Wed Mar 26, 2003 7:50 pm |
quote:
expanddb
Syntax: %expanddb(dbvar,delim,[valuedelim])
Reformats the given database variable and puts the delim string between each key/value pair. The optional valuedelim is used to put a string between each key name and value (default is = if omitted).
Example:
Char.Name = Zugg
Char.Class = Warrior
Char.Level = 27
#SHOW %expanddb(@Char," ")
displays "Name=Zugg Class=Warrior Level=27"
#SHOW %expanddb(@Char,%crlf,": ")
displays:
Name: Zugg
Class: Warrior
Level: 27
I believe this will work:
:windowIwantToShowInfo:#SHOW %expanddb(@NameOfMyPrimaryWindow.newRecord,%crlf,": ")
To make a window: #CAP windowIwantToShowInfo
To set the name of your main window: #NAME NameOfMyPrimaryWindow
Ton Diening |
|
|
|
Indica Beginner
Joined: 25 Mar 2003 Posts: 18
|
Posted: Wed Mar 26, 2003 7:59 pm |
Well i understood a little bit of that, but how do i set fields from my database??
Lets say my Database has three fields: Name, Value, Class And i want it to display in window ID anything that had the word stud in the field name.
Thanx ahead of time,
Indica |
|
|
|
megamog75 Enchanter
Joined: 20 Nov 2002 Posts: 627 Location: USA
|
Posted: Wed Mar 26, 2003 8:39 pm |
No problem, I just used Troubadour's equip id script as a guide.
The amount of time He and all people who contribute to the finised mud scripts is amazing and should never be over looked.
Alot of answes to peoples problems can be answered there.
Also if you google search for Zmud you will find acouple of independent sites that have some finished scripts that were posted here awhile back but got deleted by accident when the forum changed over.
As to your new question what your interested in,is: #find and #query
Read the help topics for these and see if that will help
Create an #alias that sends the query to a new window
#alias find {#var found %find("%1",all);#FORALL @found {#WIN ID %i}}
Should give you the record numbers of all found items,then you will have do make it expand each one I think with maybe %dbget or something.
Goodluck,let me know how it goes.
megamog75
Keeper of the only printable help files for Zmud. |
|
|
|
Indica Beginner
Joined: 25 Mar 2003 Posts: 18
|
Posted: Thu Mar 27, 2003 5:28 am |
okay i have an alias that checks my database, and it returns: FOUND: 117it|105it 117 and 105 being the numbers in the database. How do i set them to a variable and have it print it one number, like it will print some stuff with reference to the db number/variable, so how do i get it to do this
#WINDOW ID Name: %db(@itemnum, Name)
#WINDOW ID Keywords: %db(@itemnum, Keywords)
but print first 117 with all of that, then 105. Do i need to set them each to their own variable? and then how do i get them to trigg one after the other |
|
|
|
Indica Beginner
Joined: 25 Mar 2003 Posts: 18
|
Posted: Thu Mar 27, 2003 6:34 am |
This is what i'm sending to the other window, what i want to be able to do is in the requirements and bonus only print sections if it is greater than zero.....
#WINDOW ID Name: %db(@itemnum, Name)
#WINDOW ID Keywords: %db(@itemnum, Keywords)
#WINDOW ID Value: %db(@itemnum, Value)
#WINDOW ID Type: %db(@itemnum, Type)
#WINDOW ID Weapon: %db(@itemnum, Weapon)
#WINDOW ID Class: %db(@itemnum, Class)
#WINDOW ID Requirements: lvl %db(@itemnum, Req-lvl), con %db(@itemnum, Req-con), spe %db(@itemnum, Req-spe), agi %db(@itemnum, Req-agi), dex %db(@itemnum, Req-dex), str %db(@itemnum, Req-str), wil %db(@itemnum, Req-wil), int %db(@itemnum, Req-int), wis %db(@itemnum, Req-wis)
#WINDOW ID Bonus: hit %db(@itemnum, Bonus-hit), dam %db(@itemnum, Bonus-dam), hp %db(@itemnum, Bonus-hp), mana %db(@itemnum, Bonus-mana), spirit %db(@itemnum, Bonus-spirit), con %db(@itemnum, Bonus-con), spe %db(@itemnum, Bonus-spe), agi %db(@itemnum, Bonus-agi), dex %db(@itemnum, Bonus-dex), str %db(@itemnum, Bonus-str), wil %db(@itemnum, Bonus-wil), int %db(@itemnum, Bonus-int), wis %db(@itemnum, Bonus-wis), ac %db(@itemnum, Bonus-ac), nat %db(@itemnum, Bonus-nat), quick %db(@itemnum, Bonus-quick)
So like if %db(@itemnum, Bonus-nat)= 0 dont put that into the display,
Thanks again,
Indica |
|
|
|
megamog75 Enchanter
Joined: 20 Nov 2002 Posts: 627 Location: USA
|
Posted: Thu Mar 27, 2003 6:51 pm |
OK it seems like your on the right track, now as to this question:
FOUND: 117it|105it 117 and 105 being the numbers in the database so how do i get it to do this
#WINDOW ID Name: %db(@itemnum, Name)
#WINDOW ID Keywords: %db(@itemnum, Keywords)
but print first 117 with all of that, then 105.
What you need to look at now is #LOOP and maybe #FORALL,but I think #LOOP will do what you want
It isn't really that hard what you should do first is count the items in the #var that holds: 117it|105it
Lets just say that #var is called: Found
so we need a new #var to keep count for us
#var foundcount %numitems(@found)
#loop 1,@foundcount {#WINDOW ID Name: %db(@itemnum, Name);#WINDOW ID Keywords: %db(@itemnum, Keywords)}
See if that helps. and make sure to read the #loop in the help files
_____________________________________________________________________________
This question is just as easy but it will take you to #IF.
#VAR NEW 1
#IF @NEW=1 {TRUE} {FALSE} and false is optional.
Returns TRUE
So like if %db(@itemnum, Bonus-nat)= 0 dont put that into the display
where
nat %db(@itemnum, Bonus-nat)
It might look SOMETHING like this:
nat %if(%db(@itemnum, Bonus-nat)>0,%db(@itemnum, Bonus-nat))
Writing down your question sometimes gives you the answer:
So like if %db(@itemnum, Bonus-nat)= 0 dont put that into the display
Looks to me as:
So like #if %db(@itemnum, Bonus-nat)=0 {""}
The "" means nothing.
Well good luck.
megamog75
Keeper of the only printable help files for Zmud. |
|
|
|
Indica Beginner
Joined: 25 Mar 2003 Posts: 18
|
Posted: Thu Mar 27, 2003 8:25 pm |
how do i set each of them to the variable???
It prints <number>it|<number>it
I woud do it like this but it puts in the it's
FOUND: (&itemcount)
and i end up with <number>it|<number>it in my variable, how do i set the numbers to the variable with out the it, or some how elimenate the it's
Indica |
|
|
|
megamog75 Enchanter
Joined: 20 Nov 2002 Posts: 627 Location: USA
|
Posted: Thu Mar 27, 2003 9:39 pm |
What your saying ids that it gives you
117it|105it and you want 117|105 ?
this is one answer:
say 117it|and105it are stored in a #var found
then you would:
#var found %replace(@found,"it","")
this will remove all ocurences of it in the @var string @found
Is this what you wanted?
___________________________________________________________________________________
Show me what you have and then show me what you would like to see and I might be able to come up with something for you.
megamog75
Keeper of the only printable help files for Zmud. |
|
|
|
Indica Beginner
Joined: 25 Mar 2003 Posts: 18
|
Posted: Thu Mar 27, 2003 10:21 pm |
yep, thanxs, still workin on showing each value of the variable seperately thou
Name: <1 value of variable>
Keyword: <1 value of variable>
Name: <2nd value of variable>
and so forth, through all the values
The replace worked, but i still can't seem to get either part of loop or forall to work in my display, the %numitems(@itemnum) returns a one no matter how many are in the array
Indica |
|
|
|
megamog75 Enchanter
Joined: 20 Nov 2002 Posts: 627 Location: USA
|
Posted: Fri Mar 28, 2003 2:10 am |
The problem is this:
the %numitems(@itemnum) returns a one no matter how many are in the array
Should be
#var itemnum %numitems(@found)
You see you were just counting itself
megamog75
Keeper of the only printable help files for Zmud. |
|
|
|
Indica Beginner
Joined: 25 Mar 2003 Posts: 18
|
Posted: Fri Mar 28, 2003 5:09 am |
No, @itemnum is the db numbers, my trigger:
#TRIGGER {FOUND: (&itemnum)} {#VAR itemnum %replace(@itemnum,"it",""}
thats what i use to set my itemnum, and then i also had for the replace part
#TRIGGER {FOUND: (&itemnum)} {#VAR itemnum %replace(@itemnum,"it","");#VAR itemcount %numitems(itemnum)}
but i figured out my problem their, need to create the variable, and then set it, i have that part working, but i still cannot have it display:
#WINDOW ID Name: %db(@itemnum, Name)
#WINDOW ID Keywords: %db(@itemnum, Keywords)
#WINDOW ID Value: %db(@itemnum, Value;
so how do i get it to show each value of @itemnum sperately, so Name, Keywords, Value, for each value of @itemnum
___________________
And what i want on this part:
#WINDOW ID Requirements: %if(lvl %db(@itemnum, Req-lvl)=0,"") %if(con %db(@itemnum, Req-con)=0,"")
but what happens is it doesn't show anything, on a test i tried it on con, well con was equal to 0 and it didn't display, great!, but i tried it on one that had a con of 0 but a lvl of 23, and it didn't show either, what can i do to fix that?
i figured out the != if not equal to and it worked it displayed the stuff, but left it as: lvl %db(@itemnum, Req-lvl) instead of lvl 23, i'm still using the #WINDOW ID ::::: to stick stuff in the window |
|
|
|
|
|
|
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
|
|