Kisa Flexible Lists

From Tenebrae
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

This code was designed because I (Kisaiya) am terrible at keeping track of what items I need to buy for my character(s). So, I wrote a code to keep it all organized! You can use this though, for lists of any type!

Big thanks to Whiteout for the hep with the code!

Examples

Quick References

+mynotes
Kisaiya's Ability Notes! 
-=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=-
|# |ABILITY             |NOTES                                               |
|1 |Ability 1           |Notes notes notes notes                             |
|2 |Ability 2           |Notes notes notes notes                             |
-=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=-

Shopping List

+shop
Kisaiya's Shopping List! 
-=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=-
|# |Item                                     |Price          |Crafter        |
|1 |Item 1-----------------------------------|1234 gp--------|Test-----------|
|2 |Item 2-----------------------------------|1234 gp--------|Test-----------|
|3 |Item 5-----------------------------------|1234 gp--------|---------------|
|4 |Item 4-----------------------------------|1234 gp--------|Test-----------|
|5 |Item 3-----------------------------------|1234 gp--------|---------------|
-=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=-
 


The Help Files

-=--=--=--=--=--=--=--=--=--=--=- Shop Help --=--=--=--=--=--=--=--=--=--=--=-
Usage: 
        View your list:         +shop
        Show your list:         +shop/share <name> <name> <...>
        This help file:         +shop/help
        Adds an item:           +shop/add <item>=<cost>=<maker> 
                                 (Can leave <maker> blank) Ex.: +sh/a bow=30=
        Removes an Item:        +shop/rem <item #>
        Edits an item:          +shop/edit <item #>=Item, Cost, or Maker=<edit>
                                  Ex.: +shop/edit 1=item=Bow of Awesome
        Moves an Item:          +shop/move <item #>=<new item #>
-=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=-
-=--=--=--=--=--=--=--=--=--=--=- Notes Help -=--=--=--=--=--=--=--=--=--=--=-
Usage: 
        View your notes:        +mynotes
        Show your notes:        +mynotes/share <name> <name> <...>
        This help file:         +mynotes/help
        Adds a note:            +mynotes/add <ability>=<note> 
        Removes a note:         +mynotes/rem <note #>
        Edits a note:           +mynotes/edit <note #>=Ability or Note=<edit>
                                  Ex.: +mynotes/edit 1=note=It's Amazing!
        Moves a Note:           +mynote/move <note #>=<new note #>
-=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=-

Installation

@create MyLists
@parent MyLists=#3166

DONE! That's it! You can look at the object you created for the help, or type +mynotes/help and +shop/help. Also, there are shortened versions of the commands, such as +sh/? and +myn/?.


For Those Interested in Code

Below is the code I used to create the parent object so far. I can't promise it's perfectly up to date, but it's at least where I started.

