Skip to content

Instantly share code, notes, and snippets.

@AdaDoom3
Created October 17, 2013 05:31
Show Gist options
  • Save AdaDoom3/7019564 to your computer and use it in GitHub Desktop.
Save AdaDoom3/7019564 to your computer and use it in GitHub Desktop.
Video game "cvar" test
...
----------
-- Test --
----------
procedure Test
is
procedure Put_Success(
Parameters : in String_2)
is
begin
Put_Line(Localize("success") & Parameters);
end Put_Success;
procedure Adjust(
P : in Boolean;
C : in Boolean)
is
begin
Put_Line(Localize("Variable_Test is being adjusted from ") & Boolean'wide_image(P) & Localize(" to ") & Boolean'wide_image(C));
end Adjust;
package Y
is new Action(
Perform => Put_Success,
Name => "Command_Test");
package X
is new Variable(
Type_To_Vary => Boolean,
Initial => False,
Name => "Variable_Test",
Description => "Its a test",
Is_Saved => True,
Adjust => Adjust'access);
package Z
is new Variable(
Type_To_Vary => Integer,
Initial => 0,
Name => "Variable_Test2",
Description => "Its another test");
begin
Put_Title(Localize("COMMAND TEST"));
Put(Localize("An error message for unknown command: "));
Handle("Makeanerror!");
Handle("Variable_Test True123");
Handle("Variable_Test True");
Put_Line(Localize("Value after handle: ") & Boolean'wide_image(X.Get));
X.Set(False);
Put_Line(Localize("Value after set: ") & Boolean'wide_image(X.Get));
Handle("Variable_Test2");
Put(Localize("The command system executed with "));
Handle("Command_Test !");
end Test;
...
--________________________________________________________________________________
--
-- C O M M A N D T E S T
--________________________________________________________________________________
--
--An error message for unknown command: No such variable or command!
--Incorrect parameter for variable_test: true123
--variable_test: Its a test
--Current value: FALSE
--Possible values: FALSE, TRUE
--Variable_Test is being adjusted from FALSE to TRUE
--Value after handle: TRUE
--Variable_Test is being adjusted from TRUE to FALSE
--Value after set: FALSE
--variable_test2: Its another test
--Current value: 0
--Possible values: -2147483648..2147483647
--The command system executed with success!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment