General discussion of Denizen-Bukkit, or even just Bukkit.
-
Anthony
- Regular

- Posts: 35
- Joined: August 5th, 2016, 9:01 pm
Post
by Anthony » August 11th, 2016, 5:29 pm
BlackCoyote wrote:find_all_partial is kind of lacking when it comes to this. I have a buncho code somewhere that simulates server.match_player[] but with regular lists, i think this is what he would find more useful. I'll be adding it in.
It is indeed. I used it in the code i posted above for lulz and it's kinda... meh.
<proc[DUL_colorlist].context[match|blue]>
returns
dark_blue
Also,
you lied >.<
We are the music makers, and we are the dreamers of dreams...
-
BlackCoyote
- Regular

- Posts: 78
- Joined: August 6th, 2016, 1:44 am
Post
by BlackCoyote » August 11th, 2016, 5:38 pm
Code: Select all
DUL_find_best_match:
type: procedure
debug: false
DUL:
author:
- BlackCoyote
description:
- Returns the best search match out of a list.
usage:
- <proc[DUL_find_best_match].context[<list separated by '/'>|<value>]>
example:
- <proc[DUL_find_best_match].context[<server.flag[homes].as_list.separated_by[/]>|<context.args.get[1]>]>
script:
- define list <def[1].split_by[/]>
- if <def[list].is_empty||true> {
- debug error "DUL - No valid list specified!"
- determine null
}
- if <def[2]||null> == null {
- debug error "DUL - No valid value specified!"
- determine null
}
- if <def[list].contains[<def[2]>]> {
- determine <def[2]>
} else if <def[list].filter[starts_with[<def[2]>]].size||0> > 0 {
- determine <def[list].filter[starts_with[<def[2]>]].sort_by_number[length].first||null>
} else if <def[list].filter[contains[<def[2]>]].size||0> > 0 {
- determine <def[list].filter[contains[<def[2]>]].sort_by_number[length].first||null>
} else {
- determine null
}
This is what i typically use. It's a lot like the match_player with one slight improvement, that it returns the shortest (and thus the most accurate) result.
I'm a bit unsure about how i'm taking the list input though..
-
BlackCoyote
- Regular

- Posts: 78
- Joined: August 6th, 2016, 1:44 am
Post
by BlackCoyote » August 11th, 2016, 7:23 pm
Mwthorn wrote:Recently I have experienced players done spelling mistakes and I want to correct their mistakes.
Examples with "/spawn" are: "/pawn" "/spawn%" "/spawn*" "/spa wn" "/spwatn"
A procedure that takes input as element-list and a element
This then should output an element, from the list, that is the closest element from the original.
We've partially implemented this in the most recent update at
http://mcmonkey.org/denizen/repo/entry/96. it finds the best match, much like server.match_player does. however, it does NOT account for direct typos, only for complete or partial values.
I think Anthony might want to try to make something that can account for typos.
I would recommend this to be added as an entirely new utility as I can imagine accounting for typo inaccuracies might lead to a less accurate 'best match'.
Thanks for the suggestions mwthorn, keep em coming!
-
mcmonkey
- Site Admin

- Posts: 299
- Joined: August 5th, 2016, 7:27 pm
- Location: Los Angeles, California, USA
-
Contact:
Post
by mcmonkey » August 13th, 2016, 12:43 pm
Somebody doesn't know about Denizen1's need for escaping
Stares at BlackCoyote's code
Denizen lead developer. On Discord as mcmonkey#6666
.
-
BlackCoyote
- Regular

- Posts: 78
- Joined: August 6th, 2016, 1:44 am
Post
by BlackCoyote » August 13th, 2016, 1:50 pm
mcmonkey wrote:Somebody doesn't know about Denizen1's need for escaping
Stares at BlackCoyote's code
please enlighten me on how I should be doing it without breaking the 1 color per character
-
mcmonkey
- Site Admin

