Skip to content

Rider/default script#5383

Draft
Rider-Linden wants to merge 7 commits intoproject/lua_editorfrom
rider/default_script
Draft

Rider/default script#5383
Rider-Linden wants to merge 7 commits intoproject/lua_editorfrom
rider/default_script

Conversation

@Rider-Linden
Copy link
Contributor

@Rider-Linden Rider-Linden commented Feb 6, 2026

Description

The viewer may now indicate to the server which default script to use when creating a new script in either task or agent inventory.
Optionally the viewer may also provide the ID of a script in the agent's inventory, this script will be used instead of the default script.

Future Work

Default script choice is determined by what the server supports. If it supports SLua it will use the lua default, otherwise it will select the LSL default.

We should provide some sort of user option to select which default to use. There is also no interface at this time for selecting an alternate default template from inventory, this would be useful to provide as well.

Related Issues

Simulator: https://github.com/secondlife/server/pull/2344
Message Template: secondlife/master-message-template#4


Additional Notes

This also cherry picks the updateLoginButtons fix.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the viewer’s script-creation flow so it can tell the simulator which default script template/language to use (LSL vs Lua) when creating a new script, removing the prior “create then immediately overwrite code” workaround.

Changes:

  • Extend the RezScript message with an optional NewScriptInfo block containing script language and optional template item ID.
  • Update viewer script creation paths (task inventory + agent inventory) to pick Lua defaults when LuaScriptsEnabled is advertised by simulator features.
  • Cherry-pick fix to ensure the login connect button is wired/defaulted earlier during LLPanelLogin construction.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
scripts/messages/message_template.msg.sha1 Updates message template hash to reflect protocol change.
scripts/messages/message_template.msg Adds NewScriptInfo block to RezScript message definition.
indra/newview/llviewerobject.h Updates LLViewerObject::saveScript() signature to accept language/template parameters; switches header guard to #pragma once.
indra/newview/llviewerobject.cpp Sends NewScriptInfo when creating a brand-new script (null asset UUID).
indra/newview/llviewerinventory.h Introduces LANG_ID_LSL/LANG_ID_LUA constants and moves NO_INV_SUBTYPE to constexpr.
indra/newview/llviewerinventory.cpp Removes Lua “post-create upload hack”; uses subtype to request Lua default script when supported.
indra/newview/lltooldraganddrop.cpp Updates saveScript() call site to new signature.
indra/newview/llpreviewscript.h Switches header guard to #pragma once.
indra/newview/llpanellogin.cpp Moves connect button wiring/default-button setup earlier (cherry-picked fix).
indra/newview/llpanelcontents.cpp Updates “New Script” (task inventory) creation to request correct language/template via saveScript().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Rider-Linden and others added 5 commits February 6, 2026 11:25
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…e coroutine. This would trigger an attempt to get a mutex which will fail in a coro. Instead post the cleanup back to the mainthread.
LLViewerAssetType::generateDescriptionFor(LLAssetType::AT_LSL_TEXT, desc);

// --------------------------------------------------------------------------------------------------
// Begin hack
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yay!

asset_type,
inv_type,
NO_INV_SUBTYPE,
subtype,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there anywhere else that uses wearabletype this way outside of wearables themselves?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, subtype is also used for settings (Skies, Water, Day Cycles).

As a bonus, the viewer does check this subtype when drawing wearables and settings items and could display a different icon based on script type.

Thinking about it, I'm make a change to the metadata branch that I have which will switch the subtype on a successful compile when it updates the inventory item.


constexpr U8 NO_INV_SUBTYPE{ 0 };
constexpr U8 LANG_ID_LSL = 0;
constexpr U8 LANG_ID_LUA = 1;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If scripts are created as one type, does that constrain the types of compile options you can use for the script once it's created? Is that something the viewer needs to be aware of?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. It does not.

@Rider-Linden Rider-Linden marked this pull request as draft February 10, 2026 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants