Jump to content

Photo

Compiling Problem


  • Please log in to reply
10 replies to this topic

#1 tox_von

tox_von

    Zelda Addict

  • Members
  • Real Name:Redgor
  • Location:Toxicville , Simcity

Posted 08 December 2011 - 06:51 PM

What needs to be done to make this compile?

CODE
import "std.zh"


const int SECRET_AR_SIZE = 4; //Max number of global secrets
bool global_secrets[SECRET_AR_SIZE];



This is from my topic here at the end if i can figure it out i can have multiple secrets on the screen at once.

http://www.purezc.co...showtopic=52672

#2 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 08 December 2011 - 07:43 PM

Fixed:

CODE
import "std.zh"

bool global_secrets[4] = {0}; //Change 4 to max number of global secrets

//Place this FFC on top of the secret combo
//D0 = ID of this secret
//D1 = Combo # to change to
ffc script extraSecret{
    void run (int id, int secret){
        while(true){
            if ( global_secrets[id] )
                Screen->ComboD[ComboAt(this->X,this->Y)] = secret;
            Waitframe();
        }
    }
}


//Place this FFC on top of a self-only trigger
//D0 = ID of the secret to change
ffc script extraTrigger{
    void run (int id){ //Make this match the ID of the secret
        int combo = Screen->ComboD[ComboAt(this->X,this->Y)];
        while(Screen->ComboD[ComboAt(this->X,this->Y)]==combo)
            Waitframe();
        global_secrets[id]=true;
    }
}

Edited by MoscowModder, 08 December 2011 - 08:35 PM.


#3 tox_von

tox_von

    Zelda Addict

  • Members
  • Real Name:Redgor
  • Location:Toxicville , Simcity

Posted 08 December 2011 - 08:03 PM

this version places the secret before the trigger is set. How do i fix this? It the same as the file on the end of my other topic that can be downloaded.

Edited by tox_von, 08 December 2011 - 08:04 PM.


#4 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 08 December 2011 - 08:36 PM

Oops, forgot to set all the array's values to 0/false. Try again (and make a new save file if you saved after adding the script) with the updated version. ^^

#5 tox_von

tox_von

    Zelda Addict

  • Members
  • Real Name:Redgor
  • Location:Toxicville , Simcity

Posted 08 December 2011 - 09:21 PM

i used the above new version but it was stilll set before it was hit i can show the file if you need it.

Edited by tox_von, 08 December 2011 - 09:38 PM.


#6 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 08 December 2011 - 09:34 PM

First off, my correction above (global_secrets[4] = {0}) should make it work. Second, the indices (plural of index) of the array go from 0 to 3, not 1 to 4. Try my fix and see if it works.

Edited by MoscowModder, 08 December 2011 - 09:35 PM.


#7 tox_von

tox_von

    Zelda Addict

  • Members
  • Real Name:Redgor
  • Location:Toxicville , Simcity

Posted 08 December 2011 - 09:40 PM

i realised you changed the above but i used the above new version but it was stilll set before it was hit i can show the file if you need it.


It it this bit ?

CODE
if ( Screen->D[id] == 1 )
                Screen->ComboD[ComboAt(this->X,this->Y)] = secret;


could this bit

CODE
if ( global_secrets[id] )
                Screen->ComboD[ComboAt(this->X,this->Y)] = secret;


should it go back to the == 1 bit from the other code?

Edited by tox_von, 08 December 2011 - 10:02 PM.


#8 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 08 December 2011 - 10:46 PM

The ==1 part shouldn't be necessary. The comparison operator (==) turns it into a statement which can be true or false. If the number is equal to one, the statement is read as TRUE (1), otherwise FALSE (0). If you leave out the comparison, then it reads the variable itself as true/false. If the variable is 0, then the variable as a statement is false; otherwise it is true. Does this make sense to you?

In case it doesn't, think of it this way:
An if statement says "if the stuff in the parentheses is true, do this". The statement or variable is read as a number, which is simplified to true or false. If the stuff in the parenthesis is a statement, it resolves to TRUE if the statement is true. If the stuff is a number, then you just simplify the number to "0" (false) or "not 0" (true).

Edited by MoscowModder, 08 December 2011 - 10:50 PM.


#9 tox_von

tox_von

    Zelda Addict

  • Members
  • Real Name:Redgor
  • Location:Toxicville , Simcity

Posted 08 December 2011 - 10:54 PM

What do i need to do to make it work? Do you have an example file set up correctly?

#10 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 08 December 2011 - 11:10 PM

I got it to work.

Use this code (copied from above):
Code


Then assign the FFC scripts to 2 slots, make 2 FFCs (one of each), and set their D0 arguments to the same value (0-3). Put the trigger FFC on top of a Self only trigger combo and put the secret FFC on top of the combo you wish to change. Set the D1 argument of the secret FFC to the combo number to change to.

Edited by MoscowModder, 08 December 2011 - 11:10 PM.


#11 tox_von

tox_von

    Zelda Addict

  • Members
  • Real Name:Redgor
  • Location:Toxicville , Simcity

Posted 09 December 2011 - 12:09 AM

It still places the combo before the secret is triggered. WHat do i need to do to fix this?

http://www.mediafire...1hzlp8pdg8pzjh2



edit i figured out what i was doing wrong i had the d0 set to 4 not 0-3 and it seems to work now thanks.


There are still some problems with it when loaded with the spin trigger script it wouldnt work what would the conflicts be?

Also it doent go the correct color how do i set this with the combo?

Edited by tox_von, 09 December 2011 - 01:39 AM.



1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users