Ktar5 / Info-Board

The Spigot/Bukkit plugin for managing scoreboards
http://dev.bukkit.org/bukkit-plugins/ib-reborn/
13 stars 13 forks source link

Skript variables - need support for player-specific and list variables #151

Closed Lypaka-Dev closed 5 years ago

Lypaka-Dev commented 5 years ago

I can't say for sure if InfoBoard supports global variables or not (I haven't tested that) but I DID try to use a player specific variable from Skript in the board.yml file and it didn't work.

Global variable {example.variable} InfoBoard's way of supporting that: %skript_<{example.variable}>% (I guess? It wouldn't really make sense to me to not have us put the { } symbols)

Player-specific variable: {example.variable::%player%} It seems to me that the first % sign in the variable is throwing off InfoBoard, thinking that is the end of the variable assignment? parsing? from Skript and tries to load that, because my board shows: N/Aplayer%}>% Giving me the impression that everything before it ( -> %skript<{locationOf::%player%} -> %skript<{locationOf::% ) is what is being pulled as the variable to load, which of course returns N/A because that variable doesn't exist, leaving the rest of the intended variable behind, printed as normal text.

List variable: {example.variable::*} Just throwing this here because I mentioned it in the topic, so in such case that support for it needs to be added, the developer(s) adding it can see how they are formatted/written in Skript

pixar02 commented 5 years ago

I am saying this as it is clear that you don't know it, all palceholders are player specific (since a player calls for the replacement of a placeholder). I don't know skript and the way it works. But what I think you need to do is this:

If the varaible {example.variable} -> becomes this: "Hello World!". This means that {} is a identifier for Skript, and the identifier for PAPI is %. And since PAPI already recognized the placeholder Skript doesn't have to do the same thing again. Then all you need to do to use the Skript placeholders is this: %skript_example.variable%

Also the placeholder %player% doesn't exist. This is a list with all the variables: link.

As I said before I don't know Skript (the plugin), the only thing that I notice is that it is way to simple for something this complex (minecraft/spigot/bukkit)...

Lypaka-Dev commented 5 years ago

The difference between {example.variable} and {example.variable::%player%}:

If I assign a value, a string, to {example.variable}, that value will be the same for every player on the server.

Whereas, using {example.variable::%player%} assigns the player's name to the variable therefore assigning a value to the variable that is specific to each individual player.

To give a better example, the variable I am trying to use is {locationOf::%player%} that gets saved (and changed) based on where the respective player is at the time the code that modifies the variable is run.

If I were to change the Skript to use {example.variable}, then the board would show incorrect data because of that variable having the same value across the whole server. If player A is over at the west side of the map but player B is over on the east side and causes the variable {locationOf.player} to change, then the board is going to show the player is the west that he is in the east and that's obviously not correct.

If I'm still not explaining that part very well, maybe this page and the screenshots (that hopefully uploaded correctly below) can help clear some confusion: http://en.njol.ch/projects/skript/doc/variables

I did some trial and error with removing some characters from the .yml file from the board and its still coming up as N/A, so unfortunately I guess I'm going to have to scrap the idea and move on to something else. It overall isn't a big deal to me whether it works or not, was just a cosmetic thing. boardfile skriptfile wiki

Edit: as you suggested, I removed the {} and <> symbols from the file. The screenshot was captured before that moment.

pixar02 commented 5 years ago

If {locationOff::%player%} is parsed by Skript does it does it return the correct value?

Also you said that it gives N/A, is that something you coded with Skript? If so ok, if not then PAPI is doing something wrong.

I think what may be happening is that PAPI sees %player% and tries to replace it which would break the Skript variable you have set... You said that the %player% contains the name, try %player_name% instead. (My onderstanding of the placeholder %player% is the instance of the player not the name, but I will take your word for it)

Lypaka-Dev commented 5 years ago

No, my Skript file is only set to change the value of the variable when the player moves in a radius around a eyeballed center point of those areas, doing the first two areas on my map as a test to see if it would work before doing the whole thing. "N/A" isn't coming from my Skript file. However, since the board is showing "N/A" it gives me the impression that the board is in fact reading the variable but there is no value assigned to it. Exploring all possibilities, it is possible that the board file loads the Skript variable before a value is ever assigned to it. I will make a command so I can manually set a value to the variable so the server is started with a value for that variable definitely defined.

Update: manually assigning a variable and also making sure the board file reads - '%skript_locationOf::player_name%' (was the only way I could get it to read the whole thing without taking the first % sign at the beginning of %player% as the end of the variable) (also trying both player and player_name) and it is still returning N/A. All in all, the board is reading the value and Skript is assigning the value (I made another command to relay the value that Skript has for that variable back to me) its just the two aren't communicating the value of that variable to each other very well. Its not that one plugin isn't working correctly, I just think overall the two (in this special, oddball case) are not compatible.

pixar02 commented 5 years ago

What I could find on the Expansion: LINK

Placeholders

Placeholder Usage
%skript_\<variable name>% %skript_test::hey%

Replacements

Note: Replacements are placeholders that you can use within placeholders.

Format

{<replacement>}
# or if you wanted to use this with MvdW plugins for whatever reason
%<replacement>%
Replacement Usage
player's uuid, uuid of player, uuid %skript_test::{uuid}%
player's name, name of player, player, name %skript_test::{player}%
Lypaka-Dev commented 5 years ago

Oh, hey, its working! Its even updating the variable value as I change between the two test locations. Thanks a bunch! Although, it updates the board at a rather slower-than-expected rate. Is there a way to increase the time increment that the board updates?

pixar02 commented 5 years ago

Normally the placeholders are updated at the same time as the board, so in the config you can change the Update time of the lines. By default it is set to 0.5 seconds.... (when you change this be aware of Ticks, , 1 second = 20 ticks)

Lypaka-Dev commented 5 years ago

I'll try that, then. Thanks for all your help!

pixar02 commented 5 years ago

No problem! Happy to help!