Skript: Using function in function is not working

Created on 30 Sep 2018  Â·  12Comments  Â·  Source: SkriptLang/Skript

function silnia(i: integer) :: integer:
if {_i} < 1:
return 1
else:
set {_x} to silnia({_i}-1)
return {_i} * {_x}

It does not work this way, and the skript breaks down errors.
https://pastebin.com/L72fiE6G

bug low

All 12 comments

Try return round({_i} * {_x})

Try return round({_i} * {_x})

I do not mean using round

Then change integer in the first line to number

Then change integer in the first line to number

I tried using function in function. The integer change to number does not work (the same error) - i want integer, no number.

I know that's what you want to do, but since you're using multiplication, the integers get converted to numbers. If the multiplication returns a integer only, then round will do nothing else then converting it to an integer

I know that's what you want to do, but since you're using multiplication, the integers get converted to numbers. If the multiplication returns a integer only, then round will do nothing else then converting it to an integer

That's work, but i want to ̶r̶e̶t̶u̶r̶n̶ ̶n̶u̶m̶b̶e̶r̶,̶ ̶n̶o̶t̶ ̶i̶t̶e̶m̶ ̶t̶y̶p̶e̶

Item type? Do you know what the round function does?

Item type? Do you know what the round function does?

I wrote wrong, i wan't to return item type, not number

Not exactly most readable error report, but I think there is a real issue here. Integer multiplication should return an integer.

Anyway @Crevsers calling round does the trick like @TPGamesNL said, it basically changes a number like 5.0 to 5

Also you mean integer not item, right?

@Nicofisi The number works, but the integer does not work

@Crevsers use round for now, it's a good workaround

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MrScopes picture MrScopes  Â·  3Comments

jaylawl picture jaylawl  Â·  3Comments

dhgameryt picture dhgameryt  Â·  3Comments

Misio12320 picture Misio12320  Â·  3Comments

DeagoTheDoggo picture DeagoTheDoggo  Â·  3Comments