Kisa Flexible Lists

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

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
        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
-=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=-
-=--=--=--=--=--=--=--=--=--=--=- Notes Help -=--=--=--=--=--=--=--=--=--=--=-
Usage: 
        View your notes:        +mynotes
        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!
-=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=-

Installation

@create MyLists
@parent MyLists=#3166

DONE! That's it! To use, 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.

&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 %#=[switch(0,[lte([inc(words(setr(1,v(V_SHOPPINGLIST)),|))],50)],You already have 50 entries please remove one before adding one.,[lte([strlen(trim(strip(%3)))],40)],Your item is [sub([strlen(trim(strip(%3)))],40)] characters too long.,[lte([strlen(trim(strip(%4)))],15)],Your price is [sub([strlen(trim(strip(%4)))],15)] characters too long.,[lte([strlen(trim(strip(%5)))],15)],Your crafter name is [sub([strlen(trim(strip(%5)))],15)] characters too long.,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_SHOPHELP #3166=$^\+(shop|sho|sh)/(help|hel|he|h|\?)$:@pemit %#=[center([ansi(hw,%bShop Help%b)],78,[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%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[ansi(b,[repeat(-=,39)])]
&DO_SHOPREM #3166=$^\+(shop|sho|sh)/(remove|rem|re|rm|r) (.+)$:@pemit %#=[switch(0,isint(%3),It needs to be a integer.,and([lt(%3,[inc(words(setr(l,v(V_SHOPPINGLIST)),|))])],gt(%3,0)),That item 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 %#=[switch(0,[lte([inc(words(setr(1,v(V_ABILLIST)),|))],50)],You already have 50 entries please remove one before adding one.,[lte([strlen(trim(strip(%3)))],20)],Your ability is [sub([strlen(trim(strip(%3)))],20)] characters too long.,[lte([strlen(trim(strip(%4)))],52)],Your note is [sub([strlen(trim(strip(%4)))],52)] characters too long.,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_ABILHELP #3166=$^\+(mynotes|mynote|mynot|myno|myn)/(help|hel|he|h|\?)$:@pemit %#=[center([ansi(hw,%bNotes Help%b)],78,[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(-=,39)])]
&DO_ABILREM #3166=$^\+(mynotes|mynote|mynot|myno|myn)/(remove|rem|re|rm|r) (.+)$:@pemit %#=[switch(0,isint(%3),It needs to be a integer.,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