本文整理汇总了C#中CmdRequest.GetString方法的典型用法代码示例。如果您正苦于以下问题:C# CmdRequest.GetString方法的具体用法?C# CmdRequest.GetString怎么用?C# CmdRequest.GetString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CmdRequest
的用法示例。
在下文中一共展示了CmdRequest.GetString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExecuteRequest
public override CmdResult ExecuteRequest(CmdRequest args)
{
string to_op = args.GetString("verb");
string objname = args.GetString("target");
if (objname == "")
{
return Failure("$bot don't know what object to use.");
}
if (to_op == "")
{
SimObject objToUse;
if (WorldSystem.tryGetPrim(objname, out objToUse))
{
if ((BotNeeds) TheSimAvatar["CurrentNeeds"] == null)
{
TheSimAvatar["CurrentNeeds"] = new BotNeeds(90.0f);
}
SimTypeUsage usage = objToUse.Affordances.GetBestUse((BotNeeds) TheSimAvatar["CurrentNeeds"]);
if (usage == null)
{
//usage = new MoveToLocation(TheSimAvatar, objToUse);
return Failure("$bot don't have a use for " + objToUse + " yet.");
}
TheSimAvatar.Do(usage, objToUse);
return Success("used " + objToUse);
}
return Failure("$bot don't know what to do with " + objname);
}
WriteLine("Trying to (" + to_op + ") with (" + objname + ")");
TheBotClient.UseInventoryItem(to_op, objname);
return Success("completed to (" + to_op + ") with (" + objname + ")");
}
示例2: ExecuteRequest
public override CmdResult ExecuteRequest(CmdRequest args)
{
if (args.Length < 2) return ShowUsage();
BotClient oBotClient = ClientManager.GetBotByName(args.GetString("avatar"));
if (oBotClient != TheBotClient) return Success("not for me");
string botcmd = args.GetString("command");
return
Success("tobot " + oBotClient + " " +
oBotClient.ExecuteCommand(botcmd, args.CallerAgent, args.Output, args.CmdFlags));
}
示例3: ExecuteRequest
public override CmdResult ExecuteRequest(CmdRequest args)
{
string verb = args.CmdName;
// base.acceptInput(verb, args);
UUID primID = UUID.Zero;
SimActor TheSimAvatar = this.TheSimAvatar;
if (verb == "stop-following")
{
// SimPosition ap = TheSimAvatar.ApproachPosition;
if (TheSimAvatar.CurrentAction is MoveToLocation)
{
TheSimAvatar.CurrentAction = null;
}
TheSimAvatar.SetMoveTarget(null, 10);
TheSimAvatar.StopMoving();
}
SimPosition position;
if (!args.TryGetValue("target", out position))
{
return Failure("$bot don't know who " + args.GetString("target") + " is.");
}
{
if (position != null)
{
String str = "" + Client + " start to follow " + position + ".";
WriteLine(str);
// The thread that accepts the Client and awaits messages
TheSimAvatar.CurrentAction = new FollowerAction(TheSimAvatar, position);
return Success("$bot started following " + position);
}
}
{
return Success("$bot ApproachPosition: " + TheSimAvatar.CurrentAction);
}
}
示例4: ExecuteRequest
public override CmdResult ExecuteRequest(CmdRequest args)
{
if (args.Length == 0)
{
return ShowUsage();
}
List<SimObject> PS;
if (!args.TryGetValue("targets", out PS) || IsEmpty(PS))
{
return Failure("Cannot find objects from " + args.GetString("targets"));
}
foreach (var o in PS)
{
//SimObject o = WorldSystem.GetSimObject(currentPrim);
Primitive.ObjectProperties Properties = o.Properties;
if (Properties == null)
{
Failure("Still waiting on properties for " + o);
continue;
}
GridClient client = TheBotClient;
client.Objects.BuyObject(o.GetSimulator(), o.LocalID, Properties.SaleType,
Properties.SalePrice, client.Self.ActiveGroup,
client.Inventory.FindFolderForType(AssetType.Object));
AddSuccess(Name + " on " + o);
}
return SuccessOrFailure();
}
示例5: ExecuteRequest
public override CmdResult ExecuteRequest(CmdRequest args)
{
if (args.Length < 1) return ShowUsage();
string botcmd = args.GetString("act");
TheSimAvatar.CurrentAction = new CommandAction(TheSimAvatar, botcmd);
return Success(string.Format("{0} CurrentAction = {1}", TheSimAvatar, botcmd));
}
示例6: ExecuteRequest
public override CmdResult ExecuteRequest(CmdRequest args)
{
string mustHave = ": "; // everything
bool detailed = false;
if (args.Length > 0)
{
mustHave = args.str.ToLower().TrimEnd('s') + ": ";
detailed = true;
}
int found = 0;
var dictionary = TheBotClient.AllCommands();
foreach (string action in dictionary.Keys)
{
CommandInfo info = dictionary[action];
string overview = action.TrimEnd('s') + ": " + info.Description;
string s = overview + " " + info.Details;
if (!s.ToLower().Contains(mustHave))
{
continue;
}
found++;
WriteLine("[HELP] " + overview);
if (detailed)
{
WriteLine(info.Details);
}
}
if (found == 0) WriteLine("I don't know about the verb " + args.GetString("topic") + ".");
return Success("Help complete");
}
示例7: ExecuteRequest
public override CmdResult ExecuteRequest(CmdRequest args)
{
UUID masterUUID;
if (!args.TryGetValue("master", out masterUUID))
{
TheBotClient.MasterName = args.GetString("master");
}
else
{
TheBotClient.MasterKey = masterUUID;
}
return Success(string.Format("Master set to {0} ({1})", Client.MasterName, Client.MasterKey.ToString()));
}
示例8: ExecuteRequest
public override CmdResult ExecuteRequest(CmdRequest args)
{
if (args.Length < 1)
return ShowUsage(); // " load AssemblyNameWithoutExtension";
BotClient Client = TheBotClient;
string assemblyName = args.GetString("assembly");
string cmd = args.GetString("command");
try
{
if (assemblyName.Contains(" "))
{
assemblyName = args.GetString("assembly");
}
if (SkippedAssemblies.Contains(assemblyName.ToLower())) return Success("Assembly " + assemblyName + " loaded.");
Assembly assembly = FindAssembly(assemblyName);
if (assembly == null) return Failure("failed: load " + assemblyName + " cant find it");
Client.InvokeAssembly(assembly, cmd, WriteLine);
return Success("Assembly " + assemblyName + " loaded.");
}
catch (ReflectionTypeLoadException e)
{
foreach (var s in e.LoaderExceptions)
{
Failure("failed: load " + s.TargetSite + " " + s);
}
return Failure("failed: load " + assemblyName + " " + e);
}
catch (Exception e)
{
return Failure("failed: load " + assemblyName + " " + e);
}
finally
{
// AppDomain.CurrentDomain.AssemblyResolve -= CurrentDomain_AssemblyResolve;
}
}
示例9: ExecuteRequest
public override CmdResult ExecuteRequest(CmdRequest args)
{
if (args.Length < 1)
return ShowUsage(); // " touch UUID";
List<SimObject> PS;
if (!args.TryGetValue("targets", out PS) || IsEmpty(PS))
{
return Failure("Cannot find objects from " + args.GetString("targets"));
}
GridClient client = TheBotClient;
foreach (var targetPrim in PS)
{
AddSuccess(Name + " on " + targetPrim);
Client.Self.Touch(targetPrim.LocalID);
}
return SuccessOrFailure();
}
示例10: ExecuteRequest
public override CmdResult ExecuteRequest(CmdRequest args)
{
UUID primID = UUID.Zero;
if (args.Length < 1)
{
return ShowUsage();
}
List<SimObject> PS;
if (!args.TryGetValue("targets", out PS) || IsEmpty(PS))
{
return Failure("Cannot find objects from " + args.GetString("targets"));
}
foreach (var target in PS)
{
WorldSystem.DeletePrim(target.Prim);
WriteLine("\n {0}", target);
AddSuccess("Done.");
}
return SuccessOrFailure();
}
示例11: ExecuteRequest
public override CmdResult ExecuteRequest(CmdRequest args)
{
List<SimObject> PS;
if (!args.TryGetValue("targets", out PS) || IsEmpty(PS))
{
return Failure("Cannot find objects from " + args.GetString("targets"));
}
{
int nfound = 0;
foreach (var prim in PS)
{
Client.Self.SendTeleportLure(prim.ID);
AddSuccess(Name + ": " + prim);
nfound++;
}
if (nfound > 0) return Success(Name + " found: " + nfound + " object/agent(s)");
}
string user = args.str;
UUID id = WorldSystem.GetUserID(user);
if (id == UUID.Zero) return Failure("Cannot find " + user);
Client.Self.SendTeleportLure(id);
return Success("teleport Lure sent to " + user);
}
示例12: ExecuteRequest
public override CmdResult ExecuteRequest(CmdRequest args)
{
if (args.Length != 1)
return ShowUsage(); // " taskrunning objectID [[scriptName] true|false]";
List<SimObject> PS;
if (!args.TryGetValue("targets", out PS) || IsEmpty(PS as ICollection))
{
PS = WorldSystem.GetAllSimObjects();
}
string matching = args.GetString("match");
string tf = args.GetString("set").ToLower();
foreach (var found in PS)
{
uint objectLocalID = found.LocalID;
UUID objectID = found.ID;
List<InventoryBase> items = Client.Inventory.GetTaskInventory(objectID, objectLocalID, 1000*30);
//bool wantSet = false;
bool setTaskTo = false;
if (items != null)
{
string result = String.Empty;
bool setAny = false;
if (tf == "true")
{
setAny = true;
setTaskTo = true;
}
else if (tf == "false")
{
setAny = true;
setTaskTo = false;
}
bool wasRunning = false;
EventHandler<ScriptRunningReplyEventArgs> callback;
using (AutoResetEvent OnScriptRunningReset = new AutoResetEvent(false))
{
callback = ((s, e) =>
{
if (e.ObjectID == objectID)
{
result += String.Format(" IsMono: {0} IsRunning: {1}", e.IsMono,
e.IsRunning);
wasRunning = e.IsRunning;
OnScriptRunningReset.Set();
}
});
Client.Inventory.ScriptRunningReply += callback;
for (int i = 0; i < items.Count; i++)
{
if (items[i] is InventoryFolder)
{
// this shouldn't happen this year
result += String.Format("[Folder] Name: {0}", items[i].Name) + Environment.NewLine;
}
else
{
InventoryItem item = (InventoryItem) items[i];
AssetType assetType = item.AssetType;
result += String.Format("[Item] Name: {0} Desc: {1} Type: {2}", item.Name,
item.Description,
assetType);
if (assetType == AssetType.LSLBytecode || assetType == AssetType.LSLText)
{
OnScriptRunningReset.Reset();
Client.Inventory.RequestGetScriptRunning(objectID, item.UUID);
if (!OnScriptRunningReset.WaitOne(10000, true))
{
result += " (no script info)";
}
if (setAny && item.Name.Contains(matching))
{
if (wasRunning != setTaskTo)
{
OnScriptRunningReset.Reset();
result += " Setting " + setTaskTo + " => ";
Client.Inventory.RequestSetScriptRunning(objectID, item.UUID, setTaskTo);
if (!OnScriptRunningReset.WaitOne(10000, true))
{
result += " (was not set)";
}
}
}
}
result += Environment.NewLine;
}
}
}
Client.Inventory.ScriptRunningReply -= callback;
AddSuccess(result);
}
//.........这里部分代码省略.........
示例13: ExecuteRequest
public override CmdResult ExecuteRequest(CmdRequest args)
{
if (args.Length < 1)
return ShowUsage(); // " exportparticles [prim-uuid]";
List<SimObject> PS;
if (!args.TryGetValue("targets", out PS) || IsEmpty(PS))
{
return Failure("Cannot find objects from " + args.GetString("targets"));
}
foreach (var o in PS)
{
Primitive exportPrim = o.Prim;
if (exportPrim.ParticleSys.CRC != 0)
{
StringBuilder lsl = new StringBuilder();
#region Particle System to LSL
lsl.Append("default" + Environment.NewLine);
lsl.Append("{" + Environment.NewLine);
lsl.Append(" state_entry()" + Environment.NewLine);
lsl.Append(" {" + Environment.NewLine);
lsl.Append(" llParticleSystem([" + Environment.NewLine);
lsl.Append(" PSYS_PART_FLAGS, 0");
if ((exportPrim.ParticleSys.PartDataFlags & Primitive.ParticleSystem.ParticleDataFlags.InterpColor) !=
0)
lsl.Append(" | PSYS_PART_INTERP_COLOR_MASK");
if ((exportPrim.ParticleSys.PartDataFlags & Primitive.ParticleSystem.ParticleDataFlags.InterpScale) !=
0)
lsl.Append(" | PSYS_PART_INTERP_SCALE_MASK");
if ((exportPrim.ParticleSys.PartDataFlags & Primitive.ParticleSystem.ParticleDataFlags.Bounce) != 0)
lsl.Append(" | PSYS_PART_BOUNCE_MASK");
if ((exportPrim.ParticleSys.PartDataFlags & Primitive.ParticleSystem.ParticleDataFlags.Wind) != 0)
lsl.Append(" | PSYS_PART_WIND_MASK");
if ((exportPrim.ParticleSys.PartDataFlags & Primitive.ParticleSystem.ParticleDataFlags.FollowSrc) !=
0)
lsl.Append(" | PSYS_PART_FOLLOW_SRC_MASK");
if ((exportPrim.ParticleSys.PartDataFlags &
Primitive.ParticleSystem.ParticleDataFlags.FollowVelocity) != 0)
lsl.Append(" | PSYS_PART_FOLLOW_VELOCITY_MASK");
if ((exportPrim.ParticleSys.PartDataFlags & Primitive.ParticleSystem.ParticleDataFlags.TargetPos) !=
0)
lsl.Append(" | PSYS_PART_TARGET_POS_MASK");
if ((exportPrim.ParticleSys.PartDataFlags & Primitive.ParticleSystem.ParticleDataFlags.TargetLinear) !=
0)
lsl.Append(" | PSYS_PART_TARGET_LINEAR_MASK");
if ((exportPrim.ParticleSys.PartDataFlags & Primitive.ParticleSystem.ParticleDataFlags.Emissive) !=
0)
lsl.Append(" | PSYS_PART_EMISSIVE_MASK");
lsl.Append(",");
lsl.Append(Environment.NewLine);
lsl.Append(" PSYS_SRC_PATTERN, 0");
if ((exportPrim.ParticleSys.Pattern & Primitive.ParticleSystem.SourcePattern.Drop) != 0)
lsl.Append(" | PSYS_SRC_PATTERN_DROP");
if ((exportPrim.ParticleSys.Pattern & Primitive.ParticleSystem.SourcePattern.Explode) != 0)
lsl.Append(" | PSYS_SRC_PATTERN_EXPLODE");
if ((exportPrim.ParticleSys.Pattern & Primitive.ParticleSystem.SourcePattern.Angle) != 0)
lsl.Append(" | PSYS_SRC_PATTERN_ANGLE");
if ((exportPrim.ParticleSys.Pattern & Primitive.ParticleSystem.SourcePattern.AngleCone) != 0)
lsl.Append(" | PSYS_SRC_PATTERN_ANGLE_CONE");
if ((exportPrim.ParticleSys.Pattern & Primitive.ParticleSystem.SourcePattern.AngleConeEmpty) != 0)
lsl.Append(" | PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY");
lsl.Append("," + Environment.NewLine);
lsl.Append(" PSYS_PART_START_ALPHA, " +
String.Format("{0:0.00000}", exportPrim.ParticleSys.PartStartColor.A) + "," +
Environment.NewLine);
lsl.Append(" PSYS_PART_END_ALPHA, " +
String.Format("{0:0.00000}", exportPrim.ParticleSys.PartEndColor.A) + "," +
Environment.NewLine);
lsl.Append(" PSYS_PART_START_COLOR, " + exportPrim.ParticleSys.PartStartColor.ToRGBString() +
"," + Environment.NewLine);
lsl.Append(" PSYS_PART_END_COLOR, " + exportPrim.ParticleSys.PartEndColor.ToRGBString() +
"," + Environment.NewLine);
lsl.Append(" PSYS_PART_START_SCALE, <" +
String.Format("{0:0.00000}", exportPrim.ParticleSys.PartStartScaleX) + ", " +
String.Format("{0:0.00000}", exportPrim.ParticleSys.PartStartScaleY) + ", 0>, " +
Environment.NewLine);
lsl.Append(" PSYS_PART_END_SCALE, <" +
String.Format("{0:0.00000}", exportPrim.ParticleSys.PartEndScaleX) + ", " +
String.Format("{0:0.00000}", exportPrim.ParticleSys.PartEndScaleY) + ", 0>, " +
Environment.NewLine);
lsl.Append(" PSYS_PART_MAX_AGE, " +
String.Format("{0:0.00000}", exportPrim.ParticleSys.PartMaxAge) + "," +
Environment.NewLine);
lsl.Append(" PSYS_SRC_MAX_AGE, " +
String.Format("{0:0.00000}", exportPrim.ParticleSys.MaxAge) + "," + Environment.NewLine);
lsl.Append(" PSYS_SRC_ACCEL, " + exportPrim.ParticleSys.PartAcceleration.ToString() + "," +
Environment.NewLine);
lsl.Append(" PSYS_SRC_BURST_PART_COUNT, " +
String.Format("{0:0}", exportPrim.ParticleSys.BurstPartCount) + "," + Environment.NewLine);
lsl.Append(" PSYS_SRC_BURST_RADIUS, " +
String.Format("{0:0.00000}", exportPrim.ParticleSys.BurstRadius) + "," +
//.........这里部分代码省略.........
示例14: ExecuteRequest
public override CmdResult ExecuteRequest(CmdRequest args)
{
//base.acceptInput(verb, args);
return Success(ClientManager.evalLispString(args.GetString("code")));
}
示例15: ExecuteRequest
public override CmdResult ExecuteRequest(CmdRequest args)
{
if (args.Length < 2) return ShowUsage();
string interp = args[0];
return TheBotClient.ExecuteTask(args.GetString("interp"), new StringReader(args.GetString("code")), WriteLine);
}