-
Notifications
You must be signed in to change notification settings - Fork 72
Open
Description
I noticed that my commands with scope attribute values like object1=inventory|object2=container weren't really doing anything in a teeny tiny test game.
Note
It only seems to effect commands with allow_all set to true.
So, I modified GetScoping:
<function name="GetScoping" parameters="scopestring, variable" type="string">
lst = Split(scopestring, "|")
if (ListCount(lst) = 1) {
return (scopestring)
}
foreach (s, lst) {
if (StartsWith(s, variable + "=")) {
return (Mid(s, LengthOf(variable) + 2))
}
else if (variable = "object") { // This else if is new
if (StartsWith(s, "object1=") or StartsWith(s, "object2=")) {
return (Mid(s, LengthOf(variable) + 3))
}
}
}
return ("all")
</function>That seems to fix the issue, but I usually overlook things.
Before modifying GetScoping:
Details
<!--Saved by Quest 5.9.9166.36226-->
<asl version="580">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="GetScoping tester">
<gameid>c8ec1adb-0b53-4c16-b5cb-0e5e16c61be8</gameid>
<version>1.0</version>
<firstpublished>2026</firstpublished>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
<object name="blue frob">
<inherit name="editor_object" />
<take />
</object>
<object name="yellow frob">
<inherit name="editor_object" />
<take />
</object>
<object name="Bob">
<inherit name="editor_object" />
<inherit name="namedmale" />
</object>
</object>
<command name="cmd_foo">
<pattern>foo #object1# at #object2#</pattern>
<scope>object1=inventory|object2=notheld</scope>
<script>
msg ("cmd_foo...")
OutputTextNoBr ("object1: ")
msg (object1)
OutputTextNoBr ("object2: ")
msg (object2)
</script>
<allow_all />
</command>
</asl>To test that, enter FOO ALL AT BOB.
Based on the scope, I would expect ALL to mean things in my inventory for object1 and the opposite for object2, but ALL for either (or both) will mean everything visible.
Now, the same game, with the modified GetScoping:
Details
<!--Saved by Quest 5.9.9166.36226-->
<asl version="580">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="GetScoping tester">
<gameid>c8ec1adb-0b53-4c16-b5cb-0e5e16c61be8</gameid>
<version>1.1</version>
<firstpublished>2026</firstpublished>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
<object name="blue frob">
<inherit name="editor_object" />
<take />
</object>
<object name="yellow frob">
<inherit name="editor_object" />
<take />
</object>
<object name="Bob">
<inherit name="editor_object" />
<inherit name="namedmale" />
</object>
</object>
<command name="cmd_foo">
<pattern>foo #object1# at #object2#</pattern>
<scope>object1=inventory|object2=notheld</scope>
<script>
msg ("cmd_foo...")
OutputTextNoBr ("object1: ")
msg (object1)
OutputTextNoBr ("object2: ")
msg (object2)
</script>
<allow_all />
</command>
<function name="GetScoping" parameters="scopestring, variable" type="string">
lst = Split(scopestring, "|")
if (ListCount(lst) = 1) {
return (scopestring)
}
foreach (s, lst) {
if (StartsWith(s, variable + "=")) {
return (Mid(s, LengthOf(variable) + 2))
}
else if (variable = "object") {
if (StartsWith(s, "object1=") or StartsWith(s, "object2=")) {
return (Mid(s, LengthOf(variable) + 3))
}
}
}
return ("all")
</function>
</asl>Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels