"New Script" without state_entry() and "Hello, Avatar!" with OwnerSay()
planned
SuzannaLinn Resident
function touch_start(total_number)
ll.Say(0, "Touched.")
end
ll.OwnerSay("Hello, Avatar!")
- It's confusing for LSL scripters who are starting to learn SLua to be told that state_entry() doesn't exist, when the sample script includes it.
- There are many "Hello, Avatar!" messages in scripting classes or sandboxes.
Log In
H
Harold Linden
planned
Thanks for the suggestion! We'll do this when events are revamped.
Frionil Fang
Personally, I'd like a viewer option to just choose which script asset is inserted when you click "new script", as an existing fullperm script from your inventory.
I almost never care for any of the defaults injected, and those hello avatars are annoying while needing to quickly test something in a public place.
Jamesp1989 Resident
Frionil Fang yea being able to set a script as default would be nice
Jamesp1989 Resident
something like
-- Default SLUA script template
-- Use this as a base for more complex functionality
-- Initialization function
function initialize()
llOwnerSay("Script initialized.")
-- Add any setup logic here
end
-- Touch event
function touch_start(total_number)
local toucher = ll.DetectedKey(0)
ll.InstantMessage(toucher, "You touched the object.")
end
-- Timer event
function timer()
ll.OwnerSay("Timer event triggered.")
end
-- Listen event
function listen(channel, name, id, message)
ll.OwnerSay("Heard on channel " .. tostring(channel) .. ": " .. message)
end
-- Run the initialization when the script is loaded
initialize()
-- Optional: Set up a listen or timer if needed
ll.Listen(0, "", NULL_KEY, "") -- Listen on public chat
-- llSetTimerEvent(10.0) -- Uncomment to enable a repeating timer
WolfGang Senizen
Yeh, this was discussed pretty early i think when the example was first put on the wiki. Having an "initialize" function isn't bad, and could probably be considered good practice. But calling it state_entry is just... more confusing than its helpful for being "familiar"
The defaults being owner say has been a suggestion FOREVER, now would be a good time to do it.
The whole script will need to change when the new setup for events is released, so I'm guessing it will be done then, and if possible include your suggestion.