|
murklin Newbie
Joined: 01 Apr 2009 Posts: 7
|
Posted: Wed Apr 01, 2009 6:43 am
Newbie Variable Question |
So I read through the variable guide and it's extremely brief, so I figured this would be a better place to ask.
1) Why are the only temporary variables people use with letters seeming to be s d w and i? is there any difference between these and numbered temp variables? eg, %1, %2 etc.
2) Which temp variable would be used best in a situation like : Joe tells you 'Bardswords are made out of Silver and are worth 10 gold.'
I'm trying to add these to a database and it's not working too well. Right now I was trying it as:
Code: |
Joe tells you '(%1) are made out of (%2) and are worth (%3) gold.'
would then
#PUTDB 1 {Weapon=%1|Material=%2|Value=%3}
|
any help with this? it's not triggering off of the tell and variables are just escaping me |
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Wed Apr 01, 2009 7:51 am |
First of all, you don't want to put %# in your trigger pattern.
Second, not sure where you're getting the %i from, or what you mean by temporary variables. %s, %d, %w and others all have specific functions. For instance, %s matches any number of spaces. %w matches any word. %d is any number of digits without a comma, whereas %n is any number of digits, including commas. There's %x, which matches any number of non-whitespace (A-Z,1-9,punctuation, etc. No spaces) as well.
Lastly, #PUTDB is not a command, which is probably why it's not working correctly for you. You're better off doing something like this:
#TRIGGER {Joe tells you '(%w) are made out of (%w) and are worth (%d) gold.'} {#NEW {Weapon=%1|Material=%2|Value=%3}}
Read up on Pattern Matching.
Charneus |
|
|
|
murklin Newbie
Joined: 01 Apr 2009 Posts: 7
|
Posted: Wed Apr 01, 2009 10:46 am |
Quote: |
DBPUT
Syntax: #DBPUT database-rec value-list
Related: #DBGET
Saves new data to an existing database record. database-rec is the record number to set, with the optional two-character database name appended to it. The value-list is either a database variable, or a series of field names and values for the fields, or of th format "Name1=Value1|Name2=Value2|etc"
DBPUT Examples
#DBPUT 20eq @NewItem
Saves the NewItem database variable into record 20 of the equipment database
#DBPUT 20eq %dbget(21eq)
Copies record 21 of the equipment database over record 20 of the equipment database
#DBPUT 20eq %rec
Sets record 20 of the equipment database to the value of the current database record
#DBPUT 20 Name Zugg Class Warrior
sets the Name and Class fields of record 20 to Zugg and Warrior respectively
#DBPUT 20 {Name=Zugg|Class=Warrior}
sets the Name and Class fields of record 20 to Zugg and Warrior respectively |
that's what I get when I #help DBPUT
either way I tried it with #new real quick and still not working. thanks for that link it seems way more indepth than the built in help files. i'll have to read into that |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Wed Apr 01, 2009 2:51 pm |
Murklin, just so you know that link is to the online version of the help files, but should be available directly in CMUD as well.
Go to Help -> Contents to bring up the Help Window. There you can search for what you're looking for for example "Pattern Matching" or "DBPUT". Even more it's updateable so if you've had CMUD for a while you may click 'Get Updates' to get the latest tweaks, additions and clarifications to the help files. |
|
_________________ Asati di tempari! |
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Wed Apr 01, 2009 5:20 pm |
murklin wrote: |
Quote: |
DBPUT
Syntax: #DBPUT database-rec value-list
Related: #DBGET
Saves new data to an existing database record. database-rec is the record number to set, with the optional two-character database name appended to it. The value-list is either a database variable, or a series of field names and values for the fields, or of th format "Name1=Value1|Name2=Value2|etc"
DBPUT Examples
#DBPUT 20eq @NewItem
Saves the NewItem database variable into record 20 of the equipment database
#DBPUT 20eq %dbget(21eq)
Copies record 21 of the equipment database over record 20 of the equipment database
#DBPUT 20eq %rec
Sets record 20 of the equipment database to the value of the current database record
#DBPUT 20 Name Zugg Class Warrior
sets the Name and Class fields of record 20 to Zugg and Warrior respectively
#DBPUT 20 {Name=Zugg|Class=Warrior}
sets the Name and Class fields of record 20 to Zugg and Warrior respectively |
that's what I get when I #help DBPUT
either way I tried it with #new real quick and still not working. thanks for that link it seems way more indepth than the built in help files. i'll have to read into that |
Yeah, but in your example, you used 'PUTDB' and not 'DBPUT', so I wasn't sure if that was a typo or if that was what you really thought it was.
In any case, #NEW is a much better way to add new information to a database. #DBPUT is really used to change information in the database. For example, if I had an item in record 15 of my eq database that had a name of "A long, silver broadsword" and later on, the name changed but everything else is the same, I would use:
#DBPUT 15eq {Name="A golden longsword"}
I hope this clears things up a bit.
Charneus
By the way, Tech: He's using zMUD, not CMUD. ;) |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Wed Apr 01, 2009 8:07 pm |
Doh!!! It seems like I'm doing that once a month now. I was already groggy headed, but these days CMUD seems like such the obvious choice I forgot to check for the forum topic. Thanks for the catch.
|
|
_________________ Asati di tempari! |
|
|
|
|
|
|
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
|
|