Flags - Forum
Main My profile Registration Log out Login
Pokemon Hacking
Saturday
10.12.2016
11:19 PM
Welcome Guest | RSS LoginRegistrationMain
[ New messages · Members · Forum rules · Search · RSS ]
Page 1 of 11
Forum moderator: fuzzyketchup 
Forum » Tools » Pokescript » Flags (How to use flags in Pokescript)
Flags
fuzzyketchupDate: Wednesday, 2012-10-03, 3:52 PM | Message # 1
Private
Group: Administrators
Messages: 14
Status: Offline
Alright we're getting into the fun stuff. We'll need an example script to get this started.

#org $oak2
lock
faceplayer
checkflag 0x1200
if b_true goto $remember
checkflag 0x1201
if b_true goto $remember1
message $1
$1 1 = Oak: Do you have a question?
boxset 5
compare LASTRESULT 0x1
if b_true goto $yes
setflag 0x1200
message $2
$2 1 = Alright, I'll remember that you don't\nhave a question for me.
boxset6
release
end

#org $yes
lock
faceplayer
message $3
$3 1 = I don't really have time to answer it\nright now, come back later.
boxset 6
setflag 0x1201
release
end

#org $remember
lock
faceplayer
message $4
$4 1 = You told me you didn't have\na question. Do you have\la question after all?
boxset 5
compare LASTRESULT 0x1
if b_true goto $clear
release
end

#org $remember1
lock
faceplayer
message $5
$5 1 = Ah, \v\h01!\nYou had a question?
boxset 5
compare LASTRESULT 0x1
if b_false goto $clear
message $6
$6 1 = Wow, you're persistant.
boxset 6
release
end

#org $clear
lock
faceplayer
clearflag 0x1200
clearflag 0x1201
release
end

You should have the first part down so I'm going to go ahead and explain what you might have missed, and what is new.
checkflag 0x1200: This checks to see if the flag 0x1200 has been set.
if b_true goto $remember: If checkflag 0x1200 HAS been set the script will move to $remember ignoring the rest of the script until that point.
checkflag 0x1201: This will only be checked if flag 0x1200 has NOT been set.
if b_true goto $remember1: If checkflag 0x1201 HAS been set the script will move to $remember1 ignoring the rest of the script until that point.
message $1: This is a yes or no question, that's important.
boxset 5: Makes it a yes or no question, that's still important.
compare LASTRESULT 0x1: Checks the answer of the yes or no question. If you haven't guessed THAT'S IMPORTANT!
if b_true goto $yes: Alright this is the important part. If the answer was yes the script will move to $yes (read Yes/No questions for reveiw). If the player selects no it will contiunue down the script.
setflag 0x1200: This is the command to set a flag for the checkflag code to find. If this code has gone off then the checkflag 0x1200 will not continue as it did the first time you talked to Oak. Instead if you reinitiate a conversation with Oak you will be redirected to $remember. You have to use 4 didgets, but you should be fine. You can also use hexidecimal if you want. (for example once you reach 1210 you could put 120a, 120b, ect. until you reach 120f). You can put any 4 didgets if you haven't used them previously in ANY script, not just this one.
message $2: This message basically tells the player that he'll remember the question.

Alright now we have the $yes script
The only really important thing in this script is that it sets flag 0x1201. Because of this, regardless of weather Yes or No was selected as the option, the game knows the difference. Yes being flag 0x1200 and No being flag 0x1201
Another important thing to remember in this script is the message containing a \n is just going to the next line. I don't know the exact number of characters in this, so you'll need to double check to make sure you put the lines in the right places.
Now the script #org $remember.
In this script Oak assumes you DON'T have a question. If you tell him you have a question after all it will move you to $clear.

#org $remember1
In the message remember that \v\h01 is the players name.
In this he remembers that you did have a question. If you tell him yes he will answer you "Wow you're persistant."
if b_false goto $clear: This is just like if b_true, but it only activates if the player answers No.

#org $clear
Since both $remember and $remember1 I set it up accordingly.
clearflag 0x1200: This will work even if you don't have flag 0x1200 set. This can be useful if you want a resetable event such as a mini game.
clearflag 0x1201: This is he same as clearflag 0x1200, I put it in because $remember1 doesn't need 0x1200 cleared, it needs 0x1201 cleared. This is basically a reset for this script. If you talk to Oak after reseting both flags it will be like you never talked to him.


Creator of http://pkmnhacking.ucoz.com

 
Forum » Tools » Pokescript » Flags (How to use flags in Pokescript)
Page 1 of 11
Search:


Copyright FuzzyketchupTuts © 2016
Create a free website with uCoz
Scratch Project