Tips, tricks and info

Find detailed help from the AAO community, or write your own tutorials.

Moderator: EN - Forum Moderators

Post Reply
User avatar
Meph
Posts: 13439
Joined: Mon Nov 10, 2008 10:07 pm
Gender: Male
Spoken languages: English
Location: Probably Disneyland Paris... or the UK

Tips, tricks and info

Post by Meph »

Tips, tricks and info
Here are many tips and tricks for you to use in your cases. These tips and tricks were created by members of the community, so if you would like to contribute to this list, please do so.

Remember: If the answer to what you're looking for isn't on this list, feel free to post a question in the Support Questions forum.

Resources General
  • Sprite and sound wait times
    • The delay for "Objection!", "Hold it!", "Take That!", "Gotcha!", "Eureka!" and "Not so fast!" is 150 centiseconds.
    • The delay for one gavel smash is 100 centiseconds.
    • The delay for three gavel smashes is 150 centiseconds.
    • The delay for the gallery speaking is 300 centiseconds.
    • The delay for Guilty and Not Guilty is 300 centiseconds.
    • The delay for a door opening and closing is 150 centiseconds.
    • The delay for one head nod by Phoenix Wright is 100 centiseconds.
  • No message actions
    Set the wait time to 1 and the action will be run instantly, without creating a pause in the progress. You can stack them and do a lot of things practically at once. However, it is recommended that you merge the statements instead (unless it is not possible).
  • Automatically set voices
    The blip sound used for messages (i.e. male blip, female blip and typewriter) has an auto setting. It is set by the text colour. If it is green, it is typewriter. If it is set as any other colour, it is Male. Female sounds must be set manually. However, it is recommended that you automatically set it as male anyway, rather than relying on the automatic setting.
  • Sound and music at the same time
    Create two statements. Then set the first one with the music and the second one with the sound. Then merge the two statements.
