Function in function

  • 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.

TCXeption

Member
Apr 2, 2020
16
0
0
33
Hey,

if I try to make a function in a function, then some parsing errors exists.

Skript Version:
Skript 2.5-alpha-3
Skript Author: Bensku
Minecraft Version: 1.12.2
---
Full Code:

Code:
#Monster configuration
function diazombie(round: number, from: number, to: number, apos: number = 1):
 repeatround(%{_round}%,%{_from}%,%{_to}%,"adult zombie",%{_apos}%)
 repeatspeed(%{_round}%,%{_from}%,%{_to}%,3)
 repeathealth(%{_round}%,%{_from}%,%{_to}%,5)
 repeatskull(%{_round}%,%{_from}%,%{_to}%,"Steve")
 repeatarmor(%{_round}%,%{_from}%,%{_to}%,"diamond")
 repeatitem(%{_round}%,%{_from}%,%{_to}%,"diamond sword")
 repeatname(%{_round}%,%{_from}%,%{_to}%,"&9&lDiamantzombie")

on script load:
#Round configuration
 diazombie(1,1,5,1)
 diazombie(2,1,10,1)

And the repeatround function as an example:

Code:
function repeatround(round: number, from: number, to: number, monster: text, apos: number):
 set {_rrloop} to "true"
 while {_rrloop} is "true":
  set {round::%{_round}%::%{_from}%} to {_monster}
  set {pos::%{_round}%::%{_from}%} to {pos%{_apos}%}
  set {_from} to {_from}+1
  if {_from} is greater than {_to}:
   delete {_rrloop}
  wait a tick

The repeatspeed, repeathealth, ... functions have the same structure.


Errors on Reload:

Code:
The 1st argument given to the function 'repeatname' is not of the required type number. Check the correct order of the arguments and put lists into parentheses if appropriate (e.g. 'give(player, (iron ore and gold ore))'). Please note that storing the value in a variable and then using that variable as parameter will suppress this error, but it still won't work. (config.sk, line 128: repeatname(%{_round}%,%{_from}%,%{_to}%,"&9&lDiamantzombie")')

7 errors occurced, so for each repeat function an error with the same structure.

Troubleshooting:

Have you tried searching the docs? No
Have you tried searching the forums? Yes
 
Okay, why?:

Code:
function repeatname(round: number, from: number, to: number, aname: text):
 set {_rnloop} to "true"
 while {_rnloop} is "true":
  set {name::%{_round}%::%{_from}%} to "%{_aname}%"
  set {_from} to {_from}+1
  if {_from} is greater than {_to}:
   delete {_rnloop}
  wait a tick
 
Hey,

if I try to make a function in a function, then some parsing errors exists.

Skript Version:
Skript 2.5-alpha-3
Skript Author: Bensku
Minecraft Version: 1.12.2
---
Full Code:

Code:
#Monster configuration
function diazombie(round: number, from: number, to: number, apos: number = 1):
 repeatround(%{_round}%,%{_from}%,%{_to}%,"adult zombie",%{_apos}%)
 repeatspeed(%{_round}%,%{_from}%,%{_to}%,3)
 repeathealth(%{_round}%,%{_from}%,%{_to}%,5)
 repeatskull(%{_round}%,%{_from}%,%{_to}%,"Steve")
 repeatarmor(%{_round}%,%{_from}%,%{_to}%,"diamond")
 repeatitem(%{_round}%,%{_from}%,%{_to}%,"diamond sword")
 repeatname(%{_round}%,%{_from}%,%{_to}%,"&9&lDiamantzombie")

on script load:
#Round configuration
 diazombie(1,1,5,1)
 diazombie(2,1,10,1)

And the repeatround function as an example:

Code:
function repeatround(round: number, from: number, to: number, monster: text, apos: number):
 set {_rrloop} to "true"
 while {_rrloop} is "true":
  set {round::%{_round}%::%{_from}%} to {_monster}
  set {pos::%{_round}%::%{_from}%} to {pos%{_apos}%}
  set {_from} to {_from}+1
  if {_from} is greater than {_to}:
   delete {_rrloop}
  wait a tick

The repeatspeed, repeathealth, ... functions have the same structure.


Errors on Reload:

Code:
The 1st argument given to the function 'repeatname' is not of the required type number. Check the correct order of the arguments and put lists into parentheses if appropriate (e.g. 'give(player, (iron ore and gold ore))'). Please note that storing the value in a variable and then using that variable as parameter will suppress this error, but it still won't work. (config.sk, line 128: repeatname(%{_round}%,%{_from}%,%{_to}%,"&9&lDiamantzombie")')

7 errors occurced, so for each repeat function an error with the same structure.

Troubleshooting:

Have you tried searching the docs? No
Have you tried searching the forums? Yes

That's not how you pass arguments to a function
Code:
repeatname(%{_round}%,%{_from}%,%{_to}%,"&9&lDiamantzombie")
please read this wiki page it explains how to use variables in skript and when using the percent sign.

correct format: (make sure you passed the correct arguments type to your function parameters)
Code:
repeatname({_round}, {_from}, {_to},"&9&lDiamantzombie")
 
Yes you are right. I have tested it some weeks ago. So the parsing error doesn't exist. But another error comes up:

Invalid function call to a function that does not exist. Be careful when using functions in 'script load' events!
 
Last edited:
Status
Not open for further replies.