Errors with ascii conversion?

  • 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 community!

    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.
Jan 31, 2017
25
0
0
Hi, I'm trying to make a simple function to convert text to rot13. I'm using skutilities' ascii expressions to accomplish this, however I get errors in console whenever I try to convert from ascii back to text.

Skript Version (do not put latest): Skript 2.2 (dev35b)
Skript Author: Bensku
Minecraft Version: 1.12.2
---
Full Code:
code_language.skript:
function rot13(input: text) :: text:
    set {_output} to ""
    set {_string::*} to {_input} split at ""
   
    set {_size} to size of {_string::*}
    delete {_string::%{_size}%}
   
    loop {_string::*}:
        set {_ascii} to convert text "%loop-value%" to ascii
        set {_ascii} to {_ascii} parsed as an integer
        if {_ascii} is between 65 and 90:
            set {_caps} to true
        else if {_ascii} is between 97 and 122:
            set {_caps} to false
        else:
            set {_output} to "%{_output}%%loop-value%"
       
        if {_caps} is set:
            set {_new} to {_ascii} + 13
            if {_caps} is true:
                if {_new} > 90:
                    set {_new} to {_new} - 26
            else:
                if {_new} > 122:
                    set {_new} to {_new} - 26
           
            set {_new} to {_new} parsed as an integer
            set {_replace} to convert ascii {_new} to string
            set {_output} to "%{_output}%%{_replace}%"
       
        delete {_caps}
   
    return {_output}


Console Errors:

pastebin

Addons:
SkUtilities (0.9.2), skquery, skrayfall, advancementsaddon, facsk, mundosk, tuske, vixio, wolvsk (the others really shouldn't be relevant)

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

---

The function gets called by a simple command, like so:
code_language.skript:
command /rot13 <text>:
    description: Returns a rot13 cipher of any text you provide.
    executable by: players and console
    trigger:
        set {_result} to rot13(arguments)
        message "&3Result: <tooltip:§dClick to copy text.><suggest command:%{_result}%>&f%{_result}%"
 
Status
Not open for further replies.