You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By using Reflection, it is possible to make certain things easier.
The goal is to make it really easy to add chat-commands for Starfall projects.
V1 code example:
[ChatCommand("test")]// Permission defaults to myself-only.publicstaticvoidTestCmd(BasePlayerinvoker,stringargs){Assert(invoker==Owner,"BUGCHECK");printf("Test chat command. args=%s",args);}[ChatCommand("hidden",HideChat=true)]// Hides owner's chatpublicstaticvoidHideTestCmd(BasePlayerinvoker,stringargs){print("Hidden command entered.");}[ChatCommand("join",ChatCommandPermission.Anyone)]// Let anyone run thispublicstaticvoidJoinCmd(BasePlayerinvoker,stringargs){printf("%s has joined the party!",invoker.Name);}
The above design could be upgraded by implementing a parser and have arguments fully-typed out method.
V2 code example:
This version is slightly more complex to make it work, but it would be nicer and more fluent.
To run the command, you'd say: /install --name "a string here" --flag true
Which should output the following:
Activity
Cheatoid commentedon Apr 2, 2021
Moved to vNext; This will be added in future version.