The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Fan Games > Binary ROM Hacking
Reload this Page Other Dont release

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 January 2nd, 2015 (5:42 AM).
GreenToxic GreenToxic is offline
 
Join Date: Dec 2014
Gender: Male
Posts: 6
Hello there!
I'm new to this forum and learning Scripting for Pokemon, I'm a web, mobile and software programmer and I love to learn new programming skills, I've found this tutorial here: ./showthread.php?t=164276 (sorry unable to post links, so I only show the tread number [it's in here]) which btw I find it extremely good, and I wanted to start learning it and try it.

Now, what my problem is, my code make the "lock" and then nothing else happen, not even the release at the end, so I'm not sure what is wrong with my code? Hope I can get some help.

Code:
'-----------------------
#org 0x71A8BA
lock
countpokemon
compare LASTRESULT 0x0
if 0x1 goto 0x871A838
checkflag 0x8
if 0x1 goto 0x871A848
release
end

'-----------------------
#org 0x71A838
applymovement 0x1 0x871A8F4
msgbox 0x871A85B '"You can't go out without a pokemon,..."
release
end

'-----------------------
#org 0x71A848
applymovement 0x1 0x871A8F4
msgbox 0x871A89B '"Hello there!\nTake this potion."
setflag 0x8
release
end


'-----------
' Movements
'-----------
#org 0x71A8F4
#raw 12 'Step Left (Normal)
#raw 11 'Step Up (Normal)
#raw 2 'Face Left


'---------
' Strings
'---------
#org 0x71A85B
= You can't go out without a pokemon,\nit's dangerous out there!

#org 0x71A89B
= Hello there!\nTake this potion.
Thank you for your help!
Reply With Quote
  #2   Link to this post, but load the entire thread.  
Old January 2nd, 2015 (6:00 AM).
Mana's Avatar
Mana Mana is offline
 
Join Date: Jan 2009
Location: UK
Age: 31
Gender: Male
Posts: 10,075
countpokemon
compare LASTRESULT 0x0
if 0x1 goto 0x871A838
checkflag 0x8
if 0x1 goto 0x871A848


For one, your script only looks for having one pokemon and checking a flag (a flag which is unlikely to be safe).

Quote:
Originally Posted by KarateKid
Safe Flags:
->0x200-0x2FF
If you were testing it with a pokemon, and without the flag checked then nothing would happen. If you have a pokemon and the flag is checked you'll find this script gives you a potion every time you talk to them. Saying that, you're actually lacking any giveitem command to actually give the potion.

If flag X is checked when you receive a pokemon, then you don't even need the countpokemon option.

For your applymovement, you're missing a #raw 0xFE at the end, and your #raws are possibly incorrect. Assuming you're using FireRed it should be 0x11 and 0x12 not just 11/12.

Where did you get those offsets from by the way? Is it compiled in game and you decompiled it?
__________________
Reply With Quote
  #3   Link to this post, but load the entire thread.  
Old January 2nd, 2015 (6:09 AM).
GreenToxic GreenToxic is offline
 
Join Date: Dec 2014
Gender: Male
Posts: 6
Thanks for the fast reply, for the giveitem I know, it say I need to add a #define before it, so I removed it, because I have never seen another script that use #define giveitem ...
I write the script with XSE and then compiled it, that is the code compiled, my offset I've found them using the tool "Free Space Finder" inside "Advance Map"

I have writen the raws as #raw 0x11 but then when compiled it was converted to #raw 11.

What I want is, check if the person has at least one pokemon, if yes and if the flag is not set, then give a potion, else dont do anything.

Thank you.
Reply With Quote
  #4   Link to this post, but load the entire thread.  
Old January 2nd, 2015 (6:22 AM). Edited January 2nd, 2015 by Mana.
Mana's Avatar
Mana Mana is offline
 
Join Date: Jan 2009
Location: UK
Age: 31
Gender: Male
Posts: 10,075
Quote:
Originally Posted by GreenToxic View Post
Thanks for the fast reply, for the giveitem I know, it say I need to add a #define before it, so I removed it, because I have never seen another script that use #define giveitem ...
Hmm, that's odd. What version of XSE are you using? The last edition was 1.1.1 I think?

