Page 1 of 1

some code scripting knowledge needed?

PostPosted: Thu Nov 10, 2011 7:03 pm
by tinkergnome
hi ..... i was wondering about
if... then statements? & case select?

i need to know instead of if(x1.textNumber> 10) "this will happen";'
what about if a textNumber=10???? i want to know how that can be different.

with case select (if that is possible????) how do i arrange the code for certain things to happen?

i have an idea about creating a specific type of mahjong tile game ..... i wasnt sure if those 2
code pieces would suffice in any building into a mahjong game. i want to include some most
academic type of coding but keeping it simple.

Re: some code scripting knowledge needed?

PostPosted: Thu Nov 10, 2011 11:47 pm
by skydereign
You can do this though I suggest you never use textNumber like that.
Code: Select all
if(textNumber==10)
{
    // do this
}

// here are other ways of using if
if(var>=0) { /* code */ }
if(var<=0) { /* code */ }
if(var>0) { /* code */ }
if(var<0) { /* code */ }
if(var!=0) { /* code */ }

The only time I'd suggest using textNumber, is setting textNumber equal to something. You can also use switch statements, which is probably what you mean by case select.
Code: Select all
switch(int_var)
{
    case 0: // execute code if int_var==0
    // this until the break
    break;

    case 1: // execute code if int_var==1
    // code
    break;

    case 2: // if int_var==2
    break;

    default: // if no other cases were met
    break;
}