-
Notifications
You must be signed in to change notification settings - Fork 7
Ahorn Scripts
⚠️ Using any Ahorn scripts might break your map if you're not careful! Remember to take a backup of your map before running anything.
By default you will not be able to open the debug console. To enable it open ahorn and go to Edit -> Settings -> Debug
, and check Debug menu dropdown
. A debug dropdown will become available, with opening the console being one of its options.
loadedState.map.package = "abc"
for room in loadedState.side.map.rooms
for bgdecal in room.bgDecals
bgdecal.texture = replace(bgdecal.texture, "OldFolderName" => "NewFolderName")
end
end
for room in loadedState.side.map.rooms
for bgdecal in room.bgDecals
bgdecal.texture = replace(bgdecal.texture, "OldFolderName" => "NewFolderName")
end
end
m = loadMap("AbsolutePathToYour.bin")
fg = deepcopy(m.style.foregrounds)
bg = deepcopy(m.style.backgrounds)
append!(loadedState.map.style.foregrounds, fg)
append!(loadedState.map.style.backgrounds, bg)
return true
for room in loadedState.side.map.rooms
for entity in room.entities
if entity.name == "FrostHelper/IceSpinner"
entity.data["directory"] = "danger/FrostHelper/icecrystal", # change to what you want
entity.data["spritePathSuffix"] = "", # change to what you want
entity.data["destroyColor"] = "b0eaff", # change to what you want
entity.data["tint"] = "ffffff", # change to what you want
entity.data["bloomAlpha"] = 0.0, # change to what you want
entity.data["bloomRadius"] = 0.0, # change to what you want
entity.data["moveWithWind"] = false, # change to what you want
entity.data["dashThrough"] = false, # change to what you want
entity.data["rainbow"] = false, # change to what you want
entity.data["collidable"] = true # change to what you want
end
end
end
for room in loadedState.side.map.rooms
for entity in room.entities
if entity.name == "spinner"
# create new spinner copying the old one
newSpinner = Entity("FrostHelper/IceSpinner", Dict{String,Any}(
"x" => entity.data["x"],
"y" => entity.data["y"],
"attachToSolid" => entity.data["attachToSolid"],
"destroyColor" => "b0eaff", # change to what you want
"directory" => "danger/FrostHelper/icecrystal", # change to what you want
"spritePathSuffix" => "", # change to what you want
"tint" => "ffffff", # change to what you want
"moveWithWind" => false, # change to what you want
"dashThrough" => false, # change to what you want
"bloomAlpha" => 0.0, # change to what you want
"bloomRadius" => 0.0, # change to what you want
"rainbow" => false, # change to what you want
"collidable" => true, # change to what you want
), entity.id)
push!(room.entities, newSpinner)
end
end
# remove all vanilla spinners
filter!(entity -> entity.name != "spinner", room.entities)
end
for room in loadedState.side.map.rooms
for entity in room.entities
if entity.name == "FrostHelper/IceSpinner"
# create new spinner copying the old one
newSpinner = Entity("spinner", Dict{String,Any}(
"x" => entity.data["x"],
"y" => entity.data["y"],
"attachToSolid" => entity.data["attachToSolid"],
"color" => "Blue", # change to what you want - can be Blue,Red,Purple,Rainbow
"dust" => false, # change to what you want
), entity.id)
push!(room.entities, newSpinner)
end
end
# remove all Custom Spinners
filter!(entity -> entity.name != "FrostHelper/IceSpinner", room.entities)
end
m = loadMap("AbsolutePathToYour.bin")
roomName = "lvl_a-00"
room = getRoomByName(m, roomName)
push!(loadedState.map.rooms, room)
updateTreeView!(roomList, getTreeData(loadedState.map))
return true
roomName = "1"
room = getRoomByName(loadedState.map, roomName)
roomcopy = deepcopy(room)
roomcopy.name = "1-copy"
roomcopy.position = roomcopy.position .+ (200,200)
push!(loadedState.map.rooms, roomcopy)
updateTreeView!(roomList, getTreeData(loadedState.map))
return true
empty!(loadedState.map.fillers)
for room in Ahorn.loadedState.map.rooms
room.position = room.position .+ (0, 500)
end
updateTreeView!(roomList, getTreeData(loadedState.map))
for room in Ahorn.loadedState.map.rooms
room.color = 0
end
updateTreeView!(roomList, getTreeData(loadedState.map))
println.(getfield.(Ahorn.loadedState.map.rooms, :name))
Credit to orbittwz, JaThePlayer, and coloursofnoise for the wonderful scripts.
The following scripts are designed to be run directly in the Julia terminal, not the Ahorn debug console.
Most of these are not complete scripts, but snippets designed to pasted into the terminal in the desired sequence. A baseline knowledge of programming is highly recommended.
To write your own scripts, reference the Maple Source 🔗.
In order to use Maple from any Julia terminal, it needs to be added to the global package scope:
julia> using Pkg
julia> Pkg.add(PackageSpec(url="https://github.com/CelestialCartographers/Maple.git"))
From then on, enter using Maple
in every new terminal session to import and use the Maple package.
cd("pathToNewFolder")
pwd() # Pring Working Directory
side = loadSide("filePath")
map = side.map
encodeSide(side, "filePath")
for file in filter(f -> endswith(f, ".bin"), readdir("."))
# do stuff
end
set = Set(Base.map(d -> d.texture, Iterators.flatten([[room.bgDecals;room.fgDecals] for room in map.rooms])))
# sort and output to a file
write("decals.txt", join(sort(collect(set)), "\n"))
for room in map.rooms
filter!(d -> !startswith(d.texture, "starting text", room.fgDecals)
filter!(d -> !startswith(d.texture, "starting text", room.bgDecals)
end
startswith
can be replaced with endswith
or contains
as appropriate.
Supports Regular Expressions 🔗 such as "any letter" (r"[a-zA-Z]"
).
Home
Contributing
FAQ
Useful Links
Your First Custom Map
Your First Texture Pack
Mod Setup
Custom Maps
Texture Packs
Uploading Mods
Generated Dialog Keys
Reference Code Mod🔗
Vanilla Audio IDs
Character Portraits
Mod Structure
Debug Mode
Command Line Arguments
Environment Variables
Install Issues
Common Crashes
Latency Guide
everest.yaml Setup
Mapping FAQ
Map Metadata
Vanilla Metadata Reference
Adding Custom Dialogue
Overworld Customisation
Entity & Trigger Documentation
Custom Entity List🔗
Camera
Ahorn Scripts
Custom Tilesets
Tileset Format Reference
Stylegrounds
Reskinning Entities
Skinmods
Decal Registry
Chapter Complete Screen
Custom Portraits
Adding Custom Audio
Advanced Custom Audio
Code Mod Setup
Making Code Mods
Mod Settings
Everest Events
Understanding Input
Logging
Cross-Mod Functionality
Recommended Practices
Core Migration Guide
Lönn Integration🔗
Custom Events
Adding Sprites
Adding Preexisting Audio