-
Notifications
You must be signed in to change notification settings - Fork 10
Value Definition
Value definitions are used for leaderboards and rich presence.
A value is calculated by evaluating one or more memory reads. Read values can be scaled (multiplication) or summed (addition) to arrive at the final value.
NOTE: Value calculations are performed using 32-bit signed integers. As such, the maximum value is 2147483647 and the minimum value is -2147483648. Values above the maximum will wrap around and register as very negative numbers.
Starting with the 0.77 DLL (and RetroArch 1.8.2), you can use the Measured flag to generate a Value. This supports all logic supported by the achievement editor, but every condition must have a flag that somehow influences the Measured value (i.e. AddSource, AddAddress). Note that the Measured condition cannot have a multiplier directly on it. If the final clause needs to be multiplied, use an additional AddSource and Measure 0.
VAL: A:0xhfe24_A:0xhfe25*60_A:0xhfe22*3600_M:0
The example provided above reads:
AddSource 8-bit 0xfe24
AddSource 8-bit 0xfe25 * Value 60
AddSource 8-bit 0xfe22 * Value 3600
Measured Value 0
The addresses represent frames, seconds, and minutes respectively, and are individually multiplied and then added together to create a total number of frames that can be submitted to the database.
Sometimes you want to count the number of times something happens and submit that as the value. You can also do this using Measured syntax. Just add a comparison to your final condition. Do not include an explicit Hit target, or that will be the maximum value that can be submitted.
The HitCount on the condition will automatically be set to 0 when the leaderboard starts, and the HitCount will be submitted as the Value when the leaderboard submit trigger activates. You can use PauseIf and ResetIf within the Value conditions to further control the behavior.
For example:
M:0xH1234!=d0xH1234
Would submit the number of times the byte at $1234 changed while the leaderboard was active.
N:0xH1234!=20_M:0xH1234!=d0xH1234
Would submit the number of times the byte at $1234 changed to something other than 20 while the leaderboard was active.
VAL: 0xhfe24*1_0xhfe25*60_0xhfe22*3600
Before the introduction of the Measured flag, Values were written using their own syntax. Some people still prefer this syntax as it's generally easier to do by hand. A legacy value is the sum of a collection of memory values multiplied by modifiers.
address*modifier
(address times modifier)
The _
underscore operator separates the individual values and acts as 'plus'. So the example above represents:
8-bit 0xfe24 times 1, PLUS
8-bit 0xfe25 times 60, PLUS
8-bit 0xfe22 times 3600
The addresses represent frames, seconds, and minutes respectively, and are individually multiplied and then added together to create a total number of frames that can be submitted to the database.
To add a constant, use _vN
where N is the constant in decimal (i.e. _v10
) will add 10 to the result. You can also use negative values for N (i.e. _v-10
will subtract 10 from the result.
Tip: modifier can be a non-integer value, so if you need to divide by two, you can multiply by 0.5: 0xhfe24*0.5
Multiple value calculations may be joined with a $
. This is similar to alt groups in a trigger, but instead of any one alt group needing to be true, whichever "alt value" is largest will be used as the overall value for the expression.
M:0xH1234$M:0xH1235
would return the larger of the values at $1234 or $1235.
A single memory reference can be prefixed with a ~
to perform a binary inversion on it. After reading the value from memory, every bit is switches (0s become 1s, 1s become 0s).
Typically, this is used to conditionally add or subtract a value:
A:0xH1234*~0xM1233_M:0xH1235
will add the byte at $1234 to the byte at $1235 if bit0 of $1233 is not set.
Binary Coded Decimal (BCD) is when a values in memory is stored as decimal digits in each hex digit location. For example, if the memory inspector shows 86 at a byte in memory, it would normally represent the decimal value 134 (0x86 hex = 134 decimal). BCD decoding the value keeps the individual decimal numbers and the result is 86 (0x86 hex = 86 BCD).
You can have the runtime decode BCD values by putting a b
prefix in front of the memory reference (i.e. b0xW1234
). You still need to specify the size of the BCD memory address. b0x1234 reads a 16-bit value. b0xh1234 reads an 8-bit value and b0xX1234 reads a 32-bit value. NOTE: Support for 16-bit and 32-bit BCD decoding is a feature of the 0.075 toolkit.
- User Guidelines
- Developer Guidelines
- Content Guidelines
- FAQ
- Setup Guide
- Emulator Support and Issues
- Ways to Contribute
- RABot, the RA Discord Robot
- Events
- Overlay Themes
- Useful Links
- Contributing with the docs
- About Us
- Tutorials
- Developer Docs
- How to Become an Achievement Developer
- Getting Started as an Achievement Developer
- Game Identification
- Achievement Design
- Achievement Scoring
- Difficulty Scale and Balance
- Progression and Win Condition Typing
- Badge and Icon Creation
- Achievement Development Overview
- Flags
- BitCount Size
- Alt Groups
- Hit Counts
- Delta Values
- Prior Values
- Value Definition
- Condition Syntax
- Minimum Required Versions for Logic Features
- Memory Inspector
- Real Examples
- Set Development Roadmap
- Achievement Templates
- Tips and Tricks
- Leaderboards
- Rich Presence
- RATools
- Console Specific Tips
- Emulator Hotkeys for Developers
- libretro core support
- Docs To Do List
- WIP User Code of Conduct
- WIP CoC FAQ
- WIP Content Guidelines
- WIP-Jr
- WIP---Dev-Tips---Code-Notes-En-Masse
- WIP-‐-Reauthorship-Policy
- Manifesto RetroAchievements
- Código de Conduta do Usuário
- FAQ - Perguntas Frequentes
- Como contribuir se você não é um desenvolvedor
- Tutorial para Jogos Multi-Discos
- Introdução
- Primeiros Passos como um Desenvolvedor de Conquistas
- Recursos de Lógica para Achievements
- Exemplos Reais
- Dicas e Truques
- Dicas Específicas de Console
- Modelos de Achievement
- Escala de Dificuldade e Equilíbrio
- Roteiro de Desenvolvimento de um Set de Conquistas
- Criação de Ícones e Emblemas
- Leaderboards
- Rich Presence
- Design de Conquistas
- Manifesto RetroAchievements
- Código de Conducta del Usuario
- FAQ - Preguntas Frecuentes
- Tablas Globales y Reglas para la Casería de Logros
- Mi juego no esta cargando los logros
- Como contribuir si no eres un desarrollador
- Por que no deberías utilizar la función de cargar estado
- Contribuyendo con los documentos
- Como funciona la Documentación de RA
- Descargas
- Intro
- Código de Conducta del Desarrollador
- Como convertirme en un Desarrollador de Logros
- Primeros pasos como un Desarrollador de Logros
- Un vistazo al Inspector de Memoria
- Características en la Logica de un Logro
- Ejemplos Reales
- Intro
- Utilizando Hit Counts como un Temporizador
- Utilizando Valores Delta y Hit Counts para Detectar un Incremento
- Un Ejemplo Simple en como evitar el Abuso de Estados de Guardado
- Evitar el Problema de que un Contador se Incremente Dos Veces en el Mismo Frame
- Creando un Temporizador con un ResetIf Hits basándote en la Velocidad de un Juego
- Plantillas para Logros
- Tips y Trucos
- Escala de Dificultad y Balance
- Diseño de Logros
- Mapa de Desarrollo de Set
- Revisiones en Set de Logros
- Creación de Iconos y Badges
- Tablas de Clasificación
- Rich Presence
- Trabajando con el ROM apropiado
- Identificación del Juego
- Guía para Sets Bonus
- Logros para ROM hacks
- Tips Específicos por Consola