25024-GBA_|_Scripting_|_Bank_System_Script_by_Javi4315
#7
Javi4315♪ 13374
Bank System script v1.1

Vídeo

YouTube Video

¿Qué tiene de nuevo?

El usuario [MENTION=26580]BLAx[/MENTION] me ha propuesto insertar la rutina de DavidJCobb para añadir una caja como la del dinero, pero con los valores que tú quieras. Esos valores que queremos, son, por supuesto, el dinero que tenemos en el banco. Si véis el vídeo, veréis que aparece una caja con el dinero del banco y debajo la del dinero que tenemos nosotros. Además, los multichoices han sido llevados a la derecha de la pantalla.

La rutina

La rutina es la siguiente:

.align 2
.thumb

SHOWCOINS:
push {lr}
push {r0-r7}
mov r5, #0x0
mov r4, #0x0
ldr r0, UNKNOWN_DATA_0
ldr r1, SHOWCOINS_UNK_1
bl CALL_R1
lsl r0, r0, #0x10
lsr r0, r0, #0x10
cmp r0, #0x1
beq SHOWCOINS_RETURN
mov r1, r5
mov r2, r4
bl SECONDARY
b SHOWCOINS_RETURN

SHOWCOINS_RETURN:
pop {r0-r7}
pop {pc}



