Hello There, Guest! Login Register


Translate this Json to Lau Script please
#1
Can somebody translate this json to lau please, its a script going to Cerulean Cave

"path": [
        {
            "condition": ["isPokemon1Usable"],
            "actions": [
                {
                    "condition": ["map", "Pokecenter Cerulean"],
                    "action": ["moveToMap", "Cerulean City"]
                },
                {
                    "condition": ["all",
                            ["map", "Cerulean City"],
                            ["inRectangle", [1,19],[29,35]]
                                ],
                    "action": ["moveToMap", "Route 4"]
                },
                {
                    "condition": ["map", "Route 4"],
                    "action": ["moveToCell", [96,14]]
                },
                {
                    "condition": ["all",
                            ["map", "Cerulean City"],
                            ["inRectangle", [1,9],[13,16]]
                                ],
                    "action": ["moveToMap", "Cerulean Cave 1F"]
                },
                {
                    "condition": ["map", "Cerulean Cave 1F"],
                    "action": ["moveToRectangle", [44,31], [50,36]]
                }
            ]
        },

my biggest concern is this part
{
                    "condition": ["all",
                            ["map", "Cerulean City"],
                            ["inRectangle", [1,19],[29,35]]
                                ],
                    "action": ["moveToMap", "Route 4"]
                },

Thanks
 
Reply
#2
AlpaZero Can somebody translate this json to lau please, its a script going to Cerulean Cave

"path": [
        {
            "condition": ["isPokemon1Usable"],
            "actions": [
                {
                    "condition": ["map", "Pokecenter Cerulean"],
                    "action": ["moveToMap", "Cerulean City"]
                },
                {
                    "condition": ["all",
                            ["map", "Cerulean City"],
                            ["inRectangle", [1,19],[29,35]]
                                ],
                    "action": ["moveToMap", "Route 4"]
                },
                {
                    "condition": ["map", "Route 4"],
                    "action": ["moveToCell", [96,14]]
                },
                {
                    "condition": ["all",
                            ["map", "Cerulean City"],
                            ["inRectangle", [1,9],[13,16]]
                                ],
                    "action": ["moveToMap", "Cerulean Cave 1F"]
                },
                {
                    "condition": ["map", "Cerulean Cave 1F"],
                    "action": ["moveToRectangle", [44,31], [50,36]]
                }
            ]
        },

my biggest concern is this part
{
                    "condition": ["all",
                            ["map", "Cerulean City"],
                            ["inRectangle", [1,19],[29,35]]
                                ],
                    "action": ["moveToMap", "Route 4"]
                },

Thanks

Here, try this. I have not been able to fully test it as I don't have access to Cerulean Cave, I also don't know the (minX, minY, maxX, maxY) coordinates of Cerulean City, so just fill this in where I have them labled. Please respond soon with an update on it's performance. Smile

if isPokemonUsable(1) then
        if getMapName() == "Pokecenter Cerulean" then
            moveToMap("Cerulean City")
        elseif (getMapName() == "Cerulean City" and isInRectangle(MinX, MinY, MaxX, MaxY)) then
            moveToMap("Route 4")
        elseif getMapName() == "Route 4" then
            moveToCell(96, 14)
        elseif (getMapName() == "Cerulean City" and isInRectangle(MinX, MinY, MaxX, MaxY)) then
            moveToMap("Cerulean Cave 1F")
        elseif getMapName() == "Cerulean Cave 1F" then
            moveToRectangle(minX, minY, maxX, maxY)
        end
If you want a personalized script, feel free to DM me. I have nothing better to do.  Big Grin
 
Reply
#3
Tiki
AlpaZero Can somebody translate this json to lau please, its a script going to Cerulean Cave

"path": [
        {
            "condition": ["isPokemon1Usable"],
            "actions": [
                {
                    "condition": ["map", "Pokecenter Cerulean"],
                    "action": ["moveToMap", "Cerulean City"]
                },
                {
                    "condition": ["all",
                            ["map", "Cerulean City"],
                            ["inRectangle", [1,19],[29,35]]
                                ],
                    "action": ["moveToMap", "Route 4"]
                },
                {
                    "condition": ["map", "Route 4"],
                    "action": ["moveToCell", [96,14]]
                },
                {
                    "condition": ["all",
                            ["map", "Cerulean City"],
                            ["inRectangle", [1,9],[13,16]]
                                ],
                    "action": ["moveToMap", "Cerulean Cave 1F"]
                },
                {
                    "condition": ["map", "Cerulean Cave 1F"],
                    "action": ["moveToRectangle", [44,31], [50,36]]
                }
            ]
        },

my biggest concern is this part
{
                    "condition": ["all",
                            ["map", "Cerulean City"],
                            ["inRectangle", [1,19],[29,35]]
                                ],
                    "action": ["moveToMap", "Route 4"]
                },

Thanks

Here, try this. I have not been able to fully test it as I don't have access to Cerulean Cave, I also don't know the (minX, minY, maxX, maxY) coordinates of Cerulean City, so just fill this in where I have them labled. Please respond soon with an update on it's performance. Smile

if isPokemonUsable(1) then
        if getMapName() == "Pokecenter Cerulean" then
            moveToMap("Cerulean City")
        elseif (getMapName() == "Cerulean City" and isInRectangle(MinX, MinY, MaxX, MaxY)) then
            moveToMap("Route 4")
        elseif getMapName() == "Route 4" then
            moveToCell(96, 14)
        elseif (getMapName() == "Cerulean City" and isInRectangle(MinX, MinY, MaxX, MaxY)) then
            moveToMap("Cerulean Cave 1F")
        elseif getMapName() == "Cerulean Cave 1F" then
            moveToRectangle(minX, minY, maxX, maxY)
        end

I havent tried it yet since server is offline, hope it works Smile

but the "isInRectangle" is not in here https://api.proshine-bot.com/#introduction, will this still work?
 
Reply
#4
AlpaZero
Tiki
AlpaZero Can somebody translate this json to lau please, its a script going to Cerulean Cave

"path": [
        {
            "condition": ["isPokemon1Usable"],
            "actions": [
                {
                    "condition": ["map", "Pokecenter Cerulean"],
                    "action": ["moveToMap", "Cerulean City"]
                },
                {
                    "condition": ["all",
                            ["map", "Cerulean City"],
                            ["inRectangle", [1,19],[29,35]]
                                ],
                    "action": ["moveToMap", "Route 4"]
                },
                {
                    "condition": ["map", "Route 4"],
                    "action": ["moveToCell", [96,14]]
                },
                {
                    "condition": ["all",
                            ["map", "Cerulean City"],
                            ["inRectangle", [1,9],[13,16]]
                                ],
                    "action": ["moveToMap", "Cerulean Cave 1F"]
                },
                {
                    "condition": ["map", "Cerulean Cave 1F"],
                    "action": ["moveToRectangle", [44,31], [50,36]]
                }
            ]
        },

my biggest concern is this part
{
                    "condition": ["all",
                            ["map", "Cerulean City"],
                            ["inRectangle", [1,19],[29,35]]
                                ],
                    "action": ["moveToMap", "Route 4"]
                },

Thanks

Here, try this. I have not been able to fully test it as I don't have access to Cerulean Cave, I also don't know the (minX, minY, maxX, maxY) coordinates of Cerulean City, so just fill this in where I have them labled. Please respond soon with an update on it's performance. Smile

if isPokemonUsable(1) then
        if getMapName() == "Pokecenter Cerulean" then
            moveToMap("Cerulean City")
        elseif (getMapName() == "Cerulean City" and isInRectangle(MinX, MinY, MaxX, MaxY)) then
            moveToMap("Route 4")
        elseif getMapName() == "Route 4" then
            moveToCell(96, 14)
        elseif (getMapName() == "Cerulean City" and isInRectangle(MinX, MinY, MaxX, MaxY)) then
            moveToMap("Cerulean Cave 1F")
        elseif getMapName() == "Cerulean Cave 1F" then
            moveToRectangle(minX, minY, maxX, maxY)
        end

I havent tried it yet since server is offline, hope it works Smile

but the "isInRectangle" is not in here https://api.proshine-bot.com/#introduction, will this still work?
I'm not sure either, I didn't get a chance to test that function myself before the server went back offline. That's why I wanted you to update me on it's performance :o
If you want a personalized script, feel free to DM me. I have nothing better to do.  Big Grin
 
Reply
#5
sadly i got this error
Error during the script execution: chunk_1:(9,2-80): attempt to call a nil value

and here's the code after I use your code above and input the data in X and Y Coord
function onPathAction()
    if isPokemonUsable(1) then
        if getMapName() == "Pokecenter Cerulean" then
            moveToMap("Cerulean City")
        elseif (getMapName() == "Cerulean City" and isInRectangle(1, 19, 29, 35)) then
                moveToMap("Route 4")
        elseif getMapName() == "Route 4" then
                moveToCell(96, 14)
        elseif getMapName() == "Cerulean City" and isInRectangle(1, 9, 13, 16) then
                    moveToMap("Cerulean Cave 1F")
        elseif getMapName() == "Cerulean Cave 1F" then
                moveToRectangle(X, X, X, X)
        end
 
Reply
#6
isInRectangle does not exist. You have to use getPlayerX and getPlayerY.
 
Reply
#7
Silv3r isInRectangle does not exist. You have to use getPlayerX and getPlayerY.
Sir, will it have same result with the isInRectangle? can you please make a little script example please please
 
Reply
#8
x = getPlayerX()
y = getPlayerY()
if x >= 10 and y >= 7 and x <= 15 and y <= 9 then
  -- Do something in the rectangle [10,7] [15,9]
end
 
Reply
#9
Silv3r
x = getPlayerX()
y = getPlayerY()
if x >= 10 and y >= 7 and x <= 15 and y <= 9 then
  -- Do something in the rectangle [10,7] [15,9]
end

thankyou so much! Smile Ill try it right away
 
Reply
#10
Silv3r
x = getPlayerX()
y = getPlayerY()
if x >= 10 and y >= 7 and x <= 15 and y <= 9 then
  -- Do something in the rectangle [10,7] [15,9]
end
Well there's something I definitely don't like about .lua.. That is so much more tedious to write. :lol: Thanks anyway Silv3r
If you want a personalized script, feel free to DM me. I have nothing better to do.  Big Grin
 
Reply
#11
You can recode the function isInRectangle...

function isInRectangle(x1, y1, x2, y2)
  x = getPlayerX()
  y = getPlayerY()
  return x >= x1 and y >= y1 and x <= x2 and y <= y2
end

... then use it anywhere.

if isInRectangle(10, 7, 15, 9) then
end

It is only tedious if we do not structure our scripts into smaller parts.
 
Reply
  


Forum Jump:


Browsing: 1 Guest(s)