Jump to content

Photo

Candle in inventory = automatically lit dark rooms


  • Please log in to reply
4 replies to this topic

#1 Jenny

Jenny

    braixen

  • Members
  • Real Name:Jennette
  • Pronouns:She / Her

Posted 03 June 2019 - 03:22 AM

Not sure how possible this is but basically I want it so that if the candle is in your inventory at all upon entering a dark room, the darkness is automatically removed (rather than having to get the candle out and light it manually)


  • ShadowTiger and Shane like this

#2 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 03 June 2019 - 11:18 AM

Not sure how possible this is but basically I want it so that if the candle is in your inventory at all upon entering a dark room, the darkness is automatically removed (rather than having to get the candle out and light it manually)

 
 
You did not specify a version!!
 
In 2.55a24, you can simly use a passive item script:
 

item script autocandle
{
    while(1)
    {
        if ( !Screen->Lit ) Screen->Lit =  true;
        Waitdraw();
        Waitframe();
    }
}

Set that scrpt to your candle, then enable the Item Editor flag Constant Script for that item, and you are done! The item itself runs this.

 

In 2.53, you would need to call something similar, as a function in your global active script.

//2.53
const int I_AUTOCANDLE = 99; //Set to item ID

void do_autocandle
{
    if ( Link->Item[I_AUTOCANDLE] )
    {
    if ( !Screen->Lit ) Screen->Lit =  true;
    }
}

You can see where 2,5 5 has obvious benefits, with more, far smaler scrupts, rather than tacing more function calls into one massive lobal active script.

 

LMK what version you are using. If it is < 2.53, then those versions are now oifficially unsupported.
 


  • Shane and Jenny like this

#3 Jenny

Jenny

    braixen

  • Members
  • Real Name:Jennette
  • Pronouns:She / Her

Posted 03 June 2019 - 01:00 PM

My bad for not clarifying, I'm using 2.53 as of now.


  • Shane likes this

#4 Twilight Knight

Twilight Knight

    Tell all with glee, Argon's on PureZC

  • Members
  • Real Name:Sven
  • Location:Rotterdam, NL

Posted 03 June 2019 - 03:44 PM

Thanks for your help ZoriaRPG


  • Shane and coolgamer012345 like this

#5 coolgamer012345

coolgamer012345

    🔸

  • Members
  • Location:Indiana, USA

Posted 03 June 2019 - 07:00 PM

I altered the script so the transition looks a bit nicer:

//2.53
const int I_AUTOCANDLE = 99; //Set to item ID

void do_autocandle()
{
    if ( Link->Item[I_AUTOCANDLE]  && Link->Action != LA_SCROLLING)
    {
    if ( !Screen->Lit ) Screen->Lit =  true;
    }
}

This doesn't affect warps transitions, but those wouldn't be a line of code to fix I don't think.


  • Shane and Jenny like this


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users