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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » Finished MUD Scripts
Leitia
Adept


Joined: 04 May 2007
Posts: 292
Location: Boston

PostPosted: Sat Feb 02, 2008 10:46 pm   

Notebook
 
From time to time I have wanted this over the years, pasting text into notepads, variables, making show alias and such for 'at the moment' situations. I finally wrote a db to show notes. It is not fancy, no titles, and you can only delete and add. The last note entered remains active till you end it.

What: A Notebook
Why: To jot notes with directions or things I want to remember right now.

Commands:

NOTE Displays last note
NOTE ALL Displays the db
NOTE DELETE COMMENT# Deletes comment number - Sets last note focus to previous entry, END to quit that
NOTE END Readies to start a new note

tip; to clear the DB, spam - delete comment1

This is an alias named Note. It will create a folder as such named Notebook, you could move it there, I just tried a new color that doesn't look right, but you can deal if you like this thing

sorry, just fixed a bug and removed and added a format statement, please don’t fault me, I am trying



Code:

#class Notebook
#if (%lower( "%-1")="end") {#delkey PRH_Notable Noted} {
  #if (1 = %numkeys( @PRH_Notable) and %iskey( @PRH_Notable, noted)) {#var PRH_Notable ""}
  #if (%1) {
    #if (%lower( %-1) = "all") {
      #if (%numkeys( @PRH_Notable)) {
        #sh " "
        #sh %format( "          &-16s", Notes:)
        #co lightcoral
        #sh %format( "          &10s", "---------------------------------------------------------------")
        #co lightcoral
        #loopdb @PRH_Notable {
          #sh " "
          #if (%key != "noted") {
            #sh %format( "          &-16s", %key)
            #co lightcoral
            #sh " "
            #forall %val {
              #if (%isnumber( %trim( %i))) {#sh %format( "          &-16.0f", %i)} {#sh %format( "          &-16s", %i)}
              #co Palegoldenrod
              }
            #sh %format( "          &10s", "---------------------------------------------------------------")
            #co lightcoral
            }
          }
        } {
        #sh %format( "          &-16s", No notes.)
        #co lightcoral
        #sh " "
        }
      } {
      #if (%lower( %1) = "delete") {
        #if (%iskey( @PRH_Notable, %2)) {
          #delkey PRH_Notable %2
          #loopdb @PRH_Notable {#addkey prh_workingtemp %concat( comment, %eval( %numkeys( @prh_workingtemp) + 1)) %val}
          #if (%db( @prh_workingtemp, %concat( comment, %numkeys( @prh_workingtemp))) = 1) {
            #delkey prh_workingtemp %concat( comment, %numkeys( @prh_workingtemp))
            #addkey prh_workingtemp noted 1
            }
          #var PRH_Notable @prh_workingtemp
          #unvar prh_workingtemp
          #sh %format( "          &-10s", Deleted)
          #co lightcoral
          #sh " "
          }
        } {
        #var PRH_NoteReq %replace( "%-1", ",", "-")
        #if (@PRH_Notable.noted) {
          #delkey PRH_Notable noted
          #var PRH_NoteCurrent %db( @PRH_Notable, %concat( comment, %numkeys( @PRH_Notable)))
          #if (%iskey( @PRH_Notable, %concat( comment, %numkeys( @PRH_Notable)))) {
            #addkey PRH_Notable %concat( comment, %numkeys( @PRH_Notable)) %concat( @PRH_NoteCurrent, "|", @prh_notereq)
            #sh %format( "          &-10s", OK)
            #co lightcoral
            #sh " "
            } {
            #addkey PRH_Notable %concat( comment, %eval( %numkeys( @PRH_Notable) + 1)) @prh_notereq
            #sh %format( "          &-10s", OK)
            #co lightcoral
            #sh " "
            }
          #addkey PRH_Notable noted 1
          } {
          #addkey PRH_Notable %concat( comment, %eval( %numkeys( @PRH_Notable) + 1)) @prh_notereq
          #addkey PRH_Notable noted 1
          #sh %format( "          &-10s", OK)
          #co lightcoral
          #sh " "
          }
        }
      }
    } {
    #sh " "
    #if (%numkeys( @PRH_Notable)) {
      #if (%iskey( @PRH_Notable, noted)) {#var PRH_LastNote %concat( comment, %eval( %numkeys( @PRH_Notable)-1))} {#var PRH_LastNote %concat( comment, %numkeys( @PRH_Notable))}
      #sh %format( "          &-16s &10s", Last Note:, ~(@PRH_LastNote~))
      #co lightcoral
      #sh %format( "          &10s", "---------------------------------------------------------------")
      #co lightcoral
      #sh " "
      #forall %db( @PRH_Notable, @PRH_LastNote) {
        #if (%isnumber( %trim( %i))) {#sh %format( "          &-16.0f", %i)} {#sh %format( "          &-16s", %i)}
        #co Palegoldenrod
        }
      #sh %format( "          &10s", "---------------------------------------------------------------")
      #co lightcoral
      #sh " "
      } {
      #sh %format( "          &-16s", No notes.)
      #co lightcoral
      #sh " "
      }
    #unvar PRH_LastNote
    }
  #unvar PRH_NoteReq
  #unvar PRH_NoteCurrent
  }
#class 0


export:

Code:

#ALIAS note {#class Notebook;#if (%lower( "%-1")="end") {#delkey PRH_Notable Noted} {#if (1 = %numkeys( @PRH_Notable) and %iskey( @PRH_Notable, noted)) {#var PRH_Notable ""};#if (%1) {#if (%lower( %-1) = "all") {#if (%numkeys( @PRH_Notable)) {#sh " ";#sh %format( "          &-16s", Notes:);#co lightcoral;#sh %format( "          &10s", "---------------------------------------------------------------");#co lightcoral;#loopdb @PRH_Notable {#sh " ";#if (%key != "noted") {#sh %format( "          &-16s", %key);#co lightcoral;#sh " ";#forall %val {#if (%isnumber( %trim( %i))) {#sh %format( "          &-16.0f", %i)} {#sh %format( "          &-16s", %i)};#co Palegoldenrod};#sh %format( "          &10s", "---------------------------------------------------------------");#co lightcoral}}} {#sh %format( "          &-16s", No notes.);#co lightcoral;#sh " "}} {#if (%lower( %1) = "delete") {#if (%iskey( @PRH_Notable, %2)) {#delkey PRH_Notable %2;#loopdb @PRH_Notable {#addkey prh_workingtemp %concat( comment, %eval( %numkeys( @prh_workingtemp) + 1)) %val};#if (%db( @prh_workingtemp, %concat( comment, %numkeys( @prh_workingtemp))) = 1) {#delkey prh_workingtemp %concat( comment, %numkeys( @prh_workingtemp));#addkey prh_workingtemp noted 1};#var PRH_Notable @prh_workingtemp;#unvar prh_workingtemp;#sh %format( "          &-10s", Deleted);#co lightcoral;#sh " "}} {#var PRH_NoteReq %replace( "%-1", ",", "-");#if (@PRH_Notable.noted) {#delkey PRH_Notable noted;#var PRH_NoteCurrent %db( @PRH_Notable, %concat( comment, %numkeys( @PRH_Notable)));#if (%iskey( @PRH_Notable, %concat( comment, %numkeys( @PRH_Notable)))) {#addkey PRH_Notable %concat( comment, %numkeys( @PRH_Notable)) %concat( @PRH_NoteCurrent, "|", @prh_notereq);#sh %format( "          &-10s", OK);#co lightcoral;#sh " "} {#addkey PRH_Notable %concat( comment, %eval( %numkeys( @PRH_Notable) + 1)) @prh_notereq;#sh %format( "          &-10s", OK);#co lightcoral;#sh " "};#addkey PRH_Notable noted 1} {#addkey PRH_Notable %concat( comment, %eval( %numkeys( @PRH_Notable) + 1)) @prh_notereq;#addkey PRH_Notable noted 1;#sh %format( "          &-10s", OK);#co lightcoral;#sh " "}}}} {#sh " ";#if (%numkeys( @PRH_Notable)) {#if (%iskey( @PRH_Notable, noted)) {#var PRH_LastNote %concat( comment, %eval( %numkeys( @PRH_Notable)-1))} {#var PRH_LastNote %concat( comment, %numkeys( @PRH_Notable))};#sh %format( "          &-16s &10s", Last Note:, ~(@PRH_LastNote~));#co lightcoral;#sh %format( "          &10s", "---------------------------------------------------------------");#co lightcoral;#sh " ";#forall %db( @PRH_Notable, @PRH_LastNote) {#if (%isnumber( %trim( %i))) {#sh %format( "          &-16.0f", %i)} {#sh %format( "          &-16s", %i)};#co Palegoldenrod};#sh %format( "          &10s", "---------------------------------------------------------------");#co lightcoral;#sh " "} {#sh %format( "          &-16s", No notes.);#co lightcoral;#sh " "};#unvar PRH_LastNote};#unvar PRH_NoteReq;#unvar PRH_NoteCurrent};#class 0}


Last edited by Leitia on Sun Feb 03, 2008 1:43 am; edited 4 times in total
Reply with quote
Leitia
Adept


Joined: 04 May 2007
Posts: 292
Location: Boston

PostPosted: Sun Feb 03, 2008 12:11 am   
 
Oh if you got this script before the format( " &16s... wouldn't show single numbers. I took it out. The script was re done from a suite I am coding, just for upload here, why I had them in there was out of habit, but now I think that formats are not needed
Reply with quote
Leitia
Adept


Joined: 04 May 2007
Posts: 292
Location: Boston

PostPosted: Sun Feb 03, 2008 12:19 am   
 
Had a difficult time with that. I learned %trim cures a false %isnumber which allowed me to reinsert the format with an #if. I seem to remember format allows multi-lines to be colored. I hope so, anyway it should be fine. Odd characters make it freak out, like unclosed parenthesis, I tried using char, quotes, pos and replace but had no luck
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Sun Feb 03, 2008 1:12 am   
 
The easy answer, of course, is to refrain from using special characters.

I should probably upload something similar to CMUD's package library. The premise was to keep PK notes on players (ie, what they'd done to make me PK them in case I was asked about it later) but it expanded into general notes about them and from there into pretty much anything I liked by adding players that didn't exist like "shopping" and "general".

The idea, basically, is to end up with a table that looks like this:

Code:
PKInfo = { Harold   = { { 2352352532, "Some notes about something Harold did"},
                        { 2323526656, "Something Harold did a bit later"}
                      }
           Shopping = { { 2523525225, "Buy more cheesecake"} }
         }


Where the numbers are time codes (seconds from 1970 or whatever). The alias part would just add entries, and you could also have some events added automatically (like you killing Harold, or Harold killing you).
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Leitia
Adept


Joined: 04 May 2007
Posts: 292
Location: Boston

PostPosted: Sun Feb 03, 2008 2:17 am   
 
I have thought to table player notes at other times, though have had too much back coding to do. Actually I don't play so much as entertain myself with little code puzzles, but this script actually is a tacked on note which presents or pushes back with data on customers, like, this guy would not take less then 29k gold as discount so left, or some personal insight or compliment I can give them in the first slot. Not really entailed. Your idea is of course better, but as I didn't have anything like that I put this up for others like me. I would use it as those times like, some guy is telling me things I will have to grep the log for. Would love to be 'one upped'. This is specific to my scripts and in this case still useful against a better one. Though all improvement is good.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » Finished MUD Scripts 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