The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Fan Games > Binary ROM Hacking
Reload this Page Script Sum 2 Variables

Notices
For all updates, view the main page.

Binary ROM Hacking Need a helping hand or just want to talk about binary ROM hacks? Get comments and answers to any ROM Hacking-related problems, questions or thoughts you have here.

Ad Content
Reply
 
Thread Tools
  #1   Link to this post, but load the entire thread.  
Old December 7th, 2020 (12:40 PM). Edited December 7th, 2020 by JapaBijou.
JapaBijou JapaBijou is offline
 
Join Date: Nov 2020
Posts: 9
Hi

How can I add up values of 2 variables?

For example, if I have a value stored in 0x800D and another in 0x8000 how can I load into 0x800D the sum of those 2 numbers?
Addvar require a variable and a constant value, so I have no idea how to do it

Thanks

EDIT: I'm using pokefirered source code, so I solved my problem by creating a new script command that I called "sumvars" wich takes 2 vars and sum the value of the second into the first

I'm not sure if that solution is sure neither it's the most optimal, but it worked by editing only 3 files (asm/macros/event.inc, data/script_cmd_table.inc and src/scrcmd)
Reply With Quote
  #2   Link to this post, but load the entire thread.  
Old December 9th, 2020 (1:18 AM).
__fred__40's Avatar
__fred__40 __fred__40 is offline
fred
 
Join Date: Oct 2019
Location: mt silver
Gender: Male
Nature: Bold
Posts: 277
that should work, if you have any more doubt I'll suggest you look on how it's done in the CFRU
__________________
Reply With Quote
Reply

Quick Reply

Join the conversation!

Create an account to post a reply in this thread, participate in other discussions, and more!

Create a PokéCommunity Account
Ad Content

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 9:16 AM.