Difference between revisions of "Kisa Flexible Lists"

From Tenebrae
Jump to navigation Jump to search
Line 5: Line 5:
   
 
=Examples=
 
=Examples=
'''Use as a Quick Reference'''
+
'''+mynotes - Use as a Quick Reference'''
 
<pre>
 
<pre>
  +
+mynotes
______________________________________________________________
 
  +
Sarcis's Ability Notes!
|ITEM--------------------------|----BENEFIT---|---CRAFTER----|
 
  +
______________________________________________________________________________
|Power Attack------------------|--- -1/+4 ----|----Verna-----|
 
  +
|# |ABILITY |NOTES |
--------------------------------------------------------------
 
  +
|1 |Ability 1 |Notes notes notes notes |
  +
|2 |Ability 2 |Notes notes notes notes |
 
------------------------------------------------------------------------------
 
</pre>
 
</pre>
   
'''Use as a Shopping List'''
+
'''+shop - Use as a Shopping List'''
   
 
<pre>
 
<pre>
  +
Sarcis's Shopping List!
______________________________________________________________
 
  +
______________________________________________________________________________
|ITEM--------------------------|----PRICE-----|---CRAFTER----|
 
  +
|# |Item |Price |Crafter |
|Ring of Protection +2---------|---3600 gp----|----Verna-----|
 
|Fullplate +2------------------|---2400 gp----|---Kerbasi----|
+
|1 |Item 1----------------------------------|1234 gp--------|Test-----------|
|Natural Armor Amulet +3-------|---10800 gp---|----Sandy-----|
+
|2 |Item 2----------------------------------|1234 gp--------|Test-----------|
|Inf. Connections T5-----------|----10 RPP----|-----RPP------|
+
|3 |Item 5----------------------------------|1234 gp--------|Test-----------|
--------------------------------------------------------------
+
|4 |Item 3----------------------------------|1234 gp--------|Test-----------|
 
|5 |Item 4----------------------------------|1234 gp--------|Test-----------|
 
------------------------------------------------------------------------------
 
</pre>
 
</pre>
   
'''The Help File'''
+
'''+mynotes/help or +shop/help - The Help File'''
 
<pre>
 
<pre>
------------------------------Shop Help-------------------------------
+
----------------------------------Shop Help-----------------------------------
Usage:
+
Usage:
This help File: +shop
+
View your list: +shop
View your list: +shop/view
+
This help file: +shop/help
Adds an item: +shop/add <item>, <cost>, <maker>
+
Adds an item: +shop/add <item>=<cost>=<maker>
Removes an Item: +shop/rem <item>
+
Removes an Item: +shop/rem <item #>
----------------------------------------------------------------------
+
------------------------------------------------------------------------------
 
</pre>
 
</pre>
   
   
 
=Installation=
 
=Installation=
 
 
==Step One: Copy and Paste==
 
==Step One: Copy and Paste==
  +
@create MyLists
Copy and paste the following:
 
  +
@parent MyLists=#3166
   
  +
DONE! That's it! Type +mynotes/help and +shop/help. Enjoy!
<pre>
 
&C_SHOP %!=|[ljust(%xh%0%xn,30,%xb-)]|[center(%xh%1%xn,14,%xb-)]|[center(%xh%2%xn,14,%xb-)]|%r%xn
 
&V_ITEM %!=ITEM, PRICE, CRAFTER
 
&DO_HELPSHOP %!=$^\+(shop|sho|sh)$:@pemit %!=[center([ansi(hw,Shop Help)],70,[ansi(b,-)])]%r[ansi(hc,Usage:)] %r%tThis help File: %t[ansi(hw,+shop)]%r%tView your list: %t[ansi(hw,+shop/view)]%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_SHOP %!=$^\+(shop|sho|sh)/(view|vie|vi|v)$:@pemit %!=%r[ansi(hw,%n's Shopping List!)]%r [repeat(_,62)]%r [iter([u(V_ITEM)],[mix(C_SHOP,##,:)],|)] [repeat(-,62)]
 
&DO_ADDSHOP %!=$^\+(shop|sho|sh)/(add|ad|a) (.+), (.+), (.+)$:&V_ITEM %!=[v(V_ITEM)]|%3\, %4\, %5;@pemit %!=Item "%3" stored.
 
&DO_REMSHOP %!=$^\+(shop|sho|sh)/(remove|rem|r) (.+)$:&V_ITEM %!=[remove([u(V_ITEM)],[index([u(V_ITEM)],|,[match([u(V_ITEM)],%3*,|)],1)],|)];@pemit %!=Item "%3" removed from list.
 
</pre>
 
   
   
   
==Step Two: ENJOY!==
 
You type: +shop <br />
 
This will show you the help page, also as a note, you can actually shorten many of the commands down to something as simple as: +sh/r <item>
 
   
  +
=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.
   
 
<pre>
==Options: RegEx!==
 
  +
&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)]
Like RegEx? Copy and paste the following so you can enable regular expressions on several of the commands:
 
  +
&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
<pre>
 
@set %!/DO_HELPSHOP=regexp
+
@set #3166/DO_SHOPADD=regexp
@set %!/DO_SHOP=regexp
+
@set #3166/DO_SHOPREM=regexp
@set %!/DO_ADDSHOP=regexp
+
@set #3166/DO_SHOPHELP=regexp
  +
@set %!/DO_REMSHOP=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
 
</pre>
 
</pre>
   

Revision as of 01:01, 15 December 2017

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