#Can I make custom dynamic arena picker?

1 messages · Page 1 of 1 (latest)

iron ruin
#

Can I make a dynamic row using DeluxeMenus?

For example I have 4 available arenas in slot 0,1,2,3
And I have view requirement set, so if placeholder says "available" arena is showing

So some players joined arena 1 and started the game, placeholders changed to "InGame" so arena number 1 disappears.

Now i have slot 0,2,3 with arenas but 1 is empty.
So can I move somehow arena 2 and 3 left by 1 to make it dynamic?
And after the game end on arena 1 it will be added to the row back.

I hope you understand what I mean..😅

#

Is it possible to make*?😅

past solstice
#

You'd have to use a lot of view requirements, slot numbers are static for each item defined

#

you'd basically just have to have 4 items for slot 0, 3 items for slot 2, 3 items for slot 3, 1 item for slot 4

#

now... if you have a lot more than 4 arenas then that number keeps going up

iron ruin
#

hmm so it is possible.. I will think about it) Thanks. If anyone have an idea how to configure it.. text here.

past solstice
#

what placeholders are provided by the arena plugin

iron ruin
iron ruin
past solstice
#

slot 1 priority 0 (highest) should also have a view requirement checking if Arena 1 is active or not, it can only show Arena 2 if Arena 1 is Available

#

then the same for slot 2 priority 0 (Arena 3) should check if Arena 1 AND Arena 2 are both available

iron ruin
# past solstice then the same for slot 2 priority 0 (Arena 3) should check if Arena 1 AND Arena ...

So I made a config that works, but I needed to make the same arena icon at slot1 3 times because there is no option to use OR in view requirements. And I need to check is arena is in waiting is arena is online and is arena is full.. Can I send you a config to you to see maybe you know how to optimize it? Because if i need to add one more arena it will be very complicated. So maybe I do to many checks..

past solstice
#

well you can use minimum requirements

#

or javascript requiremments

#

for an OR

#

you can definitely post the config here though

iron ruin
# past solstice you can definitely post the config here though

https://paste.helpch.at/ubenoxibex.yaml
%javascript_bwcmotdnamesolo_ArenaName% - Name of the arena
%javascript_bwcmotdstatussolo_ArenaName% - Status of arena. It can return Nothing(like just a space), Waiting for players(it can`t return full so if 4/4 it will still be Waiting till arena start, but if it could be useful for optimisation I guess I can make it in JS that separates motd by args), Running or Resetting
%javascript_bwcmotdonlinesolo_ArenaName% - How many players on arena right now
%javascript_bwcmotdmaxsolo_ArenaName% - Max players that can join arena
0.0.0.0:22001 - Arena1 - Camping
0.0.0.0:22002 - Arena2 - Geyser
0.0.0.0:22003 - Arena3 - Plains

iron ruin
#
var placeholder = [%pinger_motd_0.0.0.0:22001%]; //"ArenaName", "ArenaStatus", "ArenaOnline", "ArenaMax"
var placeholderonline = placeholder[2];
var placeholdermax = placeholder[3];
placeholder[1];

function placeholderCheck(){
    // If arena In Game return status
  if(placeholder[1] == "У грі") {
      return placeholder[1];
  }
    // If arena not full return status
  if(placeholderonline < placeholdermax) {
      return placeholder[1];
  }
    // If arena full return full
  if (placeholderonline == placeholdermax) {
      return "&cЗаповнена";
  }
}
placeholderCheck();

Like this

#

I think now I can simplify the menu config

iron ruin
# past solstice or javascript requiremments
    view_requirement:
        requirements:
            arenastatusOther:
                type: javascript
                expression: '"%javascript_bwcmotdstatussolo_Camping%" == "Waiting.." || "%javascript_bwcmotdstatussolo_Geyser%" == "Waiting.."'

can I use OR an infinite number of times? like
expression: '"%javascript_bwcmotdstatussolo_Arena1%" == "Waiting.." || "%javascript_bwcmotdstatussolo_Arena2%" == "Waiting.. " || "%javascript_bwcmotdstatussolo_Arena3%" == "Waiting.. " || "%javascript_bwcmotdstatussolo_Arena4%" == "Waiting.. "'

past solstice
#

Yes, but be weary it is a lot of javascript going on

#

using the %javascript% placeholders themselves will cause a little bit of performance lag/menu loading lag

#

I'd try using the minimum_requirements for OR related things, but I realize it can't be done for all situations

#

You could try using javascript a different way

#

maybe instead of returning arena information you have %javascript_arena_1_name% which returns the first available arena

#

leaving javascript to do the logic

#

so slot 1 would just look like

item:
  slot: 0
  display_name: '%javascript_arena_1_name%'
  #...
#

but will that add more to the javascript placeholder lag? maybe...

#

not sure the best way to optimize this sort of thing since each time the %javascript% placeholder is ran a new engine instance has to be started iirc

iron ruin
#

To be honest, I'm not very good at JavaScript.. I don`t know how to make it.
Also I want different icons per arena using heads so if I use names it would be impossible

past solstice
#

well basehead might support placeholders not sure

#

or placeholder- supports basehead

iron ruin
past solstice
#

or neither and it's not possible

iron ruin
#

Hmm I not that scared about using JavaScript for view requirements as for using 4 of them per arena to spit motd by args..

past solstice
#

not just view requirements

#

also your lore

iron ruin
#

yes..

past solstice
#

5 times per item atm at least

#

more items more lag

#

essentially

#

I was loading a menu with 54 items all generated via javascript and it took seconds to open

iron ruin
#

I have 4 .js files per map to split %pinger_motd_ArenaIp% to "ArenaName", "ArenaStatus", "ArenaOnline", "ArenaMax"

past solstice
#

ye

#

you can make them accept arguments fyi

iron ruin
#

but for view requirements i only need status. Others is for lore. so maybe I can reduce their population somehow?

#

because except of status one others look like this

var placeholder = [%pinger_motd_0.0.0.0:22003%];
placeholder[2];
#

0, 1, 2, 3 in args

past solstice
#

\n would be newline if you could I bet

#

worth a try for sure

#

like I said, not really sure the best way to optimize something like this

iron ruin
#

Is there any other way to split %pinger_motd_IP% that returns "ArenaName", "ArenaStatus", "ArenaOnline", "ArenaMax" to 4 different placeholders by args? Not using Java script

past solstice
#

best way would get a custom expansion

#

I'm off for now tho

#

o/