Jump to content

Photo

ALTTP Torches Lighting Room.


  • Please log in to reply
42 replies to this topic

#1 AdmiralJaden

AdmiralJaden

    Experienced Forumer

  • Members

Posted 26 February 2016 - 04:47 AM

Ok, so, I'm looking for a script (or other method, either way) that will allow a combo (in this case, a lit torch, which is lit by the player using candles and/or other flames) to act like flame, which would light the room (which is set to dark via the Screen Data -> View -> Dark Room).

If that didn't make sense, basically I want a specific combo (which has a fire graphic) to be counted as flame on the screen, so when that combo is on screen, the room lights up as if you just used the candle.

 

I haven't been able to find any scripts that would do this, though.

 

Also, I only plan on having one unlit torch per dark screen, and the player using only the candle to try to light the room, only yields a temporary result (via quest rule "Dark Rooms Stay Lit Only When Fire Is On Screen"). So basically the only way the screen will stay lit is if Link lights a torch.

 

I hope I'm making sense here, but if not, just let me know. I don't know enough about the scripting stuff for zquest to know what all would be needed to do this, so if anyone needs details that I haven't stated, let me know.

 

At first glance, this sounds like a simple thing to accomplish, but I could be wrong.  :shrug:

 

Thanks for reading and responding.

P.S. The lit torch stays lit until Link leaves the screen, don't know if you all needed that info, but yeah.


Edited by AdmiralJaden, 26 February 2016 - 04:48 AM.


#2 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 26 February 2016 - 08:31 AM

I wrote this up for you, but I've not tested it. It not only lights a room, but causes it to fade from black to fully lit in stages. Fade from black, if you will.
 
I'm exhausted, so try it if you wish, and report any errors, or problems. I'm off to retire for the day.
 


If you don't want these special effects here's a dead-simple version:


Edited by ZoriaRPG, 26 February 2016 - 08:58 AM.


#3 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 26 February 2016 - 08:59 AM

Here's an expanded version that doesn't require setting up combo flags, and handles unlit to lit torch interaction with custom mechanics:



#4 AdmiralJaden

AdmiralJaden

    Experienced Forumer

  • Members

Posted 26 February 2016 - 09:40 AM

Thank you for your responses. I'm getting an error on both the expanded one (in your second post), and the other one that uses fading layers from your first post, on the same script command "inittorchtimers" (line 93 in the expanded one), it says "unexpected identifier, expecting $end, on token 'inittorchtimers'."

I got a similar error on the simplest version as well: "Line 46 syntax error, unexpected assign, expected semi-colon, on token ="



#5 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 27 February 2016 - 05:42 AM

Here are those two issues resolved:

Simple Torches

 

Layered Version

 

Errors of some sort may still exist.


Edited by ZoriaRPG, 27 February 2016 - 06:27 AM.


#6 AdmiralJaden

AdmiralJaden

    Experienced Forumer

  • Members

Posted 27 February 2016 - 06:44 AM

Ok, new errors are:

Simple Version:
Error Line 46: Syntax Error, Unexpected RBrace, Expecting Semicolon, On Token }

 

Layered Version:
Line 142: Syntax Error, Unexpected LParen, Expecting Assign, On Token (



#7 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 27 February 2016 - 09:00 AM

Ok, new errors are:

Simple Version:
Error Line 46: Syntax Error, Unexpected RBrace, Expecting Semicolon, On Token }

 

Layered Version:
Line 142: Syntax Error, Unexpected LParen, Expecting Assign, On Token (

 

 

It was just missing one semicolon...

 

 

It would probably best if you wait for me to fully-test the bigger script, if you aren't able to self-debug.

 


Edited by ZoriaRPG, 27 February 2016 - 09:02 AM.


#8 AdmiralJaden

AdmiralJaden

    Experienced Forumer

  • Members

Posted 27 February 2016 - 09:44 AM

Yeah, that's probably a good idea. Admittedly, I know almost nothing of zscript's syntax and such. I might get there eventually, but at the moment I wouldn't be able to debug.



#9 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 27 February 2016 - 11:18 AM

Yeah, that's probably a good idea. Admittedly, I know almost nothing of zscript's syntax and such. I might get there eventually, but at the moment I wouldn't be able to debug.

 

I understand. That complex script requires somewhat extensive tests. The simple one should be ready to use.

 

At present, when I'm working, I only have my tiny netbook with me, and testing this stuff on it is a gigantic pain in the neck. Otherwise, I would have perfected them, prior to posting them. (I wasn't sure if you would have been able to fix minor errors, or typos.)


Edited by ZoriaRPG, 27 February 2016 - 11:20 AM.


#10 AdmiralJaden

AdmiralJaden

    Experienced Forumer

  • Members

Posted 27 February 2016 - 12:18 PM

It's cool, I'm in no big hurry lol. Take your time, I appreciate it. 

I still get an error on the smaller script as well, at:

 

int main() { return GRAM( GR_MAIN); }  (as well as two other lines afterward, each with GRAM in it) stating that 'function GRAM was undeclared'.

 

Out of curiosity, what does GRAM do? I've been looking at the script, and I noticed it was a float (constant) array, but beyond that, I can't tell.



#11 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 01 March 2016 - 06:17 AM

I must have forgotten to include it?
 

//import "std.zh"
    //Remove the comment before the import directive
    //instruction if you do not elsewhere call this.

/////////////////////////////////////////
// Basic : Lit Toeches Dispel Darkness //
//   v0.2 - 26th February, 2016        //
//         By: ZoriaRPG                //
///////////////////////////////////////////////////////////////////////////////////
// This script set creates a fading darkness effect when a lit torch set by the  //
// constant 'CMB_LIT_TORCH'.                                                     //
// ----------------------------------------------------------------------------- //
// [ 1 ] Set-Up: Make a 'lit torch' combo, and assign its ID to the constant     //
//       CMB_LIT_TORCH.                                                          //
// [ 2 ] Set up a combo ont he screenwith a secret flag (burn).                  //
//       Set the 'burn' combo in Screen->Secret Combos to match the combo that   //
//       you selected as 'CMB_LIT_TORCH'.                                        //
///////////////////////////////////////////////////////////////////////////////////

//////////////
// SETTINGS //
//////////////

//Combo and Colour Constants

const int CMB_LIT_TORCH             = 0;    //Set to the combo number of the torch in its lit state.


/////////////////////
// ARRAYS AND VARS //
/////////////////////

float GRAM[214727]; //Global Array to hold values.

//Array indices:
const int GR_MAIN = 214747;

/////////////////////////////////////
// DARKNESS AND LIGHTING FUNCTIONS //
/////////////////////////////////////

//The primarycomponent function, called by Torches()
void SimpleLightRoom(){
    if ( !Screen->Lit ) {
        for ( int q = 0; q <= 6; q++ ) { //layers
            if (Screen->LayerMap(q) != -1) {
                for ( int w = 0; w < 176; w++ ){
                    if ( Screen->ComboD[q] == CMB_LIT_TORCH ) Screen->Lit = true;
                }
            }
        }
    }
}

///////////////////
// GLOBAL SCRIPT //
///////////////////

global script active_example_timed_fading_torch_darkness{
    void run() {
        main(true); //Enable the main loop.
        while( main() ) {       //! I do this, instead of while(true) to allow suspending it,
                                //! and changing to an alternate global loop, as an option.
            
            SimpleLightRoom(); //The main function for custom darkness (no special effects version)
     
            Waitdraw();

            Waitframe();
        }
    }
    int main() { return GRAM(GR_MAIN); }

    void main(bool enabled) {
        if ( enabled ) GRAM(GR_MAIN,1);
        else GRAM(GR_MAIN,0);
    }
}

int GRAM(int index){ return GRAM[index];} //Returns the value of specified index of Global RAM array.
void GRAM(int index, int val){GRAM[index]=val;} //Sets Global RAM array index to a specific value.

Edited by ZoriaRPG, 03 March 2016 - 12:53 AM.


#12 AdmiralJaden

AdmiralJaden

    Experienced Forumer

  • Members

Posted 02 March 2016 - 06:18 AM

Just tested, it says now that GR_MAIN is undeclared.



#13 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 02 March 2016 - 07:15 AM

Just tested, it says now that GR_MAIN is undeclared.


Edited above.

#14 AdmiralJaden

AdmiralJaden

    Experienced Forumer

  • Members

Posted 02 March 2016 - 07:52 AM

Ok, next is on the line with

if (Screen->LayerMap != -1) {

It says that pointer type does not have a variable layermap.



#15 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 02 March 2016 - 11:51 AM

Ok, next is on the line with

if (Screen->LayerMap != -1) {
It says that pointer type does not have a variable layermap.


Also fixed above.

Another thing to note, is that you need to assign a value to :

const int CMB_LIT_TORCH             = 0;    //Set to the combo number of the torch in its lit state.
Find out the combo number of your lit torch comb, and change the 0 to that number.


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users