Quote:
Originally Posted by GreenToxic View Post
I write the script with XSE and then compiled it, that is the code compiled, my offset I've found them using the tool "Free Space Finder" inside "Advance Map"
Ah right. Well that's another thing! You can use #dynamic 0x740000 to automatically find offsets for your script, and XSE makes sure they are clear to use. That way you don't have to use FSF.

Quote:
What I want is, check if the person has at least one pokemon, if yes and if the flag is not set, then give a potion, else dont do anything.

Thank you.
Code:
#dynamic 0x740000
#org @start
lock
countpokemon
compare LASTRESULT 0x0
if 0x1 goto @STOP
checkflag 0x200
if 0x0 goto @GETPOTION // if flag is not set, go to next
release
end

'-----------------------
#org @STOP
applymovement 0x1 @Move1
waitmovement 0x0 // waits for movement to finish
msgbox @Talk1 0x6
release
end

'-----------------------
#org @GETPOTION
applymovement 0x1 @Move1 // ??? Do you want a movement here as well? Not sure.
waitmovement 0x0 // waits for movement to finish
msgbox @Talk2 '"Hello there!\nTake this potion."
giveitem 0xD 0x1 MSG_OBTAIN
setflag 0x200
release
end


'-----------
' Movements
'-----------
#org @Move1
#raw 0x12 0x11 0x1 0xFE


'---------
' Strings
'---------
#org @Talk1
= You can't go out without a pokemon,\nit's dangerous out there!

#org @Talk2
= Hello there!\nTake this potion.

#org @Talk3
= I GAVE YOU A POTION // whatever you want.
If this is a green floor-script tile, you'll need to include a 'setvar' command. Have a look in diego's tutorial, or in the one I linked above.

If this is a person-script, you'll probably want to add in another 'msgbox' in the first section, before the 'release/end'.
__________________
Reply With Quote
  #5   Link to this post, but load the entire thread.  
Old January 2nd, 2015 (7:01 AM).
GreenToxic GreenToxic is offline
 
Join Date: Dec 2014
Gender: Male
Posts: 6
I tryied your code, I had to download the latest XSE as the one I've donwloaded before this week wasnt the latest ( I had v 1.0.0 ) and now I can use giveitem and #raw isnt changing to 11, I only had to change one thing in msgbox @Talk2 and replaced it with 0x6, but when I run this code, and I step in the script event, it still do nothing, it do the lock then nothing else happens, the person that I want to move doesnt come talk to me.

I've recorded my screen to show what it does, the person next to me is the one I want to come and talk.
postimg.org/image/u81ayprxd/
Reply With Quote
  #6   Link to this post, but load the entire thread.  
Old January 2nd, 2015 (7:07 AM).
Mana's Avatar
Mana Mana is offline
 
Join Date: Jan 2009
Location: UK
Age: 31
Gender: Male
Posts: 10,075
Did you spot the note at the bottom about using 'setvar' if its a script tile? :) Probably that, I wasn't clear before what type of script you were using.
__________________
Reply With Quote
  #7   Link to this post, but load the entire thread.  
Old January 2nd, 2015 (7:19 AM).
GreenToxic GreenToxic is offline
 
Join Date: Dec 2014
Gender: Male
Posts: 6
Sorry about that, but I dont understand how or where to use the setvar, I know what it does but dont know how to use it for a tile script :/ where I can find the tutorial you're talking about? I dont see any link above.
Reply With Quote
  #8   Link to this post, but load the entire thread.  
Old January 2nd, 2015 (7:21 AM).
Mana's Avatar
Mana Mana is offline
 
Join Date: Jan 2009
Location: UK
Age: 31
Gender: Male
Posts: 10,075
Oh silly me, I quoted it but didn't link to the actual tutorial. It's this one, by KarateKid.
__________________
Reply With Quote
  #9   Link to this post, but load the entire thread.  
Old January 2nd, 2015 (7:40 AM).
GreenToxic GreenToxic is offline
 
Join Date: Dec 2014
Gender: Male
Posts: 6
Finally It's working! :D
Thanks a lot for your help!
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:10 AM.