The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Fan Games > Binary ROM Hacking
Reload this Page Script Yes/No Scripts

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 July 4th, 2018 (2:55 PM). Edited July 4th, 2018 by Ace Trainer Slash.
Ace Trainer Slash's Avatar
Ace Trainer Slash Ace Trainer Slash is offline
If you give me about two hours, I can make scripts without a guide!
 
Join Date: Jun 2018
Location: Australia.
Age: 20
Gender: Male
Nature: Jolly
Posts: 235
Hello :)

I tried making my very first Yes/No script a few days ago, but there seems to be an error.
The Script is in spoilers.
The error is that whenever I click the 'No' option in-game, it wouldn't do anything, and if I clicked the A button, it would loop the Yes/No script for some reason. When I click the 'Yes' option in game however, it works as intended to.
Any ideas on what I have made an error in via script?

Spoiler:
#dynamic 0x800000

#org @start
lock
faceplayer
msgbox @question 0x5
compare 0x800D 0x1
if 0x1 goto @yes
compare 0x800D 0x0
if 0x0 goto @no
end

#org @yes
msgbox @dedenne 0x6
release
end

#org @no
msgbox @excuse 0x6
release
end

#org @question
= Hi there, you like Dedenne?

#org @dedenne
= Oh, you like Dedenne?\n Truly Excellent!

#org @excuse
= Excuse me?!\nDon't talk to me\lagain!
Reply With Quote
  #2   Link to this post, but load the entire thread.  
Old July 4th, 2018 (3:50 PM).
DrFuji's Avatar
DrFuji DrFuji is offline
Heiki Hecchara‌‌
 
Join Date: Sep 2009
Location: Aussie
Age: 30
Gender: Male
Nature: Jolly
Posts: 1,693
You've used the 'if' statement for @no incorrectly. When you're checking for an exact number in a variable (in this case, 0x0 as that's what's returned when you say no) you need to have the if statement be 0x1 like this:

Spoiler:
...
compare 0x800D 0x0
if 0x1 goto @no
end


This value is has the following meanings:

Code:
Lower Than (0x0)
Equals (0x1)
Greater Than (0x2)
Lower than or Equal to (0x3)
Greater than or Equal to (0x4)
Not exactly equal to (0x5)
You can also rewrite this script to make it shorter and less of a hassle. Since you're using a Yes/No msgbox you only need to make one check to find out the player's answer. Once you've branched the script off to @yes there's no need to check 0x800D again for @no as its a binary question. Here's what it should look like:

Spoiler:
#dynamic 0x800000

#org @start
lock
faceplayer
msgbox @question 0x5
compare 0x800D 0x1
if 0x1 goto @yes
msgbox @excuse 0x6
release
end

#org @yes
msgbox @dedenne 0x6
release
end

#org @question
= Hi there, you like Dedenne?

#org @dedenne
= Oh, you like Dedenne?\nTruly Excellent!

#org @excuse
= Excuse me?!\nDon't talk to me again!
__________________
Reply With Quote
  #3   Link to this post, but load the entire thread.  
Old July 4th, 2018 (4:45 PM).
Ace Trainer Slash's Avatar
Ace Trainer Slash Ace Trainer Slash is offline
If you give me about two hours, I can make scripts without a guide!
 
Join Date: Jun 2018
Location: Australia.
Age: 20
Gender: Male
Nature: Jolly
Posts: 235
Oh... Ok then!
Thankyou for correcting my error, and the extra insights of making the script shorter. :)
This will prove helpful to me in the future the next time I attempt Yes/No scripts! :D
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
Thread Tools

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:14 AM.