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
bishopnenar
Beginner


Joined: 20 Mar 2007
Posts: 27

PostPosted: Mon Dec 31, 2007 4:11 pm   

Exporting Scripts
 
I see that XML is the oly option to export scripts out in. Is there anyway to get them to txt files? I looked at a few XML converters, and they either just clean up the file making it pretty or they are way over my head honestly. I just need a simple txt export like old Zmud. Any thoughts?
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Mon Dec 31, 2007 5:08 pm   
 
The short answer is another question: why? There's no way to export to text because some of the options in CMUD (like language options) don't convert to text. The text export in zMUD was also notoriously buggy, whereas the XML export in CMUD is pretty reliable. There's no easy way to export CMUD settings to text, but why would you want to?
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Mon Dec 31, 2007 6:22 pm   
 
The answer to that, Fang, is simple.

Not everyone understands nor can read xml format. For instance, it's easier for me to look at a code in text format than to try reading it from xml format. I understand/can read xml format, but truthfully, it hurts my eyes. :P But I also know of the functionality that xml serves for CMUD, and I can appreciate that. Nowadays, what I do (I don't mess with the language options much yet) is if I want to write a script, I'll write it in zMUD, export it, modify it for CMUD, then install it that way. Makes some things easier.

Charneus
Reply with quote
iljhar
GURU


Joined: 10 Oct 2000
Posts: 1116
Location: USA

PostPosted: Tue Jan 01, 2008 12:09 am   
 
I wouldn't mind seeing an export to text as well. The way I figure it, any part of a script should be able to be added from the command line. If that's true, then that means the ability to go from regular text to cMUD xml is there. I would then think it could be taken a little further to go from cMUD xml to regular text. But, if it isn't there now, I'm not sure how hard it would be to put it in, or if Zugg would even have the time to do it. One can only hope.
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Tue Jan 01, 2008 10:44 pm   
 
iljhar wrote:
any part of a script should be able to be added from the command line

Like I said in my original post, this isn't the case. The TINTIN-alike text format just doesn't allow you to reproduce all the options in a package file (for example, windows have lists of enabled packages, UIDs and connections and package files now contain preferences which need to be exported), hence the new XML export. It really isn't much (if any) harder to read than the script syntax, it's just that we're used to the old way. It takes some getting used to, I agree.

If text export could be added to CMUD, it'd need to be in a way that wasn't going to cause problems like the zMUD export used to. This might be possible since CMUD's now stricter about syntax, and if CMUD refuses to export anything that doesn't compile. But you'd have to accept that the text wouldn't reflect lots of the information in your package, which might lead to problems.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
bishopnenar
Beginner


Joined: 20 Mar 2007
Posts: 27

PostPosted: Fri Jan 04, 2008 10:53 pm   
 
Agreed to the above. When i want to look over several things, text is still eaiser. Or I want to post a script or something to my MID fourm, people can read text layout better then XML. It would just be a nice oprion to have.
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Mon Jan 07, 2008 10:46 pm   
 
Sorry, but not going to happen. As Fang has tried to explain, a plain Text format export would lose important values in CMUD that cannot be defined by the simple command line text format. There are lots of new options added to CMUD that cannot be represented by the plain text command line. Fang mentions many of them, but most new features added to CMUD that are not part of zMUD have this problem.

I spent a *lot* of effort in v2.x making the XML more human-readable, and that's about as much help as I can provide.
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Mon Jan 07, 2008 11:04 pm   
 
One thing that really helps me is opening XML files (or copying and pasting XML from the forums) into SciTE with the language set to XML. Its tag highlighting really helps to differentiate the script from the XML.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Guinn
Wizard


Joined: 03 Mar 2001
Posts: 1127
Location: London

PostPosted: Mon Jan 07, 2008 11:35 pm   
 
Could the default language be set to XML within the CMUD editor when you're viewing the XML tab?
It's based on Scintilla afterall, so surely fairly easy?
_________________
CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;)
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Tue Jan 08, 2008 12:01 am   
 
Actually, it already is. CMUD sets Scintilla to XML when in the XML tab, which allows it to do the syntax highlighting and tag folding just like you'd expect.
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Tue Jan 08, 2008 4:32 am   
 
One thing I've noticed about exporting to xml is that it doesn't seem to like record values very much. I'll export it to XML, but instead of

Code:
<var name="character" string="Record">gold=164913|level=111|Name=Charneus|align=1000</var>


it'll occasionally do:

Code:
<var name="g_Containers" type="String"><![CDATA[equip2.bagheal2.bagmisc3.testforsale2.testlevel14.testportals1.bag]]></var>


which... doesn't load anything up right. And yes, this is after I've made the database a database record. Any solution to that? Or could that be a bug?

Charneus

EDIT: Actually, I wind up either having to change it or delete the whole thing. :\
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Tue Jan 08, 2008 5:45 pm   
 
If you are getting an export in the second format, that means you have an old database record variable from an older version of CMUD that hasn't been converted to the newer hash table format. Notice that it says 'type="String"' instead of 'type="Record"'.
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Tue Jan 08, 2008 6:48 pm   
 
The first doesn't actually say type="Record", it says string="Record". I wonder if that's a typo on Charneus' part.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Tue Jan 08, 2008 7:27 pm   
 
I assumed it was a typo since I don't see any way for CMUD to show 'string="Record"'. But hopefully he'll reply and let us know for sure.
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Wed Jan 09, 2008 4:34 am   
 
Yeah, that was a typo on my part. I thought I had copied/pasted it, but I remember typing the first one. My fault. However, I remember that the above was created in 2.18, not any earlier versions. To test this out, I created a new database and exported the information. This is what I came out with after exporting it:

Code:
<var name="g_containers" type="Record"><![CDATA[equip2.bagheal2.bagmisc3.testforsale2.testlevel14.testportals1.bag]]></var>


I tried to import it on a new setting, and it returned: "File: <unknown> Line: 79 Col: 64 Error: Invalid XML Character found"

If that's not a bug with export, then I'm not sure what is. Unless there's another reason for it exporting it incorrectly.

Charneus
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Wed Jan 09, 2008 8:42 pm   
 
Can you give me the exact steps that you used to create this? The record that you show doesn't look like a proper database variable format since it doesn't have any "key=value" format. This might be specific to the database module which doesn't use the new hash-table record variable structure. But if you can give me the exact step-by-step procedure for creating a new database and getting this error then maybe I'll be able to fix it.
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Wed Jan 09, 2008 10:17 pm   
 
Actually, I found out the error myself. I was using a text file that I thought I had converted to XML to upload the settings, but I was using the older version. My apologies.

However, I did notice that unless the variable is changed to Type: Database manually, it'll output

Code:
 <var name="testvar2">economics=7|history=5|menu=2|file=1|math=4|list=3|english=6</var>


It works out the same, though. Just an inconsistency as opposed to a bug. :P

Charneus
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