&V_SHOPHELP #3166=[center([ansi(hw,%bShop Help%b)],78,[ansi(b,-=-)])]%r[ansi(hc,Usage:)] %r%tView your list: %t[ansi(hw,+shop)]%r%tShow your list: %t[ansi(hw,+shop <name>)]%r%tThis help file: %t[ansi(hw,+shop/help)]%r%tAdds an item: %t%t[ansi(hw,+shop/add \<item\>\=\<cost\>\=\<maker\>)] %r%t%t%t%t%b(Can leave \<maker\> blank) Ex.: +sh/a bow=30=%r%tRemoves an Item: %t[ansi(hw,+shop/rem \<item \#\>)]%r%tEdits an item: %t%t[ansi(hw,+shop/edit \<item \#\>\=Item\, Cost\, or Maker\=\<edit\>)]%r%t%t%t%t%b Ex.: +shop/edit 1=item=Bow of Awesome%r%tMoves an Item: %t%t[ansi(hw,+shop/move \<item \#\>=\<new item \#\>)]%r[ansi(b,[repeat(-=-,26)])]
&DO_SHOPHELP #3166=$^\+(shop|sho|sh)/(help|hel|he|h|\?)$:@pemit %#=[u(V_SHOPHELP)]
&DO_SHOPVIEW #3166=$^\+(shop|sho|sh)(.+|)$:@pemit [if(words(%2),[[pmatch(trim(%2))]],%#)]=[switch(0,words(setr(1,v(V_SHOPPINGLIST)),|),You haven't made your list yet! Type +shop/help to see the commands.,%r%xh[name(%#)]'s Shopping List!%xn %r%xb[repeat(-=-,26)]%r\|%xh%xw[ljust(#,2)]%xn\|%xh%xw[ljust(Item,41)]%xn\|%xh%xw[ljust(Price,15)]%xn\|%xh%xw[ljust(Crafter,15)]%xn%xb\|%r\|[iter(%q1,[ljust(%xh%xw[inum(0)]%xn,2)]\|[ljust(%xh%xw[elements(itext(0),1,@)]%xn,41,%xb-)]\|[ljust(%xh%xw[elements(itext(0),2,@)]%xn,15,%xb-)]\|[ljust(%xh%xw[elements(itext(0),3,@)]%xn,15,%xb-)]%xb\|,|,%xn%xb%r\|)]%r%xn%xb[repeat(-=-,26)]%xn)][if(words(%2),[pemit(%#,%rShopping list sent to %xh[name(pmatch(trim(%2)))]%xn.%r)])]
&DO_SHOPADD #3166=$^\+(shop|sho|sh)/(add|ad|a) (.+)=(.+)=(.+|)$:@pemit %#=[setq(1,v(V_SHOPPINGLIST))][switch(0,[ulocal(D_NUMCATCH,%3,41,item,0)],,[ulocal(D_NUMCATCH,%4,15,price,0)],,[ulocal(D_NUMCATCH,%5,15,crafter name,0)],,You add item %xh%3%xn for price %xh%4%xn by crafter %xh%5%xn to your list as item #%xh[inc(words(%q1,|))]%xn.[set(me,V_SHOPPINGLIST:[trim(squish(%q1|%3@%4@%5,|),,|)])])]
&DO_SHOPREM #3166=$^\+(shop|sho|sh)/(remove|rem|re|rm|r) (.+)$:@pemit %#=[setq(1,v(V_SHOPPINGLIST))][switch(0,[ulocal(D_NUMCATCH,%3,0,item,5)],,You are removing item #%3 from your list which is: %r%xh[elements([elements(%q1,%3,|)],1,@)]%xn for %xh[elements([elements(%q1,%3,|)],2,@)]%xn by %xh[elements([elements(%q1,%3,|)],3,@)]%xn.[set(me,V_SHOPPINGLIST:[remove(%q1,[elements(%q1,%3,|)],|)])])]
&DO_SHOPEDIT #3166=$^\+(shop|sho|sh)/(edit|edi|ed|e|et) (.+)=(.+)=(.+|)$:@pemit %#=[setq(1,v(V_SHOPPINGLIST))][switch(0,[ulocal(D_NUMCATCH,%3,0,item,5)],,[switch(1,strmatch(%4,i*),and(0,setr(m,1),setr(n,item),setr(o,41)),[switch(1,strmatch(%4,co*),1,strmatch(%4,$),1,strmatch(%4,g*),1,strmatch(%4,p*),1,0)],and(0,setr(m,2),setr(n,price),setr(o,15)),[switch(1,strmatch(%4,m*),1,strmatch(%4,cr*),1,0)],and(0,setr(m,3),setr(n,crafter),setr(o,15)),2)],if(ulocal(D_NUMCATCH,%5,%qo,%qn,0),[set(me,V_SHOPPINGLIST:[trim(squish([replace(%q1,%3,[replace(elements(%q1,%3,|),%qm,%5,@)],|)],|))])]You've changed the %qn for item #%xh%3%xn to %xh%5%xn.),I'm sorry. You tried to change #%xh%3's %4%xn which isn't a valid selection. Please choose %xhitem%xn\, %xhcost%xn\, or %xhmaker%xn to edit.)]
&DO_SHOPMOVE #3166=$^\+(shop|sho|sh)/(move|mov|mo|m|mv) (.+)=(.+)$:@pemit %#=[setq(1,v(V_SHOPPINGLIST))][switch(0,[ulocal(D_NUMCATCH,%3,0,item,5)],,[ulocal(D_NUMCATCH,%4,0,item,5)],,not(match(%3,%4)),The numbers cannot be the same,Item #%xh%3%xn has been moved to #%xh%4%xn.[setq(m,[elements(%q1,%3,|)])][setq(n,remove(%q1,elements(%q1,%3,|),|))][set(me,V_SHOPPINGLIST:[trim([elements(%qn,lnum(0,dec(%4)),|)]\|%qm\|[elements(%qn,lnum(%4,inc(words(%q1,|))),|)],,|)])])]

