Kisa Flexible Lists

From Tenebrae
Revision as of 01:01, 15 December 2017 by Kisaiya (talk | contribs)
Jump to navigation Jump to search

IF YOU'RE READING THIS, HOLD UP GONNA DO SOME REWRITES. WILL REMOVE WHEN DONE

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!

Examples

+mynotes - Use as a Quick Reference

+mynotes
Sarcis's Ability Notes! 
______________________________________________________________________________
|# |ABILITY             |NOTES                                               |
|1 |Ability 1           |Notes notes notes notes                             |
|2 |Ability 2           |Notes notes notes notes                             |
------------------------------------------------------------------------------

+shop - Use as a Shopping List

Sarcis's Shopping List! 
______________________________________________________________________________
|#  |Item                                    |Price          |Crafter        |
|1  |Item 1----------------------------------|1234 gp--------|Test-----------|
|2  |Item 2----------------------------------|1234 gp--------|Test-----------|
|3  |Item 5----------------------------------|1234 gp--------|Test-----------|
|4  |Item 3----------------------------------|1234 gp--------|Test-----------|
|5  |Item 4----------------------------------|1234 gp--------|Test-----------|
------------------------------------------------------------------------------
 

+mynotes/help or +shop/help - The Help File

----------------------------------Shop Help-----------------------------------
Usage: 
        View your list:         +shop
        This help file:         +shop/help
        Adds an item:           +shop/add <item>=<cost>=<maker> 
        Removes an Item:        +shop/rem <item #> 
------------------------------------------------------------------------------


Installation

Step One: Copy and Paste

@create MyLists @parent MyLists=#3166

DONE! That's it! Type +mynotes/help and +shop/help. Enjoy!



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.

&DO_SHOPVIEW #3166=$^\+(shop|sho|sh)$:@pemit %#=[switch(0,words(setr(l,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(_,78)]%r\|%xh%xw[ljust(#,3)]%xn\|%xh%xw[ljust(Item,40)]%xn\|%xh%xw[ljust(Price,15)]%xn\|%xh%xw[ljust(Crafter,15)]%xn%xb\|%r\|[iter(%ql,[ljust(%xh%xw[inum(0)]%xn,3)]\|[ljust(%xh%xw[elements(itext(0),1,@)]%xn,40,%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(-,78)]%xn)]
&DO_SHOPADD #3166=$^\+(shop|sho|sh)/(add|ad|a) (.+)=(.+)=(.+)$:@pemit %#=You add item %xh%3%xn for price %xh%4%xn by crafter %xh%5%xn to your list as item #%xh[inc(words(setr(1,v(V_SHOPPINGLIST)),|))]%xn.[set(me,V_SHOPPINGLIST:[trim(squish(%q1|%3@%4@%5,|),,|)])]
&DO_SHOPHELP #3166=$^\+(shop|sho|sh)/(help|hel|he|h|\?)$:@pemit %#=[center([ansi(hw,Shop Help)],70,[ansi(b,-)])]%r[ansi(hc,Usage:)] %r%tView your list: %t[ansi(hw,+shop)]%r%tThis help file: %t[ansi(hw,+shop/help)]%r%tAdds an item: %t%t[ansi(hw,+shop/add \<item\>\=\<cost\>\=\<maker\>)] %r%tRemoves an Item: %t[ansi(hw,+shop/rem \<item \#\>)] %r[ansi(b,[repeat(-,70)])]
&DO_SHOPREM #3166=$^\+(shop|sho|sh)/(remove|rem|re|rm|r) (.+)$:@pemit %#=[switch(0,and([lt(%3,[inc(words(setr(l,v(V_SHOPPINGLIST)),|))])],gt(%3,0)),That ability number is invalid.,You are removing item #%3 from your list which is: %r[setq(l,v(V_SHOPPINGLIST))]%xh[elements([elements(%ql,%3,|)],1,@)]%xn for %xh[elements([elements(%ql,%3,|)],2,@)]%xn by %xh[elements([elements(%ql,%3,|)],3,@)]%xn.[set(me,V_SHOPPINGLIST:[remove(%ql,[elements(%ql,%3,|)],|)])])]

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

&DO_ABILVIEW #3166=$^\+(mynotes|mynote|mynot|myno|myn)$:@pemit %#=[switch(0,words(setr(l,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(_,78)]%r\|%xh%xw[ljust(#,2)]%xn\|%xh%xw[ljust(ABILITY,20)]%xn\|%xh%xw[ljust(NOTES,52)]%xn%xb\|%r\|[iter(%ql,[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(-,78)]%xn)]
&DO_ABILADD #3166=$^\+(mynotes|mynote|mynot|myno|myn)/(add|ad|a) (.+)=(.+)$:@pemit %#=You added ability %xh%3%xn With the note: %xh%4%xn as #%xh[inc(words(setr(1,v(V_ABILLIST)),|))]%xn.[set(me,V_ABILLIST:[trim(squish(%q1|%3@%4,|),,|)])]
&DO_ABILHELP #3166=$^\+(mynotes|mynote|mynot|myno|myn)/(help|hel|he|h|\?)$:@pemit %#=[center([ansi(hw,Notes Help)],70,[ansi(b,-)])]%r[ansi(hc,Usage:)] %r%tView your notes: %t[ansi(hw,+mynotes)]%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[ansi(b,[repeat(-,70)])]
&DO_ABILREM #3166=$^\+(mynotes|mynote|mynot|myno|myn)/(remove|rem|re|rm|r) (.+)$:@pemit %#=[switch(0,and([lt(%3,[inc(words(setr(l,v(V_ABILLIST)),|))])],gt(%3,0)),That ability number is invalid.,You are removing item #%3 from your notes which is: %r%xh[elements([elements(%ql,%3,|)],1,@)]%xn with the note: %xh[elements([elements(%ql,%3,|)],2,@)]%xn.[set(me,V_ABILLIST:[remove(%ql,[elements(%ql,%3,|)],|)])])]

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