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
eupher
Apprentice


Joined: 18 Jan 2001
Posts: 116
Location: USA

PostPosted: Sun Sep 18, 2011 8:52 pm   

Editing multi-line text in an external database record
 
Hi,
I've got a script to log all identify output to a sqlite database. I'd like to set something up so users can add/edit notes about items in the database from within cmud. The notes might be multiple lines. I can read multi-line fields into variables in cmud, but I'm not sure how to offer them up for editing. Is there a way to accomplish this?

Thanks in advance,
John
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Mon Sep 19, 2011 7:44 am   
 
There is, of course, but it will take quite a bit of scripting on your part. As long as you're storing the lines in an accessible format though, then you should be able to add, delete them, and change them at will. I'm not exactly sure where you feel you're stumbling? Such a project may be a bit tedious, but certainly not beyond your abilities if you've established what you've mentioned you have thus far.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
eupher
Apprentice


Joined: 18 Jan 2001
Posts: 116
Location: USA

PostPosted: Mon Sep 19, 2011 4:30 pm   
 
I'm willing to deal with a bit of tedious scripting on my part, but I'd like to avoid a tedious interface for the end users. I'm hoping to find some way to do something like open an editor window with all the text inside, let the user change the text, and click a button when they are done... kind of like you can prompt for the value of a variable. Is something like that possible, or am I looking at the kind of interface where you have a command to show the current value with line numbers and then have aliases for the user to add/replace/delete lines by number? That would be.... unfortunate. :)

Thanks again!
Reply with quote
eupher
Apprentice


Joined: 18 Jan 2001
Posts: 116
Location: USA

PostPosted: Wed Sep 21, 2011 2:46 pm   
 
Based on the lack of responses, I'm moving forward assuming that I can't do what I wanted... I'm now entering note data for items in my database using a separate sqlite client. I have now run into another issue. I'd still like to display the note data within cmud, but when I query the database and #ECHO the note field to the screen it shows the data all on one line. The carriage returns are stripped out. Is there any way to solve this?

Sample data:

This is the first line of notes...
and this is the second.

Sample output from #SHOW $row.Item("roomNotes")

This is the firstline of notes...and this is the second.

Thanks again for any help.
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Fri Sep 23, 2011 7:16 pm   
 
There really isn't an easy way to include carriage returns in a variable value that will display well. One option would be to replace all carriage returns with some tag you make up before storing it to the database, and replacing the tag with %cr in your display code.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Fri Sep 23, 2011 7:27 pm   
 
Make your variable a stringlist wherein each line is an element of said list. When it's time to display, you can then use %expandlist() or %replace().
_________________
EDIT: I didn't like my old signature
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Fri Sep 23, 2011 7:39 pm   
 
I considered suggesting that, but the data is coming from a Cmud database. I don't think you can store a stringlist in that, can you?
Reply with quote
eupher
Apprentice


Joined: 18 Jan 2001
Posts: 116
Location: USA

PostPosted: Fri Sep 23, 2011 8:55 pm   
 
It's data in a sqlite database, which doesn't support stringlists. I guess I can put tags in the text columns of my sqlite database, but that'll be kind of ugly. It seems like cmud should be able to handle carriage returns in external data. If I create a variable within cmud and put carriage returns in it, then #ECHO displays the contents of the variable correctly...

Thanks again.
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