@set #3166/DO_SHOPVIEW=regexp
@set #3166/DO_SHOPADD=regexp
@set #3166/DO_SHOPREM=regexp
@set #3166/DO_SHOPHELP=regexp
@set #3166/DO_SHOPEDIT=regexp

&V_ABILHELP #3166=[center([ansi(hw,%bNotes Help%b)],78,[ansi(b,-=-)])]%r[ansi(hc,Usage:)] %r%tView your notes: %t[ansi(hw,+mynotes)]%r%tShow your notes: %t[ansi(hw,+mynotes <name>)]%r%tThis help file: %t[ansi(hw,+mynotes/help)]%r%tAdds a note: %t%t[ansi(hw,+mynotes/add \<ability\>\=\<note\>)] %r%tRemoves a note: %t[ansi(hw,+mynotes/rem \<note \#\>)]%r%tEdits a note: %t%t[ansi(hw,+mynotes/edit \<note \#\>\=Ability or Note\=\<edit\>)]%r%t%t%t%t%b Ex.: +mynotes/edit 1=note=It's Amazing!%r%tMoves a Note: %t%t[ansi(hw,+mynote/move \<note \#\>=\<new note \#\>)]%r[ansi(b,[repeat(-=-,26)])]
&DO_ABILHELP #3166=$^\+(mynotes|mynote|mynot|myno|myn)/(help|hel|he|h|\?)$:@pemit %#=[u(V_ABILHELP)]
&DO_ABILVIEW #3166=$^\+(mynotes|mynote|mynot|myno|myn)(.+|)$:@pemit [if(words(%2),[[pmatch(trim(%2))]],%#)]=[switch(0,words(setr(1,v(V_ABILLIST)),|),You haven't made any notes yet! Type +mynotes/help to see the commands.,%r%xh[name(%#)]'s Ability Notes!%xn %r%xb[repeat(-=-,26)]%r\|%xh%xw[ljust(#,2)]%xn\|%xh%xw[ljust(ABILITY,20)]%xn\|%xh%xw[ljust(NOTES,52)]%xn%xb\|%r\|[iter(%q1,[ljust(%xh%xw[inum(0)]%xn,2)]\|[ljust(%xh%xw[elements(itext(0),1,@)]%xn,20)]\|[ljust(%xh%xw[elements(itext(0),2,@)]%xn,52)]%xb\|,|,%xn%xb%r\|)]%r%xn%xb[repeat(-=-,26)]%xn)][if(words(%2),[pemit(%#,%rAbility list sent to %xh[name(pmatch(trim(%2)))]%xn.%r)])]
&DO_ABILADD #3166=$^\+(mynotes|mynote|mynot|myno|myn)/(add|ad|a) (.+)=(.+)$:@pemit %#=[setq(1,v(V_ABILLIST))][switch(0,ulocal(D_NUMCATCH,%3,20,ability,0),,ulocal(D_NUMCATCH,%4,52,note,0),,You added ability %xh%3%xn With the note: %xh%4%xn as #%xh[inc(words(%q1,|))]%xn.[set(me,V_ABILLIST:[trim(squish(%q1|%3@%4,|),,|)])])]
&DO_ABILREM #3166=$^\+(mynotes|mynote|mynot|myno|myn)/(remove|rem|re|rm|r) (.+)$:@pemit %#=[setq(1,v(V_ABILLIST))][switch(0,ulocal(D_NUMCATCH,%3,0,ability,5),,You are removing ability #%3 from your notes which is: %r%xh[elements([elements(%q1,%3,|)],1,@)]%xn with the note: %xh[elements([elements(%q1,%3,|)],2,@)]%xn[set(me,V_ABILLIST:[remove(%q1,[elements(%q1,%3,|)],|)])])]
&DO_ABILEDIT #3166=$^\+(mynotes|mynote|mynot|myno|myn)/(edit|edi|ed|e|et) (.+)=(.+)=(.+|)$:@pemit %#=[setq(1,v(V_ABILLIST))][switch(0,[ulocal(D_NUMCATCH,%3,0,ability,5)], ,[switch(1,[switch(1,strmatch(%4,a*),1,strmatch(%4,s*),1,strmatch(%4,f*),1,strmatch(%4,i*),1,0)],and(0,setr(m,1),setr(n,ability name),setr(o,20)),[switch(1,strmatch(%4,n*),1,strmatch(%4,c*),1,strmatch(%4,d*),1,0)],and(0,setr(m,2),setr(n,note),setr(o,52)),2)],if(ulocal(D_NUMCATCH,%5,%qo,%qn,0),[set(me,V_ABILLIST:[trim(squish([replace(%q1,%3,[replace(elements(%q1,%3,|),%qm,%5,@)],|)],|))])]You've changed the %qn for ability #%xh%3%xn to: %xh%5%xn),I'm sorry. You tried to change #%xh%3's %4%xn which isn't a valid selection. Please choose %xhability%xn\, or %xhnote%xn to edit.)]
&DO_ABILMOVE #3166=$^\+(mynotes|mynote|mynot|myno|myn)/(move|mov|mo|m|mv) (.+)=(.+)$:@pemit %#=[setq(1,v(V_ABILLIST))][switch(0,[ulocal(D_NUMCATCH,%3,0,ability,5)],,[ulocal(D_NUMCATCH,%4,0,ability,5)],,not(match(%3,%4)),They cannot be the same number,Ability #%xh%3%xn has been moved to #%xh%4%xn.[setq(m,[elements(%q1,%3,|)])][setq(n,remove(%q1,elements(%q1,%3,|),|))][set(me,V_ABILLIST:[trim([elements(%qn,lnum(0,dec(%4)),|)]\|%qm\|[elements(%qn,lnum(%4,inc(words(%q1,|))),|)],,|)])])]
&DO_ABILCLASS #3166=$^\+(mynotes|mynote|mynot|myno|myn)/(class|clas|cla|cl|c) (.+)$:@pemit %#=[setq(1,v(D_ABIL[ulocal(D_CLASSCATCH,%3)]))]%r%xh[ulocal(D_CLASSCATCH,%3)]'s Ability Notes!%xn %r%xb[repeat(-=-,26)]%r\|%xh%xw[ljust(#,2)]%xn\|%xh%xw[ljust(ABILITY,20)]%xn\|%xh%xw[ljust(NOTES,52)]%xn%xb\|%r\|[iter(%q1,[ljust(%xh%xw[inum(0)]%xn,2)]\|[ljust(%xh%xw[elements(itext(0),1,@)]%xn,20)]\|[ljust(%xh%xw[elements(itext(0),2,@)]%xn,52)]%xb\|,|,%xn%xb%r\|)]%r%xn%xb[repeat(-=-,26)]%xn

@set #3166/DO_ABILVIEW=regexp
@set #3166/DO_ABILADD=regexp
@set #3166/DO_ABILREM=regexp
@set #3166/DO_ABILHELP=regexp
@set #3166/DO_ABILEDIT=regexp
@set #3166/DO_ABILCLASS=regexp

&D_NUMCATCH #3166=[if(match(%3,5),[switch(0,isint(%0),and(0,pemit(%#,It needs to be an Integer.)),and(lt(%0,[inc(words(%q1,|))]),gt(%0,0)),and(0,pemit(%#,That %2 number is invalid.)),1)],[switch(0,[lte([inc(words(%q1,|))],50)],and(0,pemit(%#,You already have 50 entries please remove one before adding one.)),[lte([strlen(trim(strip(%0)))],%1)],and(0,pemit(%#,Your %2 is [sub([strlen(trim(strip(%0)))],%1)] characters too long.)),1)])]

&D_CLASSCATCH #3166=[switch(1,match(%0,Inq*),Inquisitor,match(%0,Art*),Artificer,match(%0,Barb*),Barbarian,match(%0,Bard),Bard,match(%0,Blo*),Bloodrager,match(%0,Cav*),Cavalier,match(%0,Cle*),Cleric,match(%0,Dru*),Druid,match(%0,Fig*),Fighter,match(%0,Mon*),Monk,match(%0,Pal*),Paladin,match(%0,Ran*),Ranger,match(%0,Rog*),Rogue,match(%0,Sor*),Sorcerer,match(%0,Swa*),Swashbuckler,match(%0,Wiz*),Wizard,match(%0,Wit*),Witch,NONE SELECTED)]