Solved "Func" Function doesn't work in java 1.12.2

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

iStopcontact

Member
Feb 18, 2017
113
2
18
23
Hey guys, i am working on a server network but found a little mistake.

Now i have diffrent servers 1.8/1.9 but now im working on a gamemode for 1.12.2 and i found out that the "function" part doesnt work in my skript.

Now i allready updated my skript to a 1.12.2 version but i still get the error:
Can't understand this event: 'func "WoWgetvalue"

I have this in my skript:
Code:
func "WoWgetValue":
    set {_p} to parameter 1
    set {_p} to {_p} parsed as offline player
    set {_uuid} to uuid of {_p}
    set {_table} to parameter 2
    set {_column} to parameter 3
    execute "SELECT * FROM %unsafe {_table}% WHERE uuid=%{_uuid}%" in {WoWDB} and store the results in {_value::*}
    set {_value} to {_value::%{_column}%::1}
    set transient "output" to {_value}
    $ access
    set {_WoWgetValue} to transient "output"
    return

can someone help me with this?
[doublepost=1555349784,1555346887][/doublepost]just saw a error popping up in the console when i reload the skript:

Code:
[19:35:14 WARN]: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
[19:35:14 WARN]: SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[19:35:14 WARN]: SLF4J: Defaulting to no-operation (NOP) logger implementation
 
Hey guys, i am working on a server network but found a little mistake.

Now i have diffrent servers 1.8/1.9 but now im working on a gamemode for 1.12.2 and i found out that the "function" part doesnt work in my skript.

Now i allready updated my skript to a 1.12.2 version but i still get the error:
Can't understand this event: 'func "WoWgetvalue"

I have this in my skript:
Code:
func "WoWgetValue":
    set {_p} to parameter 1
    set {_p} to {_p} parsed as offline player
    set {_uuid} to uuid of {_p}
    set {_table} to parameter 2
    set {_column} to parameter 3
    execute "SELECT * FROM %unsafe {_table}% WHERE uuid=%{_uuid}%" in {WoWDB} and store the results in {_value::*}
    set {_value} to {_value::%{_column}%::1}
    set transient "output" to {_value}
    $ access
    set {_WoWgetValue} to transient "output"
    return

can someone help me with this?
[doublepost=1555349784,1555346887][/doublepost]just saw a error popping up in the console when i reload the skript:

Code:
[19:35:14 WARN]: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
[19:35:14 WARN]: SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[19:35:14 WARN]: SLF4J: Defaulting to no-operation (NOP) logger implementation
I am not good with function but I think you need to define names and types here you have a tutorial
I hope this can help you
 
I am not good with function but I think you need to define names and types here you have a tutorial
I hope this can help you
I use SkQuery for the "Func" so that should be good...
And it works when i use it in an 1.8.9 server but doenst in 1.12.2 while the plugins are all up to date
 
You need to use the updated fork by @LimeGlass (but not sure what he removed). You could also convert it to a Skript function but as there is a delay in the execute effect, it wouldn't actually return a value so you'd need to workaround that.

code_language.skript:
function WoWgetValue(p: player, table: string, column: string):
    set {_p} to {_p} parsed as offline player
    set {_uuid} to uuid of {_p}
    execute "SELECT * FROM %unsafe {_table}% WHERE uuid=%{_uuid}%" in {WoWDB} and store the results in {_value::*}
    set {_WoWgetValue} to {_value::%{_column}%::1}
 
If Skript functions don't work because of the delay, you can also use skript-mirror with custom effects, since that does support delays.
and also reply to @BaeFell

I used a updated SKQuery, but now i got another error:

Code:
[19:01:03 ERROR]: Can't understand this condition/effect: $ access (WorldOfWar.sk, line 15: $ access')
[19:01:03 ERROR]: Can't understand this condition/effect: return (WorldOfWar.sk, line 17: return')


because i don't really know how to use like the origional skript fuction i learned it with SkQuery
 
Sure (I think this should be it):
Code:
function WoWgetValue(p: offline player, table: string, column: string):
    execute "SELECT * FROM %unsafe {_table}% WHERE uuid=%uuid of {_p}%" in {WoWDB} and store the results in {_value::*}
    return {_value::%{_column}%::1}
How to use it:
Code:
set {_value} to WoWgetValue(player, "table", "column")
There is a chance that that doesn't work, since the MySQL command could have a delay bound to it. If that is the case, tell me if it doesn't work (it might even give a parsing error), and I'll make the code in skript-mirror
 
Allright thanks man! I will try to use this
[doublepost=1555445235,1555435260][/doublepost]
Sure (I think this should be it):
Code:
function WoWgetValue(p: offline player, table: string, column: string):
    execute "SELECT * FROM %unsafe {_table}% WHERE uuid=%uuid of {_p}%" in {WoWDB} and store the results in {_value::*}
    return {_value::%{_column}%::1}
How to use it:
Code:
set {_value} to WoWgetValue(player, "table", "column")
There is a chance that that doesn't work, since the MySQL command could have a delay bound to it. If that is the case, tell me if it doesn't work (it might even give a parsing error), and I'll make the code in skript-mirror
i cant really get it working, maybe im doing something wrong im not sure...
Is it possible we go in discord call or smt and i screen share what i have
 
Allright thanks man! I will try to use this
[doublepost=1555445235,1555435260][/doublepost]
i cant really get it working, maybe im doing something wrong im not sure...
Is it possible we go in discord call or smt and i screen share what i have
Sure, but not today, and maybe also not tomorrow. I might be able to solve it if you send your code tho
 
Sure, but not today, and maybe also not tomorrow. I might be able to solve it if you send your code tho
I now have this code:

Code:
function WoWgetValue(p: offline player, table: string, column: string):
    set {_p} to {_p} parsed as offline player
    set {_uuid} to uuid of {_p}
    execute "SELECT * FROM %unsafe {_table}% WHERE uuid=%{_uuid}%" in {WoWDB} and store the results in {_value::*}
    set {_value} to WoWgetValue(player, "table", "column")

and just to test it i have this code:

Code:
command /testcmd:
    trigger:
        access "WoWgetValue" from "%name of player%" and "WoW_Playerstats" and "Country"
        if {_value} is not set:
            broadcast "test"


And when i reload i get this error:

Code:
Functions cannot be used here (or there is a problem with your arguments). (WorldOfWar.sk, line 27: set {_value} to WoWgetValue(player, "table", "column")')
[22:23:57 ERROR]: Can't understand this condition/effect: access "WoWgetValue" from "%name of player%" and "WoW_Playerstats" and "Country" (WorldOfWar.sk, line 46: access "WoWgetValue" from "%name of player%" and "WoW_Playerstats" and "Country"')
 
Try to copy the function and the line to call the function exactly.
Code:
function WoWgetValue(p: offline player, table: string, column: string) :: object:
    set {_uuid} to uuid of {_p}
    execute "SELECT * FROM %unsafe {_table}% WHERE uuid=%{_uuid}%" in {WoWDB} and store the results in {_value::*}
    return {_value::%{_column}%::1}
   
command /testcmd:
    trigger:
        set {_value} to WoWgetValue(player, "WoW_Playerstats", "Country")
        broadcast "value: %{_value}%"
 
Last edited:
Try to copy the function and the line to call the function exactly.
Code:
function WoWgetValue(p: offline player, table: string, column: string):
    set {_uuid} to uuid of {_p}
    execute "SELECT * FROM %unsafe {_table}% WHERE uuid=%{_uuid}%" in {WoWDB} and store the results in {_value::*}
    return {_value::%{_column}%::1}
   
command /testcmd:
    trigger:
        set {_value} to WoWgetValue(player, "WoW_Playerstats", "Country")
        broadcast "value: %{_value}%"
I get these 2 errors:
Code:
A return statement after a delay is useless, as the calling trigger will resume when the delay starts (and won't get any returned value) (WorldOfWar.sk, line 72: return {_value::%{_column}%::1}')
and
Code:
Functions cannot be used here (or there is a problem with your arguments). (WorldOfWar.sk, line 76: set {_value} to WoWgetValue(player, "WoW_Playerstats", "Coins")')
 
Sorry, I forgot to add a return type. But it doesn't matter, since the mysql execute command effect has a delay built in, so you have to use skript-mirror. I'm currently on my phone, so I can't make it for you. Meanwhile, give it a try yourself (google skript-mirror docs)
 
Sorry, I forgot to add a return type. But it doesn't matter, since the mysql execute command effect has a delay built in, so you have to use skript-mirror. I'm currently on my phone, so I can't make it for you. Meanwhile, give it a try yourself (google skript-mirror docs)
Yheaa i will try and see if i can work something out, btw thank you are doing this it helps me allot
[doublepost=1555604129,1555534903][/doublepost]
Sorry, I forgot to add a return type. But it doesn't matter, since the mysql execute command effect has a delay built in, so you have to use skript-mirror. I'm currently on my phone, so I can't make it for you. Meanwhile, give it a try yourself (google skript-mirror docs)
I have to be honnest, didnt really got it working and dont really understand how to work with it...

So i hope you or someone can help me to make it for me
 
Sure:
Code:
effect WoWgetValue from [[offline] player] %offline player%, [table] %string% (and|,) [column] %string%:
    trigger:
        delay the effect
        set {_uuid} to uuid of expression-1
        delete {effect::WoWgetValue::return}
        execute "SELECT * FROM %unsafe expression-2% WHERE uuid=%{_uuid}%" in {WoWDB} and store the results in {_value::*}
        set {effect::WoWgetValue::return} to {_value::%expression-3%::1}
        continue
        
expression [last] WoWgetValue result:
    get:
        return {effect::WoWgetValue::return}
        
on skript unload:
    delete {effect::WoWgetValue::return}
How to use:
Code:
command /getvalue:
    trigger:
        WoWgetValue from player, "test" and "test"
        set {_value} to last WoWgetValue result
        message "value: %{_value}%"
 
Sure:
Code:
effect WoWgetValue from [[offline] player] %offline player%, [table] %string% (and|,) [column] %string%:
    trigger:
        delay the effect
        set {_uuid} to uuid of expression-1
        delete {effect::WoWgetValue::return}
        execute "SELECT * FROM %unsafe expression-2% WHERE uuid=%{_uuid}%" in {WoWDB} and store the results in {_value::*}
        set {effect::WoWgetValue::return} to {_value::%expression-3%::1}
        continue
       
expression [last] WoWgetValue result:
    get:
        return {effect::WoWgetValue::return}
       
on skript unload:
    delete {effect::WoWgetValue::return}
How to use:
Code:
command /getvalue:
    trigger:
        WoWgetValue from player, "test" and "test"
        set {_value} to last WoWgetValue result
        message "value: %{_value}%"
Thank you man... sorry for all the work you had to do for mee man
Really appreciate it!
 
Status
Not open for further replies.