#How to make a specific role to one user, in a staff list?
1 messages · Page 1 of 1 (latest)
wait
return "owner", "headdmin" and "admin
command /stafflist:
aliases: staff
trigger:
loop getStaffTypes():
broadcast "count of %loop-value%: %size of {stafflist::%loop-value%::*}%"
on join:
loop getStaffTypes():
if player has permission "staff.%loop-value%":
add player to {stafflist::%loop-value%::*}
stop #stop for op players
on quit:
loop getStaffTypes():
if player has permission "staff.%loop-value%":
remove player from {stafflist::%loop-value%::*}
```
use like this
you're welcome
wdym?
ah, yes, python
so if lists were to be able to be made in skript
why are you using wait 0 tick
you do realize you can just
use if size of {owner::*} > 0:?
i copied this code so yeha
ohh
if you de-indent everything from line 42
because now the send is in the loop
but that shouldnt be the case
also please remake this it's horribly inefficient xd
well now i am xd
how fluent/experienced are you in python
like a year
mostly experienced in discord bots
so you are familiar with dictionaries/dicts correct
yep
alright so lists in skript are not actual lists/arrays like other languages
they are a key value system, just like dictionaries in python
so when you do set {_hi::*} to "apple", "orange" and "banana" what its actually making is a dictionary or hashmap (what its referred to as in java) that looks like
{
"1": "apple",
"2": "orange",
"3": "banana"
}
skript by default uses numerical indices when setting a list directly or when adding to it, and due to it being a dictionary, thats why all indices are strings
ah
so then when you do {_hi::1}, you are accessing the "first" element in the list, because well thats the key value pair with 1 as the key and indices are sorted alphabetically
so then of course you can do set {_hi::hello} to "something" to add a custom key value pair
and when you just use {_hi::*} its just going to return all the values, if you want the keys, you can do indices of {_hi::*}
and due to it being a dictionary, you can also add another dictionary inside it, so in turn you can do set {_hi::uhh::yeah} to 5, expanding the example output to something like
{
"1": "apple",
"2": "orange",
"3": "banana",
"uhh": {
"yeah": 5
}
}
be a little careful with that last thing
with set {_hi::uhh::yeah} to 5
{_hi::*} will not show you any 5s or other lists
It only shows elements at that level
so {_hi::uhh} doesn't actually exist, only {_hi::uhh::*} and {_hi::uhh::yeah}
just trying to get you to understand how lists work in skript given an example of what you are already familiar with
loop-value-n
n being the number of the embedded loop
understood
hmm so simple question,
so line 54
add player to {stafflist::%loop-value%::*}
```, does this make * player?
it makes {stafflist::%loop-value%::1} player, given there's nothing already in the list
otherwise 1 is size of list + 1
so is 1 integer value of player?
no, it's just an index
okay
if you send {stafflist::%loop-value%::1}, it will send the player's name
{stafflist::%loop-value%::1} is the player, 1 is the index
and of course, 1 could be any number really, depends on how many indices are used already
I want the player name to actually appear, like StaffRank: player's username
as the index?
there's no real reason to have their name in the index in this situation, tbh
then just do this
just send the variable
like I said here
if you send {stafflist::%loop-value%::*}, it will send all the names of the players in the list
has anyone pointed out that this code would only set the last loop player to anything? Since every loop begind with clearing the lists
i presumed they were using the code deichor sent
send it
i was in the process of doing that, excuse me 😂
but i guess i should never ask to ask
what is it?
looks like im gonna send the whole command code
brb
apparently the last line makes an indention error
sorry for the late reply
delete the indentation and place whatever indentation used in the rest of the script
I don't know what that means, can you ellaborate?
see the dots? They are spaces.
the arrows are tabs
choose one and stick with it
let me know if that still doesn't make sense xD
im glad you said that 😂
i've always indented using tabs
and since i use python i know how to indent in a python-y way, so it feels confusing to see a different indention system
you feel me?
it's the same
just use tabs
the problems happen when you use both at the same time
yeah just go for tabs
skript accepts all kinds of indentation, you just need to be consistent
yeah thats what i was trying to do
it fixed 3 errors for reindenting a command
now for the very final question
how do i access loop values outside the loop, if somehow possible
why cucumber?
loop-value-1 loop-value-2 ....
just reference the list with an index
did you get auto cucumbered?
with this question, thats basically saying
for i in someList:
print(i)
# how do i access the variable i here, outside of the loop
true
so just access the list with an index of what you want
imma try
btw skript harder than python 
it has more builtin methods
even though it is english-ish
skript is basically java, but simplified
so there will be lots of stuff
in conclusion, pure skript is harder than pure python
unless you use python to send actual emails
good luck doing that with skript
skemail exists, just for sending emails within skript
just a joke dude, just a joke...
dont ask me why it exists, it just does
why the hell does that exist ;-;
that means skript is overall better than python
well not really
nope it isn't better than python
does skript have sql support
for what?
economy
skriptdb allows you to use sql (if it works, idk if it still does)
don't use skript-db
im used to mongodb anyways
but skript has vanilla hook into vault, which means most economy plugins can just be accessed by using player's balance
skript has "built in" sql support for variables but it doesnt work
mongosk exists 😉
mongodb isn't sql, mongodb is nosql
which is a mighty fine addon if i do say so myself
Skript's data storage is really bad.
what a ram killer
if you would use csv for a database
you are an absolute idiot
even json is better
csv is faster to parse and easier for noobs to edit
yeah skript's variables are not meant to be used as a database
I think the skript should support mongodb and redis combo. This makes it an excellent plugin.
it wont anytime soon, best bet would be to write an addon to do it
it should actually
i think an addon would be better
many people have treated it like a database and then their server performance tanks and the file gets huge really fast
usding a database sudch as csv and json could break very fast
because well skript just stores the variables in ram all at the same time because its not a database
it's a ✨ map ✨
website dbs are the best
im a map im a map im a map
nope it isn't
because you dont rely on your ram
do do do dorra
I guess you don't know much about data
Oh no! we need your help finding a key!
o.o
the problem with dbs is that they're relatively slow
so for things like variables you want fast things like a map in ram
yes that's why we use redis.
i've used mongodb for like 5 months
and it treated me well
it adds data in collections in a snap
well yes for things like player data you can use variables and when they leave, push to the db to update, and when they join pull from the db for that session and then periodically push to the db for redundancy
MongoDB is good but it doesn't keep the data in ram for you.
look hear me out
you need a host to actually use csv
relying on local ram is just the worse
especially when you have a low end pc... like me unfortunately
what?
csv is just a file format
skript reads the file and loads it into a map in memory
no host needed
i mean it is good
am i the only one realizing this help thread just became a second general chat
in some aspects yes
nice
mongoose
anyways out of stupidity i respectfully dont know what this means so i need a small example 


eg:
list[index_variable]
->
{list::%{_index_variable}%}
works, now another error came to me 😩😩 do these end?
anyways so there is no error but it says I am JrHelper, but i am op so i have all the perms anyways, how do i do if the loop-player is op then we check their username, if they are a certain username then it sends another message
or is it basically just
if loop-player is op:
if loop-player's username is "something":
send "..." to player
so its 2:38 am rn and i need to get some sleep, ill respond to this forum tomorrow, gn everyone!
i still need a lil help
Do not write here without trying some things.
well i did try things
okay that makes sense