Registrarse

[Scripting] R, E | Días de la semana sin DNS

aptitud

Usuario mítico
Buenos dias


Pues, esto es mi primero tutorial y es sobre la posibilidad desconocida de guardar el dia de la semana sin DNS el los juegos Ruby/Emerald
(y Saphir pero no se utiliza mucho...)

La idea es muy simple :
En el juego hay un hombre que le da una TM ("pacifilog city" el hombre con los 2 azurils)
Este hombre da de nuevo una TM cuando 7 dias se han pasados...
Para hacerlo el juego cuenta hacia atrás los dias de 7 hasta 0

El script del hombre utiliza dos especiales para controlar esto :
Emerald :
1) Un special 0x14F para iniciar el numero de dias a 7
2) Un special2 LASTRESULT 0x150 para que LASTRESULT da el nombre de dia que faltan antes que el hombre da una nueva TM
Ruby :
1) Un special 0x14D para iniciar el numero de dias a 7
2) Un special2 LASTRESULT 0x14E para que LASTRESULT da el nombre de dia que faltan antes que el hombre da una nueva TM



Código:
#dyn 0x740000[Ruby/Saphir]
#dyn 0x9D0000[Emerald expanded]
#org @start

CMD_2D (o "checkdaylyflags" con XSE)
checkflag [daylyflag]
if false goto @increase
end

#org @increase
special2 [VAR1] 0x150 (Ruby : special2 [VAR1] 0x14E)
call @casos
special 0x14F (Ruby : special 0x14D) 
setflag [daylyflag]
end

#org @casos
compare [VAR1] 0x6
if true goto @1dia
compare [VAR1] 0x5
if true goto @2dias
compare [VAR1] 0x4
if true goto @3dias
compare [VAR1] 0x3
if true goto @4dias
compare [VAR1] 0x2
if true goto @5dias
compare [VAR1] 0x1
if true goto @6dias
compare [VAR1] 0x0
if true goto @7dias
return


#org @1 dia
addvar [VARDia] 0x1
addvar [VARContarDia] 0x1
compare [VARDia] 0x7
if >= call @menos7
return


#org @menos7
subtractvar [VARDia] 0x7
return

#org @2dias
addvar [VARDia] 0x2
addvar [VARContarDia] 0x2
compare [VARDia] 0x7
if >= call @menos7
return


#org @3dias
addvar [VARDia] 0x3
addvar [VARContarDia] 0x3
compare [VARDia] 0x7
if >= call @menos7
return

#org @4dias
addvar [VARDia] 0x4
addvar [VARContarDia] 0x4
compare [VARDia] 0x7
if >= call @menos7
return

#org @5dias
addvar [VARDia] 0x5
addvar [VARContarDia] 0x5
compare [VARDia] 0x7
if >= call @menos7
return

#org @6dias
addvar [VARDia] 0x6
addvar [VARContarDia] 0x6
compare [VARDia] 0x7
if >= call @menos7
return

#org @7dias
addvar [VARContarDia] 0x7
return



Comentarios :
>[VAR1] es cualquiera variable
>[VARDia] es la variable que guarda el dia de la semana (entre 0 y 6 incluidos)
Se necesita decidir que dia es 0 y los otros valores son los otros dias en el orden.
Se necesita una manera de elegir el dia al principio
>[VARContarDia] no se necesita en realidad,
pero puede necesitar contar los dias que pasan en ciertos scripts...
Si no necesitan hacer eso, se puede borar las lineas que tienen este variable!


El script se utiliza como un script de nivel 0x5
(en todas la mapas que puede tenerlo para guardar el dia el mas eficiente posible)

Daylyflags son los flags que functionan con la comanda "checkdaylyflags" ( o comanda "CMD_2D")
(la comanda desactiva estos flags si no fueron activado el dia que se ejecuta la comanda)

Existen en Ruby/Saphir/Emerald (pero no son los mismos en Emerald)
Se utilizan en los scripts de las personas que le da "berries" cada dia y la loteria en el centro comercial

Daylyflags (Emerald) : 0x92A hasta 0x932 (quizás hay mas)
(Lo siento, para ruby, no tengo una lista, se debe verificar en el juego.)

[daylyflag] es un daylyflag que elige para que el script no se ejecuta cuando no sirve de nada.
De nuevo no se necesita y se puede borrar...
Pero este script debe ejecutarse "todo el tiempo" (como script de nivel 0x5)
Entonces es mejor que solo hace una verificación de flag cuando el dia no ha cambiado.
(Sino, va a ejecutar un special y verificar la valor en una variable "todo el tiempo"...)





Puntos positivos/negativos
+Se guarda el dia en una variable y no en un offset
(entonces funciona con el "RAM mezclador" de Emerald)
+Utiliza una funcionalidad nativa con la misma reloj que el juego.

-necesita poner este script en (casi) cada mapa
-no guarda bien el dia si no juego por mas de una semana
(entonces se necesita la posibilidad de cambiar el dia de una maneja...)



Gracias por su atención y hasta luego.