- Posts: 299
- Joined: August 5th, 2016, 7:27 pm
- Location: Los Angeles, California, USA
-
Contact:
Post
by mcmonkey » August 13th, 2016, 5:40 pm
BlackCoyote wrote:mcmonkey wrote:Somebody doesn't know about Denizen1's need for escaping
Stares at BlackCoyote's code
please enlighten me on how I should be doing it without breaking the 1 color per character
-foreach <def[1].unescaped.to_list.escape_contents>:
?
Denizen lead developer. On Discord as mcmonkey#6666
.
-
BlackCoyote
- Regular

- Posts: 78
- Joined: August 6th, 2016, 1:44 am
Post
by BlackCoyote » August 13th, 2016, 5:46 pm
mcmonkey wrote:BlackCoyote wrote:mcmonkey wrote:Somebody doesn't know about Denizen1's need for escaping
Stares at BlackCoyote's code
please enlighten me on how I should be doing it without breaking the 1 color per character
-foreach <def[1].unescaped.to_list.escape_contents>:
?
that seems reasonable, thanks.
-
BlackCoyote
- Regular

- Posts: 78
- Joined: August 6th, 2016, 1:44 am
Post
by BlackCoyote » August 13th, 2016, 5:57 pm
should be fixed now on latest repo release if mcmonkey's suggestion was right
edit: had to change some more things to make it work the way he suggested but now it seems fine in my tests
-
mcmonkey
- Site Admin

- Posts: 299
- Joined: August 5th, 2016, 7:27 pm
- Location: Los Angeles, California, USA
-
Contact:
Post
by mcmonkey » August 16th, 2016, 7:12 pm
Topic moved.
Denizen lead developer. On Discord as mcmonkey#6666
.
-
Mwthorn
- User

- Posts: 46
- Joined: August 6th, 2016, 8:35 am
- Location: Roskilde, Sjælland, Denmark
-
Contact:
Post
by Mwthorn » August 17th, 2016, 9:02 am
Another idea; A task to check a cuboid if its flat. Given input a cuboid and maybe a height-number as a form of criteria for determining if it is flat.
Currently it only seems that's for a chunk to check if its flat.
-
BlackCoyote
- Regular

- Posts: 78
- Joined: August 6th, 2016, 1:44 am
Post
by BlackCoyote » August 17th, 2016, 12:57 pm
What do you mean flat? as in all the surface blocks are at the same height?
-
Mwthorn
- User

- Posts: 46
- Joined: August 6th, 2016, 8:35 am
- Location: Roskilde, Sjælland, Denmark
-
Contact:
Post
by Mwthorn » August 17th, 2016, 1:03 pm
Yes, or in between a defined height
-
BlackCoyote
- Regular

- Posts: 78
- Joined: August 6th, 2016, 1:44 am
Post
by BlackCoyote » August 17th, 2016, 1:06 pm
@anthony make it happen! (I wish I could tag people in forum posts or knew how)
-
Mwthorn
- User

- Posts: 46
- Joined: August 6th, 2016, 8:35 am
- Location: Roskilde, Sjælland, Denmark
-
Contact:
Post
by Mwthorn » August 22nd, 2016, 4:54 am
Another idea! Say you have a long string element and want to split it up to multiple lines (for example to a lore on a item or a speech in a box).
So you give an input and a form of number to tell the length of each line. It should only split on spacebar letters so we don't get words splitted in different lines.
-
BlackCoyote
- Regular

- Posts: 78
- Joined: August 6th, 2016, 1:44 am
Post
by BlackCoyote » August 22nd, 2016, 6:55 am
Mwthorn wrote:Another idea! Say you have a long string element and want to split it up to multiple lines (for example to a lore on a item or a speech in a box).
So you give an input and a form of number to tell the length of each line. It should only split on spacebar letters so we don't get words splitted in different lines.
sounds good! ANTHONYYYY
-
Mwthorn
- User

- Posts: 46
- Joined: August 6th, 2016, 8:35 am
- Location: Roskilde, Sjælland, Denmark
-
Contact:
Post
by Mwthorn » November 24th, 2016, 10:38 am
A procedure at gives a sphere (hollow?) as a list of locations.
Input a radius and a location.
Users browsing this forum: No registered users and 2 guests