Add /setdebug chatbar command. Syntax: /setdebug <debugsetting> <newvalue>
The setting to change this command is SinguCmdLineSetting This command supports using json for complex data types, like vectors. If there's no new value passed, the debug will be changed true<->false, this conversion will have interesting effects on nonboolean types. Have Fun!!
This commit is contained in:
@@ -818,6 +818,17 @@
|
||||
<key>Value</key>
|
||||
<string>/regionsay</string>
|
||||
</map>
|
||||
<key>SinguCmdLineSetting</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Set or toggle debug settings from the chatbar.</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>String</string>
|
||||
<key>Value</key>
|
||||
<string>/setdebug</string>
|
||||
</map>
|
||||
<key>SinguCmdLineURL</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
#include "llagentui.h"
|
||||
#include "llavataractions.h"
|
||||
#include "llnotificationsutil.h"
|
||||
#include "llsdserialize.h"
|
||||
#include "llviewerregion.h"
|
||||
#include "llworld.h"
|
||||
#include "lleventtimer.h"
|
||||
@@ -242,11 +243,11 @@ bool cmd_line_chat(std::string data, EChatType type)
|
||||
static LLCachedControl<bool> enableChatCmd(gSavedSettings, "AscentCmdLine", true);
|
||||
if (enableChatCmd)
|
||||
{
|
||||
data = utf8str_tolower(data);
|
||||
std::istringstream input(data);
|
||||
std::string cmd;
|
||||
|
||||
if (!(input >> cmd)) return true;
|
||||
cmd = utf8str_tolower(cmd);
|
||||
|
||||
static LLCachedControl<std::string> sDrawDistanceCommand(gSavedSettings, "AscentCmdLineDrawDistance");
|
||||
static LLCachedControl<std::string> sHeightCommand(gSavedSettings, "AscentCmdLineHeight");
|
||||
@@ -266,6 +267,7 @@ bool cmd_line_chat(std::string data, EChatType type)
|
||||
static LLCachedControl<std::string> sTP2Command(gSavedSettings, "AscentCmdLineTP2");
|
||||
static LLCachedControl<std::string> sAwayCommand(gSavedSettings, "SinguCmdLineAway");
|
||||
static LLCachedControl<std::string> sURLCommand(gSavedSettings, "SinguCmdLineURL");
|
||||
static LLCachedControl<std::string> sSettingCommand(gSavedSettings, "SinguCmdLineSetting");
|
||||
|
||||
if (cmd == utf8str_tolower(sDrawDistanceCommand)) // dd
|
||||
{
|
||||
@@ -396,7 +398,7 @@ bool cmd_line_chat(std::string data, EChatType type)
|
||||
slurl = LLSLURL(slurl.getRegion(), LLVector3(fmod(agentPos.mdV[VX], (F64)REGION_WIDTH_METERS), fmod(agentPos.mdV[VY], (F64)REGION_WIDTH_METERS), agentPos.mdV[VZ]));
|
||||
}
|
||||
|
||||
LLUrlAction::teleportToLocation(LLWeb::escapeURL(std::string("secondlife:///app/teleport/")+slurl.getLocationString()));
|
||||
LLUrlAction::teleportToLocation(LLWeb::escapeURL("secondlife:///app/teleport/"+slurl.getLocationString()));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -539,6 +541,54 @@ bool cmd_line_chat(std::string data, EChatType type)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else if (cmd == utf8str_tolower(sSettingCommand))
|
||||
{
|
||||
std::string control_name;
|
||||
if (input >> control_name)
|
||||
{
|
||||
// Find out if this control even exists.
|
||||
auto control = gSavedSettings.getControl(control_name);
|
||||
if (!control) gSavedPerAccountSettings.getControl(control_name);
|
||||
if (!control) return false;
|
||||
|
||||
LLSD val;
|
||||
// Toggle if we weren't given a value,
|
||||
if (input.eof()) val = !control->get();
|
||||
else // otherwise use what we were given.
|
||||
{
|
||||
switch (control->type()) // Convert to the right type, we can't be a string forever.
|
||||
{
|
||||
case TYPE_U32: // Integer is Integer, sucks but whatever
|
||||
case TYPE_S32:
|
||||
{
|
||||
LLSD::Integer i;
|
||||
input >> i;
|
||||
val = i;
|
||||
break;
|
||||
}
|
||||
case TYPE_F32:
|
||||
{
|
||||
LLSD::Float f;
|
||||
input >> f;
|
||||
val = f;
|
||||
break;
|
||||
}
|
||||
case TYPE_STRING:
|
||||
{
|
||||
LLSD::String str;
|
||||
std::getline(input, str, '\0'); // Read the entire rest of the stream into str
|
||||
LLStringUtil::trim(str); // There's no setting where a space would be necessary here.
|
||||
val = str;
|
||||
break;
|
||||
}
|
||||
default: // Just parse it like JSON (or accept one of the many boolean value options!
|
||||
LLSDSerialize::fromNotation(val, input, LLSDSerialize::SIZE_UNLIMITED);
|
||||
}
|
||||
}
|
||||
control->set(val);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else if (cmd == "typingstop")
|
||||
{
|
||||
std::string text;
|
||||
|
||||
Reference in New Issue
Block a user