Thanks for the response, Bigg Boss! For the pop-up headlights, Franco's 3000GT wing was actually what I was thinking of using as the basis. What I need to figure out is how to read the time of day from within the java for the part. I'll have to go code-diving into the sources for the rest of the game, I guess.
As far as the needle, I remember reading that someone was unable find a way to access the current engine RPM reading (they were working on variable cam timing), but if I could figure it out, I would probably use the same method.
Neither of those things pertains directly to the Commodore; they're just for random other SLRR things.
Added 14 days later:
Got another scripting question. (I also posted this to GOM.)
I am having a problem getting a tuning menu to read the values from the menu into the part's variables. I have created tuning menus before, but I can never get multiple-choice menus (like the standard fuel type menu) to work. Additionally, even though I have gotten slider-based menus to work, I cannot get this one in particular to work; it seems very stubborn.
Here is the code in question. (I am omitting part of the java source because not all of it is relevant, and it is a rather lengthy class file. This IS for the animated headlights I was describing before.)
float rads, degs, fullcloserads, fullopenrads;
float old_rads;
float old_open_mode;
public int isTuneable()
{
return true;
}
public void buildTuningMenu( Menu m )
{
demonstrate_sleeper = 1;
old_rads = rads;
degs = rad2deg(rads);
old_open_mode = open_mode;
String[] headlightmodeText = new String[4];
headlightmodeText[0] = "Standard (Full Open/Close)";
headlightmodeText[1] = "Full Close, Custom Angle When Open";
headlightmodeText[2] = "Custom Angle When Closed, Full Open";
headlightmodeText[3] = "Custom Angle Full-Time";
m.addItem( "Headlight Mode: ", 2, open_mode, headlightmodeText, null );
m.addItem( "Custom Headlight Angle", 1, degs, (rad2deg(fullcloserads)), (rad2deg(fullopenrads)), 1.1, null ).printValue(" %1.1f degrees");
m.addItem( "Reset to factory defaults", 0); //this should always be with cmd=0
}
public void endTuningSession( int cancelled )
{
if( cancelled )
{
rads = old_rads;
open_mode = old_open_mode;
}
else
{
if (rads != old_rads)
GameLogic.spendTime(5*60);
if (open_mode != old_open_mode)
GameLogic.spendTime(5*60);
getCar_LocalVersion();
if (the_car)
the_car.forceUpdate();
}
demonstrate_sleeper = 0;
animate_progress = 0.5; // forces animation to reset
}
public void handleMessage( Event m )
{
if( m.cmd == 0 )
{
rads = fullopenrads;
m.gadget.osd.findGadget( this, 1 ).setValue( 0 );
m.gadget.osd.findGadget( this, 2 ).setValue( rad2deg(fullopenrads) );
setSlotPos( 7, null, new Ypr(0.000,rads,0.000) );
open_mode = 0;
}
else
if( m.cmd == 1 )
{
rads = deg2rad(((Slider)m.gadget).value);
degs = ((Slider)m.gadget).value;
((Slider)m.gadget).changeVLabelText( Float.toString(degs, " %1.1f degrees"));
setSlotPos( 7, null, new Ypr(0.000,rads,0.000) );
}
else
if( m.cmd == 2 )
{
open_mode = ((MultiChoice)m.gadget).value;
}
}
public float rad2deg( float rad )
{
return(rad * 180 / 3.141);
}
public float deg2rad( float deg )
{
return(deg * 3.141 / 180);
}