|
Pail Newbie
Joined: 30 Jan 2022 Posts: 1 Location: Canada
|
Posted: Sun Jan 30, 2022 5:50 pm
Database Scripting for a Beginner |
Hi all,
Been mudding for over 20 years, but have only ever made use of a tintin client and very basic aliases/triggers during that time. Just started a new mud, and decided to download cmud and get a more feature-rich experience with scripting (hopefully).
I had decided I wanted to make an item/equipment database for the new mud I'm on, only to realize that manual entry into the native cmud database is an absolute drag. Plus, I have no idea how to query it and display it in the mud, no idea how to capture info and transfer it automatically into the database from the mud, no idea how to even set up the database properly with whatever table information I need to capture, no idea about anything really.
So, I went down the rabbit hole of googling and looking through forum posts here for several hours, only to find that almost everything is over my head.
Here is what I was able to "figure out", based on reading this forum and google:
- The native database in cmud isn't recommended
- SQLite use is potentially the way to go
- I've heard of something called dbvar (don't understand it, alternative to sqlite?)
- I downloaded the SQLite tools for windows from this site https://www.sqlite.org/download.html
- I installed DB Browser for SQLite from here https://sqlitebrowser.org/dl/
And that's about it. I don't really know where to begin from there or if I am even on the right track.
Ultimately, I want to be able to capture identify info for my eq from the mud and send it into a database using triggers, and also be able to query from the database and display into the mud using aliases.
I know this is the dream for many an aspiring mud scripter, but if you could help a beginner like me, I'd really appreciate it. (I promise I tried to educate myself via the forums but like I said, everything is over my head. I need it explained like I'm 8 years old or something).
Thanks for your time |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4691 Location: Pensacola, FL, USA
|
Posted: Mon Jan 31, 2022 9:26 pm |
If you are willing to try something new, I find the database variables much easier to work with.
These two commands will pull up the helpfiles to give you a basic understanding of how they are used:
#HELP #ADDKEY
#HELP %db
Here is an example of an alias I use to determine name length frequency:
Code: |
#LOCAL $DB
#FOR @everybody {
$key=%len( %i)
$this=%db( $DB, $key)
$this=($this+1)
#ADDKEY $DB $key $this
}
#SHOWDB %sort( $DB) |
And the output is:
Code: |
10: 30
11: 11
12: 6
3: 99
4: 340
5: 724
6: 743
7: 514
8: 241
9: 134 |
|
|
_________________ Discord: Shalimarwildcat |
|
|
|
hpoonis2010 Adept
Joined: 18 Jun 2019 Posts: 279
|
Posted: Tue Feb 01, 2022 2:33 pm |
umm...Mr Shalimar... #FOR?
The DBBrowser (SQLLite) is useful for searching through the raw session.dbm file (whatever your mud session is called), and making rudimentary changes if necessary. Obviously, it requires a knowledge of SQL to some degree, but it is (more or less) a GUI and can be worked by a novice. I use it more often to find rooms with odd exits - specifically -1 and manually run down the list deleting spuriosu entries.
As for the DBVAR scenario, you can think of it as an unstructured database (a bit like Hadoop). They are quite useful once you get the hang of them. They are termed key-value items but you can also think of it as recordname-data. Where data can be a single piece of data or another 'record'.
I only use the DB module if I want to dump dbvar data to a file...for backup (although I use backup software to copy the entire cmud structure). It (DB module) has no real function has no real application within your MUD session and, because it has its own dialogue windows (as every major portion of cmud) it is prone to causing headaches. |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4691 Location: Pensacola, FL, USA
|
Posted: Fri Feb 18, 2022 12:12 pm |
Why not #FORALL?
|
|
_________________ Discord: Shalimarwildcat |
|
|
|
|
|
|
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
|
|