Templates
  • Time and location dialogues:

    Code: Select all

    March 16,[#p10] 10:00 AM[#p5]
    District Courthouse[#p5]
    Courtroon No. 16
Variables
  • Pressing all to proceed Cross-Examinations
    Note that the following is a complex set of instructions.
    1. First of all, each set of pressing statements needs to have an action to set a variable. Each set needs an individual variable. Name them something like press1 and so on for easy remembering.
    2. At the end of each set of pressing statements, you need to use the action Evaluate condition. For the expression, use the following format: press1 & press2 & press3. You can set the jump targets to any statement that you want to.
    3. Repeat the above step at the end of each set of your pressing statements.
    Note: If you need this more than once in a trial, keep in mind that the variables need to be set to 0 manually for the condition to not trigger directly again. Use [#var:press1] in a message if you need to check if the variable have been set or not.

    If this explanation is a bit confusing, read this topic, which might be easier to understand.
  • Skip to a random frame
    Use the action "test a variable's value", set the variable to be the expression "f:random_int(1, 4)" and set a redirection value for 1, 2, 3, 4, etc.
  • Increasing a variable
    Variables can be used as counters for various purposes. To do this, you need to use an expression. The way to do this is to check the "expression" checkbox in a set variable action. To just increment a variable with 1, use the expression "var + 1".

    If you wish to go one step further, you can use this to create loops and other normal program control structures.
  • The expression engine explained
    As a few posts have shown already, we got an expression engine. I felt that someone should give an userfriendly explanation on how it works.

    Quick word list:
    Operator Thing that does stuff to one or more things. The plus sign is an operator.
    Operand A value that an operator operates on.
    Function A named chunk of code that does something. It may return a value.
    Argument or Parameter A value passed to a function for use by the function.
    Prefix Place some text before some other text or the text being placed before.
    Evaluate Fancy word for "Do" or "Check"
    Expression A string of values and operators that has a value.

    As you might already know, it is a custom engine built by unas since he didn't feel like exposing the site to insecure usage of eval.
    The engine is fairly easy to use, it has a these operators:
    • + Add. Add two numbers
    • - Subtract. Subtract one number from another number
    • - Sign flip. Flip the sign of a number
    • / Division. Do an integer only division. Any reminders is thrown away.
    • % Modulus, aka reminder. Gives the reminder of a division.
    • ^ Power. Gives the first number to the power of the second number.
    • & And. Returns a boolean that is true only if both operands is true.
    • | Or. Returns a boolean that is true if one or both of the operands is true.
    • ! Not. Inverts a boolean. True is false and false is true.
    • = Equals. Returns true if both operands are equal.
    • < Less than. Returns true if the left operand is less than the right operand.
    • > Greater than. Returns true if the left operand is greater than the right operand.
    • . Concanation. Joins two strings together.
    The operators have the following priority order:
    1. !
    2. ^
    3. *, / ,%
    4. +, -
    5. >, =, <, .
    6. & and |
    Lower value means that it is done earlier. Operators on the same row is evaluated in a left to right order.
    You can use parentheses to override the operator order by wrapping the sub expression with them.

    If you want to do less than or equal, you got plenty of ways of doing it, you can use <, & and = to do the check, you can use < after adding 1 to the right side and you can use !(x>y). Do the same for greater than or equal.

    There are several functions that you can use:
    • str_begins_with. Checks if one string begins with another.
    • str_contains. Checks if one string is in another.
    • str_ends_with. Checks if one string ends with another.
    • str_first_word. Returns the string up to the first space, the space not being included.
    • str_distance. Returns the percentage of difference between two strings. Returns 100 if they have nothing in common, 0 if they are identical.
    • evidence_is_revealed. Checks if a given evidence ID is revealed. You must pass the type (In French! 'preuve'='evidence' and 'profil'='profile') as the first argument.
    • random_int. Generates a random number. If you call f:random_int(), the number will be chosen between 0 and 100. You can also call f:random_int(5,10) to generate a number between 5 and 10, and so on.
    • get_date. f:get_date() returns the current date. The difference between two dates will be the number of milliseconds between them.
    You can (and should) use variables in the expressions. Do this by just typing their names where you want their value.

    The following actions can use expressions:
    • DefinirVar. Set a variable. You need to check the "expression" checkbox.
    • TesterVar. Test a variable. You need to check the "expression" checkbox.
    • EvaluerCondition. Test a condition. You do not need to prefix the expression.
User avatar
henke37
Security expert / tools programmer
Posts: 3031
Joined: Wed Mar 04, 2009 9:42 pm
Gender: Male
Spoken languages: Swedish,English
Location: Sweden
Contact:

Re: Tips and tricks and info for the Trial Maker

Post by henke37 »

Press all to proceed cross examinations
This has been a highly wanted feature for a while, here is how to do it using the new expression engine.
First of all, each set of pressing statements needs to have an action to set a variable. Each set needs an individual variable. I suggest naming them something like press1 and so on for easy remembering.
Then, at the end of each set of pressing statements, you need to use the action "Evaluate condition". For the expression, use the following format "press1 & press2 & press3". You can set the jump targets to any statement that you want to.
You will have to repeat this at the end of each set of pressing statements. Or you could jump to the action, but then you are going to mess up the automatic CE statement navigation to always return to the same point.
If you need this more than once in a trial, keep in mind that the variables need to be set to 0 manually for the condition to not trigger directly again. Use [#var:press1] in a message if you need to check if the variable have been set or not.
Currently working on a redesign of Court-records.net.
User avatar
Meph
Posts: 13439
Joined: Mon Nov 10, 2008 10:07 pm
Gender: Male
Spoken languages: English
Location: Probably Disneyland Paris... or the UK

Re: Tips and tricks and info for the Trial Maker

Post by Meph »

I never knew that! Thanks for your tip.
User avatar
henke37
Security expert / tools programmer
Posts: 3031
Joined: Wed Mar 04, 2009 9:42 pm
Gender: Male
Spoken languages: Swedish,English
Location: Sweden
Contact:

Re: Tips and tricks and info for the Trial Maker

Post by henke37 »

Well, it was broken until today, so of course you didn't.

Increasing a variable
Variables can be used as counters for various purposes. To do this, you need to use an expression. The way to do this is to use the prefix "expr=" before the expression in a set variable action. To just increment a variable with 1, use the expression "expr=var + 1".

If you are nuts, you can (ab)use this to create loops and other normal program control structures. But you have no business trying to do that.
Currently working on a redesign of Court-records.net.
User avatar
Unas
Admin / Site programmer
Posts: 8850
Joined: Tue Jul 10, 2007 4:43 pm
Gender: Male
Spoken languages: Français, English, Español
Contact:

Re: Tips and tricks and info for the Trial Maker

Post by Unas »

it's not 'expr=', but 'xpr=', just so you know :wink:
ImageImageImage
If knowledge can create problems, it is not through ignorance that we can solve them.
Si le savoir peut créer des problèmes, ce n'est pas l'ignorance qui les résoudra. ( Isaac Asimov )
User avatar
henke37
Security expert / tools programmer
Posts: 3031
Joined: Wed Mar 04, 2009 9:42 pm
Gender: Male
Spoken languages: Swedish,English
Location: Sweden
Contact:

Re: Tips and tricks and info for the Trial Maker

Post by henke37 »

Just to drive the point home, I made a trial demonstrating how variables can be abused to make a trial loop. Stick around long enough and fun stuff starts happening.
Currently working on a redesign of Court-records.net.
User avatar
Meph
Posts: 13439
Joined: Mon Nov 10, 2008 10:07 pm
Gender: Male
Spoken languages: English
Location: Probably Disneyland Paris... or the UK

Re: Tips and tricks and info for the Trial Maker

Post by Meph »

You like the loops, don't you? :P
User avatar
Dingzhu
Posts: 874
Joined: Sun Dec 21, 2008 7:24 am
Gender: Male
Location: In Azeroth; Brewing some fresh cool ale.
Contact:

Re: Tips and tricks and info for the Trial Maker

Post by Dingzhu »

How long does that go for?...
Image
Image
Thanks to Jibbers for the avvie and sig! :nod:

Latest Trials
Turnabout Fortunes - Court-only
Turnabout is in Session - Day One - Day Two - D3 coming never.
AntiRoyalty
Moderator
Posts: 888
Joined: Sun Mar 30, 2008 9:15 am
Gender: Female
Location: Bergen County, New Jersey USA
Contact:

Re: Tips and tricks and info for the Trial Maker

Post by AntiRoyalty »

Forever. It loops infinitely.
Image
Brb.
User avatar
Dingzhu
Posts: 874
Joined: Sun Dec 21, 2008 7:24 am
Gender: Male
Location: In Azeroth; Brewing some fresh cool ale.
Contact:

Re: Tips and tricks and info for the Trial Maker

Post by Dingzhu »

AH! No!

It stops at 100!
Image
Image
Thanks to Jibbers for the avvie and sig! :nod:

Latest Trials
Turnabout Fortunes - Court-only
Turnabout is in Session - Day One - Day Two - D3 coming never.
User avatar
henke37
Security expert / tools programmer
Posts: 3031
Joined: Wed Mar 04, 2009 9:42 pm
Gender: Male
Spoken languages: Swedish,English
Location: Sweden
Contact:

The expression engine explained

Post by henke37 »

The expression engine explained
As a few posts have shown already, we got an expression engine. I felt that someone should give an userfriendly explanation on how it works.

Quick word list:
Operator Thing that does stuff to one or more things. The plus sign is an operator.
Operand A value that an operator operates on.
Function A named chunk of code that does something. It may return a value.
Argument or Parameter A value passed to a function for use by the function.
Prefix Place some text before some other text or the text being placed before.
Evaluate Fancy word for "Do" or "Check"
Expression A string of values and operators that has a value.

As you might already know, it is a custom engine built by unas since he didn't feel like exposing the site to insecure usage of eval.
The engine is fairly easy to use, it has a these operators:
  • + Add. Add two numbers
  • - Subtract. Subtract one number from another number
  • - Sign flip. Flip the sign of a number
  • / Division. Do an integer only division. Any reminders is thrown away.
  • % Modulus, aka reminder. Gives the reminder of a division.
  • ^ Power. Gives the first number to the power of the second number.
  • & And. Returns a boolean that is true only if both operands is true.
  • | Or. Returns a boolean that is true if one or both of the operands is true.
  • ! Not. Inverts a boolean. True is false and false is true.
  • = Equals. Returns true if both operands are equal.
  • < Less than. Returns true if the left operand is less than the right operand.
  • > Greater than. Returns true if the left operand is greater than the right operand.
  • . Concanation. Joins two strings together.
The operators have the following priority order:
  1. !
  2. ^
  3. *, / ,%
  4. +, -
  5. >, =, <, .
  6. & and |
Lower value means that it is done earlier. Operators on the same row is evaluated in a left to right order.
You can use parentheses to override the operator order by wrapping the sub expression with them.

If you want to do less than or equal, you got plenty of ways of doing it, you can use <, & and = to do the check, you can use < after adding 1 to the right side and you can use !(x>y). Do the same for greater than or equal.

There is five functions that you can use:
  • str_begins_with. Checks if one string begins with another.
  • str_contains. Checks if one string is in another.
  • str_ends_with. Checks if one string ends with another.
  • str_first_word. Returns the string up to the first space, the space not being included.
  • evidence_is_r. Checks if a given evidence ID is revealed. You must pass the type (In French! "preuve"="evidence" and "profil"="profile") as the first argument.
You can (and should) use variables in the expressions. Do this by just typing their names where you want their value.

The following actions can use expressions:
  • DefinirVar. Set a variable. You need to prefix the expression with xpr=.
  • TesterVar. Test a variable. You need to prefix with xpr=.
  • EvaluerCondition. Test a condition. You do not need to prefix the expression.
Currently working on a redesign of Court-records.net.
User avatar
dimbo
Posts: 75
Joined: Sat Mar 14, 2009 5:10 am
Gender: Male

Re: Tips and tricks and info for the Trial Maker

Post by dimbo »

The miliseconds to: Objection, hold it and take that are 130
Awesome avatar made by KrazyKaro on court-records
User avatar
Meph
Posts: 13439
Joined: Mon Nov 10, 2008 10:07 pm
Gender: Male
Spoken languages: English
Location: Probably Disneyland Paris... or the UK

Re: Tips and tricks and info for the Trial Maker

Post by Meph »

Actually, it's 150, but thanks. :)
User avatar
henke37
Security expert / tools programmer
Posts: 3031
Joined: Wed Mar 04, 2009 9:42 pm
Gender: Male
Spoken languages: Swedish,English
Location: Sweden
Contact:

Re: Tips and tricks and info for the Trial Maker

Post by henke37 »

I think the post got cut short.
Currently working on a redesign of Court-records.net.
User avatar
Meph
Posts: 13439
Joined: Mon Nov 10, 2008 10:07 pm
Gender: Male
Spoken languages: English
Location: Probably Disneyland Paris... or the UK

Re: Tips and tricks and info for the Trial Maker

Post by Meph »

What do you mean? :maya:
Post Reply