Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
deathkitty
Apprentice


Joined: 14 Apr 2008
Posts: 105

PostPosted: Thu Jun 14, 2012 12:13 am   

[3.34 BUG] CMUD map link with object database for rooms
 
I'm trying to add items and characters and scripts to the object database for my map so they show in the Room Contents tab when I view the properties window of a room :(

What I did was:
1. View properties on a room
2. Click Room Contents tab (the four yellow squares together icon)
3. Clicked add, opened up the Database editor window and made a new database
4. Added fields then added to them with the Record tab then the New button at the top
5. Found out that nothing was happening when I selected the database record in the List tab then clicked at the top 'Actions' then 'Add To Room' (like the Map Properties' Room Contents tab says to, though that blurb says "from the database menu" which I could not find, I was guessing it may be out of date)
6. In the Database editor clicked 'Help' at the top and read in 'Advanced Database Usage' that the object database actually needs a field added manually for the Zone and Room name settings to work, and added these fields in my database and selected the special types. It worked when I selected Add To Room after that, it filled in the zone name and room number of the object :) BUT:
6. BUT: When I save the database close the window and look at the mapper, the list of objects in the room on the Room Contents tab is still empty. In the bottomleft of the room contents' window I notice it has the words "<my mudname> Map" (with my mudname there at the <>) and this is a clickable pull down list, I guess to select other databases? But the only other options are the session's name and "None". I think it might be an option for something else, I don't know. As far as I can see the map itself is a different type of database and can't be opened in the database editor for objects.

(if I do get this working, I am an imm on this mud and I'd quite like to get the mobs and scripts to show in a room contents too, but I'm not sure how to do this without a lot of spam to scroll through of empty fields etc since the fields that mobs and scripts have are different, and like with objects often have multiple lines of text especially room/object scripts)

Thank you for any help :)
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Thu Jun 14, 2012 1:28 pm   
 
You are correct that the map itself is a completely different type of database. The map (and in fact many other things in Cmud) are sqlite databases. The internal "database" that is retained to be backward compatible with Cmud is not even a true database; it is more like a limited spreadsheet. This old database is extremely hard to use, and very limited in capability. A complete replacement of this old database has always been on the TODO list for Cmud, but was a low priority. Now that there are some new Cmud commands that can interact with SQL databases, a proper replacement may never happen.

I'm afraid I don't have any solution for your specific problem. Perhaps someone else does.

However, I can tell you what I have done as an alternative. I put information like this into the map with %roomflags(). I believe this is displayed in the "Userstr" field in the room properties, but that isn't a convenient interface for doing what I want. The %roomflags() function can actually enter a database variable into this field! It will store it as a json string. So I copy the current %roomflags() into a variable, use %addkey() to add whatever key/value pairs I want, and put the revised variable into %roomflags() again. Since database variables can now have multiple levels, I can give it a string like:

objects="pile of garbage|sickly yellow puddle"|mobs="rat|rat|mangy dog"|roomsize="very large"|notes="Poke the garbage to get more rats|Don't drink the puddle"
(note: it wouldn't be formatted quite like this in the db variable, this is just an example)

If I want, I can use an onRoomEnter event to grab the %roomflags and display it in a fancy format in a separate window with #WINDOW.
Reply with quote
deathkitty
Apprentice


Joined: 14 Apr 2008
Posts: 105

PostPosted: Fri Jun 15, 2012 1:05 am   
 
That is not good for me, I am an imm and trying to make a database of the objects WITH the rooms, not just 'what objects are in what room' - the point of using the database is so I can store all the fields about the object too like short name, long name, weight, affects, the same with the detailed stats on characters/mobs(multiple line descriptions!) and scripts(multiple lines!) etc etc :(

The Add Object to room when you view the properties of a room and go to Room Contents seems like such a good system if it were to work, and like I said it does detect where the map is set to when I set an object to be in the room selected in the DB editor ... but for some reason it just won't update the Room Contents from where I clicked to add an object :(





oh by the way, I already capture room flags and vnums
Quote:
[ 1] Limbo [ DARK INDOORS PEACEFUL CAN-LAND ] [City]
You are floating in a formless void, detached from all sensation of physical
matter, surrounded by swirling glowing light, which fades into the relative
darkness around you without any trace of edges or shadow.
There is a "No Tipping" notice pinned to the darkness.
[ Exits: None! ]


but I can't get tag to work for some reason so have been using trigger pattern:
Code:
~[{|%s}(%d)~] (*) ~[ (*) ~] ~[(*)~]$

with
Code:
#map set %roomnum(,%1)
#map set %roomname(,%2)
#map set %roomflags(,%3 ~[%4~])


(roomnum is for vnums NOT roomvnum, that was confusing, thank you help files lol)

and I tried using #tag vnum %1
#tag name %2
but they just did not do anything, the name wasn't being detected even when I set the map properties to tick the room name box and set to line 0 paragraph 0 manually, just nothing, only #map set seems to help (I tried reconfigure map several times too)
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: Fri Jun 15, 2012 3:35 pm   
 
I think you want #call %roomnum(,%1), etc. As far as I know, #map set does nothing - it's not mentioned in the documentation anyway.
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Fri Jun 15, 2012 6:14 pm   
 
You do need to reconfigure the mapper after you create #TAG triggers, but you say you've done that. In addition, tagging only affects mapping. The mapper worries about #TAG commands only when it is creating a new room, or when you use the #LOOK command in an existing room, and in either case only when the mapper is in Mapping mode.

#MAP is a valid command, but it is used to create Paths, not to change values in the map. Essentially, what you were doing is adding the command "set" to your current Path, and incidentally also executing the %roomnum() function. Daern is correct that the way to set mapper values is to #CALL the appropriate map function, or some syntax where you make use of the return value. Also, note that "%roomnum(,%1)" will affect the room which is your current Location, not the currently selected room(s). To change the value of a room other than your current location, you have to specify the room number as the first parameter.

As for the the database problem, I wish I could help. I suspect that very few of the experienced Cmudders are still using it--it's ancient code, very creaky, and extremely limited in capability. If anyone else remembers the Zmud database, I hope they can speak up.

Perhaps you could use sqlite to create your database of objects. That way you have all the advantages of a proper relational database for creating your fields and cross-references. You can read and modify an sqlite database in Cmud with the %sql() command. You can store the keys for objects in a room with %roomflags, and have it automatically displayed in a window in the manner I suggested before.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sat Jun 16, 2012 12:11 am   
 
Quote:

(roomnum is for vnums NOT roomvnum, that was confusing, thank you help files lol)


Actually, the helpfiles are correct. %roomnum() will display either the room key or the room vnum, based on the current value of %roommode(). %roomkey() ALWAYS displays the room's key value (in other words, the number of the record when it was inserted into the map database...other than this function and the mouseover hint in the mapper window, this number is not exposed to the user). %roomvnum() ALWAYS displays the room vnum, which is the number you see in the Other Properties tab (upper left, it has a label of "VNum:") of the Room Properties window.

When a room is created or updated, if there's no detected vnum value then the vnum field is given the room key value. This is the source of any confusion surrounding these functions and their helpfiles.
_________________
EDIT: I didn't like my old signature
Reply with quote
deathkitty
Apprentice


Joined: 14 Apr 2008
Posts: 105

PostPosted: Sat Jun 16, 2012 12:30 am   
 
MattLofton: Oh but like I said I did actually try %roomvnum before and it did not change the vnum of the room (in the room properties window when you view the properties of a room on the map, on the Other Properties, yeah, I know %roomid is the shortname/id) but %roomnum definitely works

Rahab wrote:
You do need to reconfigure the mapper after you create #TAG triggers, but you say you've done that. In addition, tagging only affects mapping. The mapper worries about #TAG commands only when it is creating a new room, or when you use the #LOOK command in an existing room, and in either case only when the mapper is in Mapping mode.
yeah that's what i was doing, i even deleted rooms that I had filled in without roomflags on (it captures it ok in normal mode with just the Room Name then description lines next paragraph then [ Exits : S W ] etc) and remade them to test and it was still not getting the room names with #TAG, when I went into the mapper manually and turned room names on even it started missing the first line of the description off too for some reason?


















Daern wrote:
I think you want #call %roomnum(,%1), etc.
Rahab wrote:
Daern is correct that the way to set mapper values is to #CALL the appropriate map function, or some syntax where you make use of the return value.
oh, thanks both then

Rahab wrote:
Perhaps you could use sqlite to create your database of objects. That way you have all the advantages of a proper relational database for creating your fields and cross-references. You can read and modify an sqlite database in Cmud with the %sql() command. You can store the keys for objects in a room with %roomflags, and have it automatically displayed in a window in the manner I suggested before.
is there no interface for it like with the normal database? I mean when I click on the Properties of a room then Room Contents, the normal database thing is what comes up when I click Add something to the room, there is not even mention or any clues as to how to select any other database to load for the Map's objects

I don't want to do it automatically because the mud output is really too long to capture automatically, and it's definitely not stuff I could fit in just one line I need to use a proper database with fields and stuff, and objects and characters(mobs) can be in multiple rooms and scripts can be attached to multiple objects... so yeah :(

Click Image to Enlarge Image Hosting

To give you an example this is what the object editor in the MUD looks like:
Quote:

oedit <redacted>

-- Item number : [<redacted>]
1) Namelist : fountain water lion
2) S-Desc : a large marble fountain
3) L-Desc :-
A large marble fountain of unworldly beauty, sits at the center of this room.
4) A-Desc :-
undefined
5) Type : FOUNTAIN
6) Extra flags : NOBITS
7) Wear flags : NOBITS
8) Weight : 505
9) Cost : 0
B) Class Only : NOBITS
T) Timer : 0
C) Affects : NOBITS
D) Values : <redacted> <redacted> 0 0 0 0 0 0
E) Applies menu
F) Extra descriptions menu
L) Levels : 0 0
S) Scripts : 1201
Q) Quit
Enter choice :


F

-- Extra desc menu
1) Keyword: <NONE>
2) Description:
<NONE>
3) Goto next description: <Not set>
0) Quit
Enter choice :


The character/NPC/mob editor:
Quote:

medit 1

-- Mob Number: [1]
1) Sex: Female 2) Alias: puff marine fractal
3) S-Desc: Puff
4) L-Desc:-
Puff the Fractal Marine is here, comtemplating how to kill you.
5) D-Desc:-
This marine never tries to kill anyone, she just thinks about how to do
it. She also ponders her past life as a dragon. Odd huh?
6) Skill Level: [ 100] 7) Race: [ Oth]
8) Hitroll: [ 19] 9) Damroll: [ 3]
A) NumDamDice: [ 30] B) SizeDamDice: [ 127]
E) HP Bonus: [ 8000] F) Armor Absorb: [ 999]
Min MP: [ 12] Max MP: [ 40]
G) Attributes:
Agl [100] Sta [100] Str [100] Qui [ 10]
Per [100] Int [100] Ess [6.00]
H) Clan : 0 (None)
I) Position : Standing
J) Default : Standing
K) Attack : blast
L) NPC Flags : SENTINEL ISNPC !ASSIST !BASH !BLIND !SHOOT PROG-MOB
M) AFF Flags : SENSE-LIFE SANCT SLEEP TRACKING VACUUM-SAFE
O) Opinions Menu
S) Scripts : None
Q) Quit



scripts (can be added on any room, object or character/mob):
Quote:

scriptedit 1201

-- Trig Number: [1201]
1) Script Name : Fountain Script
2) Script Class: Object Script
3) Triggers : Random
4) Arg : <NONE>
5) Num Arg : 1
6) Script (First 10 lines)
-----------------------
echo %self.shortdesc% flows gently before you, splashing small droplets.
asound You hear the gentle sounds of running water from nearby.
wait 2
asound You suddenly feel at peace with all things.
echo You suddenly feel more at peace with the outside world.

Q) Quit
Enter choice :