Note : Mi idioma de nacimiento es el frances. Tambien hablo ingles y español.
Yo entiendo bastante bien español y puedo escribir un poco en este idioma.
Pero parece que no se entendio bastante... Lo siento :(
Entonces les propone una version ingles del tutorial :

This tutorial is about the possibility to keep track of the day of the week, without DNS,
in the games Ruby/Emerald (and Saphir but it is less used...)

The idea is very simple :
In the game, there is a man that give a TM ("pacifilog city" the man with 2 azurils)
This man give again a TM when there is 7 days since he gave one...
To do this the game count days from 7 to 0

The man's script uses two specials to control this count :
Emerald :
1) special 0x14F to start the count from 7
2) special2 LASTRESULT 0x150 that put in LASTRESULT the number of days until the man gives a new TM
Ruby :
1) special 0x14D to start the count from 7
2) special2 LASTRESULT 0x14E that put in LASTRESULT the number of days until the man gives a new TM



Código:
#dyn 0x740000[Ruby/Saphir]
#dyn 0x9D0000[Emerald expanded]
#org @start

CMD_2D (or "checkdaylyflags" con XSE)
checkflag [daylyflag]
if false goto @increase
end

#org @increase
special2 [VAR1] 0x150 (Ruby : special2 [VAR1] 0x14E)
call @cases
special 0x14F (Ruby : special 0x14D) 
setflag [daylyflag]
end

#org @cases
compare [VAR1] 0x6
if true goto @1day
compare [VAR1] 0x5
if true goto @2days
compare [VAR1] 0x4
if true goto @3days
compare [VAR1] 0x3
if true goto @4days
compare [VAR1] 0x2
if true goto @5days
compare [VAR1] 0x1
if true goto @6days
compare [VAR1] 0x0
if true goto @7days
return


#org @1day
addvar [VARDay] 0x1
addvar [VARCountDays] 0x1
compare [VARDay] 0x7
if >= call @minus7
return


#org @minus7
subtractvar [VARDay] 0x7
return

#org @2days
addvar [VARDay] 0x2
addvar [VARCountDays] 0x2
compare [VARDay] 0x7
if >= call @minus7
return


#org @3days
addvar [VARDay] 0x3
addvar [VARCountDays] 0x3
compare [VARDay] 0x7
if >= call @minus7
return

#org @4days
addvar [VARDay] 0x4
addvar [VARCountDays] 0x4
compare [VARDay] 0x7
if >= call @minus7
return

#org @5days
addvar [VARDay] 0x5
addvar [VARCountDays] 0x5
compare [VARDay] 0x7
if >= call @minus7
return

#org @6days
addvar [VARDay] 0x6
addvar [VARCountDays] 0x6
compare [VARDay] 0x7
if >= call @minus7
return

#org @7days
addvar [VARCountDays] 0x7
return



Comentaries :
>[VAR1] is whatever variable
>[VARDay] is the variable you choose to keep the day in (value between 0 and 6 included)
You need to decide which day is associated with 0.
The other days' numbers then follow in order.
You need a way to choose the day at the begining of the game
>[VARCountDays] is not really needed,
but you may want to count how many days have gone by for some scripts...
If you don't need to do this, you may erase the lines with this variable from the script!


The script should be used as map level script of level 0x5
(in each map you can put it, so as to keep the day in the more efficient way possible)
*Due to the fact the counter reach 0 as soon as the script don't run for more than 7 days...

Daylyflags are the flags that work with the comand checkdaylyflags" ( or comand "CMD_2D")
(the comand desactivates the daylyflags if they were not activated the same day the comand is run.)

They exist in Ruby/Saphir/Emerald (and are not the same in Ruby and Emerald)
They are used in each script that run each day :
PNJ that give berries each day and lotery in the comercial center for instance.

Daylyflags (Emerald) : 0x92A to 0x932 (maybe more)
(For ruby, you may need to check in-game as i don't know the daylyflags.)

[daylyflag] A daylyflag you choose so as the script don't run when it has no effect.
(nothing change if the script is run more than once each day.)
Once again, you can erase this...
De nuevo no se necesita y se puede borrar...
But this script should run "always" (as script of level 0x5)
Then it is best that only a check of flag is done as long as the day doesn't change.
(Else, a special will run and the value in a variable will be checked "always"...)





Positives/Negatives
+Keep the day in a variable instead of in an offset
(that makes it work with the "RAM shuffler" in Emerald)
+Use a native function and the in game clock.

-script need to be inserted in (nearly) each map
-The day is not kept once the game is not played for more than a week
(It is then needed to insert a way to change the day in this case...)
 

H.B.P

Emperador Kaktiácero
Miembro de honor
Respuesta: R/E | Scripting | Días de la semana sin DNS

No he llegado a comprender del todo el tutorial, ¿por casualidad eres angloparlante? De ser así, te agradecería que además del tutorial en español, publiques el tutorial en inglés, de esa forma facilitarás la comprensión del manual. Y bueno, es un tutorial interesante y un tanto práctico; los puntos malos son un tanto quisquillosos, pero es igualmente un buen método.
 
Arriba