WiiRd forum

Wii & Gamecube Hacking => Wii Game hacking help => Topic started by: oromis on April 05, 2012, 11:03:32 PM

Title: If/Else statement for button activator
Post by: oromis on April 05, 2012, 11:03:32 PM
Hello, recently I've read up some on button activators, and how to implement them into code, but one thing I was wondering is if it is even possible to do an if else statement with a button activator?

Psuedo of what I'm thinking:


If(button is pressed)
{Do this code}
Else
{Do this code}

I'm also curious about if there is a code to be able to do chunks of code with a button activator, thanks to anyone who cn shed some light on this:-)
Title: Re: If/Else statement for button activator
Post by: dcx2 on April 08, 2012, 03:07:01 AM
There is an "else" code type but I've heard that it doesn't work as expected.

Your best bet is to do two if statements.  e.g.

if (a pressed)
{ do first code }
end if; if (a not pressed)
{ do second code }

---

Depending on your code, you may also be able to get away with just one if.  For example, you could do

{ do second code }
if (a pressed)
{ do first code }

In this case, if a is pressed, the first code will "overwrite" what the second code did.
Title: Re: If/Else statement for button activator
Post by: Bully@Wiiplaza on April 08, 2012, 11:43:25 AM
28XXXXXX YYYYZZZZ
>CODE<
E2100000 00000000
>ANTI CODE<
E0000000 80008000

This works, I´ve used it multiple times. ;D