SECONDARY:
push {lr}
push {r0-r7}
add sp, #-0x20
mov r6, r0
mov r4, r1
mov r3, r2
lsl r4, r4, #0x18
lsl r3, r3, #0x18
mov r0, #0x80
lsl r0, r0, #0x11
add r4, r4, r0
lsr r4, r4, #0x18
add r3, r3, r0
lsr r3, r3, #0x18
mov r0, #0x8
str r0, [sp]
mov r0, #0x3
str r0, [sp, #0x4]
mov r0, #0xF
str r0, [sp, #0x8]
mov r0, #0x20
str r0, [sp, #0xC]
add r0, sp, #0x10
mov r1, #0x0
mov r2, r4
ldr r4, UNKNOWN_FUNCTION_0
bl CALL_R4
ldr r0, [sp, #0x10]
ldr r1, [sp, #0x14]
str r0, [sp, #0x18]
str r1, [sp, #0x1C]
ldr r4, UNKNOWN_DATA_1
add r0, sp, #0x18
ldr r5, UNKNOWN_FUNCTION_1
bl CALL_R5
strb r0, [r4]
ldrb r0, [r4]
mov r1, #0x0
ldr r2, UNKNOWN_FUNCTION_2
bl CALL_R2
ldrb r0, [r4]
ldr r5, UNKNOWN_FUNCTION_3
bl CALL_R5
ldrb r0, [r4]
ldr r5, UNKNOWN_DATA_2
mov r1, r5
mov r2, #0xD0
ldr r3, UNKNOWN_FUNCTION_4
bl CALL_R3
ldrb r0, [r4]
mov r1, #0x0
mov r2, r5
mov r3, #0xD
ldr r6, UNKNOWN_FUNCTION_5
bl CALL_R6
ldrb r0, [r4]
ldr r2, SCRIPT_BANK_0
ldr r2, [r2]
mov r3, #0x0
str r3, [sp]
mov r1, #0xFF
str r1, [sp, #0x4]
str r3, [sp, #0x8]
mov r1, #0x2
ldr r7, UNKNOWN_FUNCTION_6
bl CALL_R7
mov r0, r6
bl SECONDARY_LOAD_BODY
add sp, #0x20
pop {r0-r7}
pop {pc}



SECONDARY_LOAD_BODY:
push {lr}
push {r0-r7}
add sp, #-0xC
mov r1, r0
ldr r0, BUFFER_RAM_OFFSET
mov r2, #0x1
mov r3, #0x4
ldr r6, UNKNOWN_FUNCTION_7
bl CALL_R6
ldr r4, STRING_RAM_OFFSET
ldr r1, SCRIPT_BANK_1
ldr r1, [r1]
mov r0, r4
ldr r6, BODY_STRING_LOADER
bl CALL_R6
mov r0, #0x0
mov r1, r4
mov r2, #0x0
ldr r6, UNKNOWN_FUNCTION_8
bl CALL_R6
ldr r1, UNKNOWN_DATA_1
ldrb r1, [r1]
mov r3, #0x40
sub r3, r3, r0
lsl r3, r3, #0x18
lsr r3, r3, #0x18
mov r0, #0xC
str r0, [sp]
mov r0, #0x0
str r0, [sp, #0x4]
str r0, [sp, #0x8]
mov r0, r1
mov r1, #0x0
mov r2, r4
ldr r6, UNKNOWN_FUNCTION_6
bl CALL_R6
add sp, #0xC
pop {r0-r7}
pop {pc}

CALL_R1:
bx r1
bx lr

CALL_R2:
bx r2
bx lr

CALL_R3:
bx r3
bx lr

CALL_R4:
bx r4
bx lr

CALL_R5:
bx r5
bx lr

CALL_R6:
bx r6
bx lr

CALL_R7:
bx r7
bx lr

.align 2
SCRIPT_BANK_0:
.word 0x03000F14

SCRIPT_BANK_1:
.word 0x03000F18

UNKNOWN_DATA_0:
.word 0x0809D6D5

UNKNOWN_DATA_1:
.word 0x02039A28

UNKNOWN_DATA_2:
.word 0x0000021D

SHOWCOINS_UNK_1:
.word 0x081119D5

UNKNOWN_FUNCTION_0:
.word 0x0810FE51

UNKNOWN_FUNCTION_1:
.word 0x08003CE5

UNKNOWN_FUNCTION_2:
.word 0x0800445D

UNKNOWN_FUNCTION_3:
.word 0x08003FA1

UNKNOWN_FUNCTION_4:
.word 0x0814FF2D

UNKNOWN_FUNCTION_5:
.word 0x0810F2E9

UNKNOWN_FUNCTION_6:
.word 0x08002C49

UNKNOWN_FUNCTION_7:
.word 0x08008E79

UNKNOWN_FUNCTION_8:
.word 0x08005ED5

BUFFER_RAM_OFFSET:
.word 0x02021CD0

STRING_RAM_OFFSET:
.word 0x02021D18

BODY_STRING_LOADER:
.word 0x08008FCD

Aquí la tenéis directamente en hex para pegarla en el editor hexadecimal sin mayor problema:

00 B5 FF B4 00 25 00 24 4D 48 50 49 00 F0 85 F8 00 04 00 0C 01 28 04 D0 29 1C 22 1C 00 F0 03 F8 FF E7 FF BC 00 BD 00 B5 FF B4 88 B0 06 1C 0C 1C 13 1C 24 06 1B 06 80 20 40 04 24 18 24 0E 1B 18 1B 0E 08 20 00 90 03 20 01 90 0F 20 02 90 20 20 03 90 04 A8 00 21 22 1C 3D 4C 00 F0 64 F8 04 98 05 99 06 90 07 91 37 4C 06 A8 3A 4D 00 F0 5D F8 20 70 20 78 00 21 38 4A 00 F0 51 F8 20 78 37 4D 00 F0 53 F8 20 78 30 4D 29 1C D0 22 34 4B 00 F0 48 F8 20 78 00 21 2A 1C 0D 23 32 4E 00 F0 47 F8 20 78 25 4A 12 68 00 23 00 93 FF 21 01 91 02 93 02 21 2D 4F 00 F0 3D F8 30 1C 00 F0 03 F8 08 B0 FF BC 00 BD 00 B5 FF B4 83 B0 01 1C 29 48 01 22 04 23 26 4E 00 F0 2B F8 27 4C 18 49 09 68 20 1C 26 4E 00 F0 24 F8 00 20 21 1C 00 22 20 4E 00 F0 1E F8 14 49 09 78 40 23 1B 1A 1B 06 1B 0E 0C 20 00 90 00 20 01 90 02 90 08 1C 00 21 22 1C 16 4E 00 F0 0D F8 03 B0 FF BC 00 BD 08 47 70 47 10 47 70 47 18 47 70 47 20 47 70 47 28 47 70 47 30 47 70 47 38 47 70 47 C0 46 14 0F 00 03 18 0F 00 03 D5 D6 09 08 28 9A 03 02 1D 02 00 00 D5 19 11 08 51 FE 10 08 E5 3C 00 08 5D 44 00 08 A1 3F 00 08 2D FF 14 08 E9 F2 10 08 49 2C 00 08 79 8E 00 08 D5 5E 00 08 D0 1C 02 02 18 1D 02 02 CD 8F 00 08

Yo la he puesto en el 0x920000. Podéis cambiar la dirección, pero si vais a usar el script tal como está, es mejor que la peguéis en el mismo sitio para ahorrarse modificarlo. Pero como queráis.

De nuevo, créditos a DavidJCobb por la rutina.

El script

El script es casi el mismo que antes, pero se han implementado la caja para el banco y se ha quitado la cantidad que se mostraba en el textbox. A parte de añadir un par de cosas porque con la rutina daba error, pero está completamente adaptado.

Aquí tenéis el script:

#dynamic 0x800000

#org @comienzo
lock
faceplayer
msgbox @1 0x6
multichoice 0x11 0x0 0x6 0x1
compare LASTRESULT 0x0
if 0x1 goto @admin
compare LASTRESULT 0x1
if 0x1 goto @abrir
compare LASTRESULT 0x2
if 0x1 goto @salir2
release
end

#org @salir1
msgbox @2 0x6
hidecoins 0x0 0x0
hidemoney 0x0 0x5
release
end

#org @salir2
msgbox @2 0x6
release
end

#org @abrir
msgbox @4 0x6
pause 0x5
spriteface 0x4 0x4
pause 0x50
faceplayer
compare 0x7FF1 0x1
if 0x4 goto @yatiene
showmoney 0x0 0x0 0x0
msgbox @5 0x5
compare LASTRESULT 0x1
if 0x0 goto @noabrir
checkmoney 0x3E8 0x0
compare LASTRESULT 0x1
if 0x0 goto @nodinero
paymoney 0x3E8 0x0
setvar 0x7FF1 0x1
sound 0x15
updatemoney 0x0 0x0 0x0
msgbox @8 0x6
hidemoney 0x0 0x0
spriteface 0x4 0x4
pause 0x80
faceplayer
msgbox @9 0x5
compare LASTRESULT 0x1
if 0x1 goto @admin
msgbox @6 0x6
release
end

#org @yatiene
msgbox @3 0x6
multichoice 0x11 0x0 0x6 0x1
compare LASTRESULT 0x0
if 0x1 goto @admin
compare LASTRESULT 0x1
if 0x1 goto @abrir
compare LASTRESULT 0x3
if 0x1 goto @salir1
release
end

#org @noabrir
msgbox @6 0x6
hidemoney 0x0 0x0
release
end

#org @nodinero
msgbox @7 0x6
hidemoney 0x0 0x0
release
end


#org @admin
msgbox @4 0x6
pause 0x5
spriteface 0x4 0x4
pause 0x50
faceplayer
compare 0x7FF1 0x0
if 0x1 goto @nocuenta
compare 0x7FF0 0x0
if 0x1 goto @admin2
buffernumber 0x1 0x7FF1
buffernumber 0x2 0x7FF0
loadpointer 0x0 @head '"HEAD"
loadpointer 0x1 @body
callasm 0x8920001
msgbox @10 0x6
multichoice 0x14 0x0 0x7 0x1
compare LASTRESULT 0x0
if 0x1 goto @depositar
compare LASTRESULT 0x1
if 0x1 goto @retirar
compare LASTRESULT 0x2
if 0x1 goto @salir1
release
end

#org @admin2
buffernumber 0x1 0x7FF1
loadpointer 0x0 @head '"HEAD"
loadpointer 0x1 @body2
callasm 0x8920001
msgbox @10 0x6
multichoice 0x14 0x0 0x7 0x1
compare LASTRESULT 0x0
if 0x1 goto @depositar
compare LASTRESULT 0x1
if 0x1 goto @retirar
compare LASTRESULT 0x2
if 0x1 goto @salir1
release
end

#org @nocuenta
msgbox @17 0x6
multichoice 0x11 0x0 0x6 0x1
compare LASTRESULT 0x0
if 0x1 goto @admin
compare LASTRESULT 0x1
if 0x1 goto @abrir
compare LASTRESULT 0x3
if 0x1 goto @salir1
release
end

#org @depositar
showmoney 0x0 0x5 0x0
compare 0x7FF0 0x0
if 0x1 goto @depositar2
buffernumber 0x1 0x7FF1
buffernumber 0x2 0x7FF0
loadpointer 0x0 @head '"HEAD"
loadpointer 0x1 @body
callasm 0x8920001
msgbox @11 0x6
multichoice 0x14 0x0 0x11 0x1
compare LASTRESULT 0x0
if 0x1 goto @100
compare LASTRESULT 0x1
if 0x1 goto @1000
compare LASTRESULT 0x2
if 0x1 goto @10000
compare LASTRESULT 0x3
if 0x1 goto @100000
compare LASTRESULT 0x4
if 0x1 goto @admin
release
end

#org @depositar2
buffernumber 0x1 0x7FF1
loadpointer 0x0 @head '"HEAD"
loadpointer 0x1 @body2
callasm 0x8920001
msgbox @18 0x6
multichoice 0x14 0x0 0x11 0x1
compare LASTRESULT 0x0
if 0x1 goto @100
compare LASTRESULT 0x1
if 0x1 goto @1000
compare LASTRESULT 0x2
if 0x1 goto @10000
compare LASTRESULT 0x3
if 0x1 goto @100000
compare LASTRESULT 0x4
if 0x1 goto @admin
release
end

#org @100000
compare 0x7FF1 0x384
if 0x4 goto @cuentallena
checkmoney 0x186A0 0x0
compare LASTRESULT 0x1
if 0x0 goto @nodinero2
paymoney 0x186A0 0x0
sound 0x15
updatemoney 0x0 0x5 0x0
addvar 0x7FF1 0x64
goto @depositar
release
end

#org @10000
compare 0x7FF1 0x3DE
if 0x4 goto @cuentallena
checkmoney 0x2710 0x0
compare LASTRESULT 0x1
if 0x0 goto @nodinero2
paymoney 0x2710 0x0
sound 0x15
updatemoney 0x0 0x5 0x0
addvar 0x7FF1 0xA
goto @depositar
release
end

#org @1000
compare 0x7FF1 0x3E7
if 0x1 goto @cuentallena
checkmoney 0x3E8 0x0
compare LASTRESULT 0x1
if 0x0 goto @nodinero2
paymoney 0x3E8 0x0
sound 0x15
updatemoney 0x0 0x5 0x0
addvar 0x7FF1 0x1
goto @depositar
release
end

#org @100
compare 0x7FF0 0x384
if 0x4 call [MENTION=24474]Comp[/MENTION]1
checkmoney 0x64 0x0
compare LASTRESULT 0x1
if 0x0 goto @nodinero2
paymoney 0x64 0x0
sound 0x15
updatemoney 0x0 0x5 0x0
addvar 0x7FF0 0x64
compare 0x7FF0 0x3E7
if 0x3 goto @depositar
subvar 0x7FF0 0x3E8
addvar 0x7FF1 0x1
goto @depositar
release
end

#org [MENTION=24474]Comp[/MENTION]1
compare 0x7FF1 0x3E7
if 0x1 goto @cuentallena
return

#org @cuentallena
msgbox @13 0x6
hidemoney 0x0 0x5
goto @depositar
end

#org @nodinero2
msgbox @12 0x6
goto @depositar
end



#org @retirar
showmoney 0x0 0x5 0x0
compare 0x7FF0 0x0
if 0x1 goto @retirar2
buffernumber 0x1 0x7FF1
buffernumber 0x2 0x7FF0
loadpointer 0x0 @head '"HEAD"
loadpointer 0x1 @body
callasm 0x8920001
msgbox @14 0x6
multichoice 0x14 0x0 0x11 0x1
compare LASTRESULT 0x0
if 0x1 goto @101
compare LASTRESULT 0x1
if 0x1 goto @1001
compare LASTRESULT 0x2
if 0x1 goto @10001
compare LASTRESULT 0x3
if 0x1 goto @100001
compare LASTRESULT 0x4
if 0x1 goto @admin
release
end

#org @retirar2
buffernumber 0x1 0x7FF1
loadpointer 0x0 @head '"HEAD"
loadpointer 0x1 @body2
callasm 0x8920001
msgbox @19 0x6
multichoice 0x14 0x0 0x11 0x1
compare LASTRESULT 0x0
if 0x1 goto @101
compare LASTRESULT 0x1
if 0x1 goto @1001
compare LASTRESULT 0x2
if 0x1 goto @10001
compare LASTRESULT 0x3
if 0x1 goto @100001
compare LASTRESULT 0x4
if 0x1 goto @admin
release
end

#org @100001
compare 0x7FF1 0x64
if 0x3 goto @cuentavacia
checkmoney 0xDBB9F 0x0
compare LASTRESULT 0x1
if 0x4 goto @muchodinero
givemoney 0x186A0 0x0
sound 0x15
updatemoney 0x0 0x5 0x0
subvar 0x7FF1 0x64
goto @retirar
release
end

#org @10001
compare 0x7FF1 0xA
if 0x3 goto @cuentavacia
checkmoney 0xF1B2F 0x0
compare LASTRESULT 0x1
if 0x4 goto @muchodinero
givemoney 0x2710 0x0
sound 0x15
updatemoney 0x0 0x5 0x0
subvar 0x7FF1 0xA
goto @retirar
release
end

#org @1001
compare 0x7FF1 0x1
if 0x3 goto @cuentavacia
checkmoney 0xF3E57 0x0
compare LASTRESULT 0x1
if 0x4 goto @muchodinero
givemoney 0x3E8 0x0
sound 0x15
updatemoney 0x0 0x5 0x0
subvar 0x7FF1 0x1
goto @retirar
release
end

#org @101
compare 0x7FF0 0x63
if 0x3 call [MENTION=24474]Comp[/MENTION]2
checkmoney 0xF41Db 0x0
compare LASTRESULT 0x1
if 0x4 goto @muchodinero
givemoney 0x64 0x0
sound 0x15
updatemoney 0x0 0x5 0x0

compare 0x7FF0 0x63
if 0x3 goto @1012
subvar 0x7FF0 0x64
goto @retirar
release
end

#org @1012
addvar 0x7FF0 0x384
subvar 0x7FF1 0x1
goto @retirar
release
end

#org [MENTION=24474]Comp[/MENTION]2
compare 0x7FF1 0x1
if 0x1 goto @cuentavacia
return

#org @cuentavacia
msgbox @15 0x6
hidemoney 0x0 0x5
goto @retirar
end

#org @muchodinero
msgbox @16 0x6
goto @retirar
end

#org @1
= Buenos días, señor.\nBienvenido al Banco de Kanto.\p¿Qué desea hacer?

#org @2
= Vuelva siempre que quiera.\p¡Que tenga un buen día!

#org @3
= Lo siento mucho, señor, pero usted\nya tiene una cuenta.\lNo puede abrir más.\p¿Desea hacer algo?

#org @4
= Muy bien. Espere un momento.

#org @5
= Bien, para abrir una cuenta debe\ningresar una cantidad inicial de\l[$]1.000 ¿Está de acuerdo?

#org @6
= Como desee. Vuelva siempre que\nquiera.\p¡Que tenga un buen día!

#org @7
= Lo siento, señor, pero no tiene\nsuficiente dunero para abrir una\lcuenta.\p¡Que tenga un buen día!

#org @8
= Muy bien, abriremos su cuenta.\nEspere un momento.

#org @9
= Felicidades, señor, ya posee usted\nuna cuenta en nuestro banco.\p¿Desea administrarla?

#org @10
= ¿Qué movimiento desea realizar?

#org @11
= ¿Desea depositar algo?

#org @12
= No tiene suficiente dinero.

#org @13
= No hay espacio en la cuenta para\ndepositar esa cantidad.\pEl máximo para este tipo de\ncuentas es de [$]999.999.

#org @14
= ¿Desea retirar algo?

#org @15
= No puede quedar la cuenta con\nmenos de [$]1.000.

#org @16
= No puede retirar esa cantidad.\nLlevaría demasiado dinero encima.

#org @17
= No tienes una cuenta abierta, no\npuedes administrarla.\p¿Desea hacer algo?

#org @18
= ¿Desea depositar algo?

#org @19
= ¿Desea retirar algo?

#org @head
= BANK

#org @body
= [$]

#org @body2
= [$]000

Pues nada, eso es todo. Cualquier sugerencia estaré encantado de escucharla.