I have no clue how to upload a txt file, so I’ll just paste the scripts here. There’s three of them that were made, two being the same, with slightly different requirements. I just want to know if they would work, or if there’s any changes that would be needed for them.
– Define the character and room profile changes
local targetCharacter = “Alice” – Character name to trigger the change
local enterProfile = “WelcomeProfile”
local exitProfile = “DefaultProfile”
– Event handler for character entering a room
function onEnterRoom(character, room)
if character.name == targetCharacter then
– Change the room profile when the target character enters
room:setProfile(enterProfile)
print(character.name .. " entered. Room profile set to " .. enterProfile)
end
end
– Event handler for character leaving a room
function onLeaveRoom(character, room)
if character.name == targetCharacter then
– Revert or change the room profile when the target character leaves
room:setProfile(exitProfile)
print(character.name .. " left. Room profile set to " .. exitProfile)
end
end
– Register event handlers
registerEvent(“enterRoom”, onEnterRoom)
registerEvent(“leaveRoom”, onLeaveRoom)
– Configuration
local TARGET_CHARACTER = “Alice” – Character that triggers the change
local ENTER_PROFILE = “WelcomeProfile” – Profile applied when entering
local EXIT_PROFILE = “DefaultProfile” – Profile applied when leaving
– Function to handle character entering a room
function handleEnterRoom(event)
local character = event.character
local room = event.room
-- Check if the character is the one we want
if character.name == TARGET_CHARACTER then
-- Change the room profile
if room.setProfile then
room:setProfile(ENTER_PROFILE)
print("[" .. character.name .. "] entered the room. Profile set to: " .. ENTER_PROFILE)
else
print("Error: room:setProfile function not found.")
end
end
end
– Function to handle character leaving a room
function handleLeaveRoom(event)
local character = event.character
local room = event.room
-- Check if the character is the one we want
if character.name == TARGET_CHARACTER then
-- Revert or change the room profile
if room.setProfile then
room:setProfile(EXIT_PROFILE)
print("[" .. character.name .. "] left the room. Profile set to: " .. EXIT_PROFILE)
else
print("Error: room:setProfile function not found.")
end
end
end
– Register the events with Mucklet
registerEvent(“enterRoom”, handleEnterRoom)
registerEvent(“leaveRoom”, handleLeaveRoom)
– Configuration
local WELCOME_MESSAGE = “Welcome to the room! Enjoy your stay.”
– Function triggered when a character enters a room
function handleEnterRoom(event)
local character = event.character
local room = event.room
-- Send a message to the character
if character.sendMessage then
character:sendMessage(WELCOME_MESSAGE)
print("Sent welcome message to " .. character.name .. " upon entering " .. room.name)
else
print("Error: character:sendMessage function not available.")
end
end
– Register the event with Mucklet
registerEvent(“enterRoom”, handleEnterRoom)
If this was the incorrect way to post this, please let me know. I have no clue how to set this.