room settings:
Quote:

redit 1
-- Room number : [1] Room zone: [0]
1) Name : Limbo
2) Description :
You are floating in a formless void, detached from all sensation of physical
matter, surrounded by swirling glowing light, which fades into the relative
darkness around you without any trace of edges or shadow.
There is a "No Tipping" notice pinned to the darkness.
3) Room flags : DARK INDOORS PEACEFUL CAN-LAND
4) Sector type : City
5) Exit north : -1
6) Exit east : -1
7) Exit south : -1
8) Exit west : -1
9) Exit up : -1
A) Exit down : -1
B) Extra descriptions menu
Q) Quit
Enter choice :


zone settings (the what loads in the room is actually separate for each room like the room settings):
Quote:

zedit 1

Room number: 1 Room zone: 0
Z) Zone name : Limbo - Internal
L) Lifespan : 30 minutes
T) Top of zone : 99
R) Reset Mode : Never reset
O) Owner : NONE
C) Cap Reward : 0
[Command list]
0 - Load Puff [1], Max : 1
1 - Remove a shimmering portal [1500] from room.
2 - then Load a shimmering portal [1500]
3 - <END OF LIST>
N) New command.
E) Edit a command.
D) Delete a command.
Q) Quit


zone stats:
Quote:

zstat 0

Zone # : 0 Name : Limbo - Internal
Owner : NONE Holder : NONE
Reward : 0 Hived Rooms : 1 /266 [ 0%]
Minimum MP : 0 Maximum MP : 0
Age/Lifespan: 0 / 30 Top vnum : 99
Planet : Limbo
Reset mode : Never resets
Builders : NONE


so yeah I pretty much add stuff in manually at the moment only for important stuff, it would be cool if there was a way to automate saving it tho so all taht stuff could be saved and link to each other when the same mob is in multiple rooms, same object held by multiple mobs, a bunch of rooms all under the same zone settings etc

the reason I am doing this is because I am hoping a database made in CMUD would be a lot less awkward for browsing through than the game where you have to lookup each item individually pressing numbers to select etc, and make it more accessible for writers rather than just programmy people to add to stuff, maybe even after everything is converted into a database then it could be easier to convert it onto a wiki or something for builders to write room descriptions and such collaboratively - I think more MUDs should do that really (since a lot of programmy type people have terrible spelling and grammar and aren't all that good at creative writing but often have their ego tell them they are, lol :) the polyglots are a bit rarer, it would be nice not to bring in more creative people I know that sometimes can be great writers but not even be able to figure out how to write a blog without help hehe) but of course it's so awkward converting between MUD to database and all these different formats
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Sun Jun 17, 2012 12:11 am   
 
No, I'm afraid there isn't any way to have an external database interact with the mapper the way the old internal database does with the room contents field. As I said, you would have to write your own code to do that. However, if you did, you would have access to a full relational database which is much better than the internal database, and can actually store all those relationships between objects, rooms, and mobs. It would take a fair amount of work but would not be technically difficult to write Cmud code to grab all of that mud output you describe and enter it into the database. I regularly grab similar amounts of data. You could write aliases to add objects to rooms and mobs, and even to edit the data and search for objects in the database. You could put all of your code into a package that you share with the other coders. But no, there isn't anything already in Cmud to do that for you with an external database, just the tools to do it yourself. And the internal database can't do most of what you want, even if you solved the particular problem you are having. It can't do relationships.
Reply with quote
deathkitty
Apprentice


Joined: 14 Apr 2008
Posts: 105

PostPosted: Sun Jun 17, 2012 3:55 am   
 
bleh I'm not a programmer :( I just write stuff, that's a big motivation to trying to get MUD contents more accessible to non-techy types to contribute to, because I know of quite a few good writers who are a lot worse than me (as I mentioned on the last paragraph) :(
Reply with quote
deathkitty
Apprentice


Joined: 14 Apr 2008
Posts: 105

PostPosted: Fri Jun 22, 2012 11:01 am   
 
:(
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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

© 2009 Zugg Software. Hosted by Wolfpaw.net