Author Topic: Stupid Programming Question  (Read 233 times)

FrizzleFried

  • Sr. Member
  • ****
  • Posts: 168
    • View Profile
    • Idaho Garagecade
Stupid Programming Question
« on: February 07, 2019, 06:23:22 AM »
Yes... I am sure it is...

OK,

Currently I have the following code in my settings...

</ label="Star speed", help="Speed of starfield | negative = backwards|positive = forwards|0 = stop (-25 to 25, default=4)", order=o++ /> speed="4";

This allows folks to choose the speed of the "star field" on the layout.  I want to change the way this works to make it more friendly for arcade cabinets.  Rather than allow them to type in a number between -25 and 25,  I would prefer to have options such as "WARP 10, WARP 5, CRUISING, PUTTING, STANDING STILL, REVERSE SLOW, REVERSE FAST, REVERSE WARP 5, REVERSE WARP 10" and then assign each a "speed" number.

Amazingly,  I am having such a hard time doing this.   

I can get the setting to show up right (of course)... but my code to actually assign "speed="x"" just doesn't work.

Now,  this SPEED setting is for a separate NUT file that is loaded up with a DO_NUT from the layout... but one would think this should be as easy as putting this in the settings section:

</ label="Star speed", help="Speed of starfield", options="WARP 10, WARP 5, CRUISING, PUTTING, STANDING STILL, REVERSE SLOW, REVERSE FAST, REVERSE WARP 5, REVERSE WARP 10" order=o++ /> starspeed="WARP 10";

if (my_config["starspeed"] == "WARP 10" )
{
speed="25"
}
if (my_config["starspeed"] == "WARP 5" )
{
speed="15"
}

...etc...


then move on to the DO_NUT line... but nope.  I am no programmer,   just a hack at best,  so any help would be appreciated.

Visit my arcade blog ... www.idahogaragecade.com (updated 12-13-18)

FrizzleFried

  • Sr. Member
  • ****
  • Posts: 168
    • View Profile
    • Idaho Garagecade
Re: Stupid Programming Question
« Reply #1 on: February 07, 2019, 09:48:30 PM »
FWIW you can see the setting in this video.  I change it a few different times... "Star Speed"... I want to be able to just select a pre-determined setting versus having to type in the number...

This is the only thing holding me up from releasing V4 of SDArcade...

https://youtu.be/n0Q2rWFa3ak

Visit my arcade blog ... www.idahogaragecade.com (updated 12-13-18)

FrizzleFried

  • Sr. Member
  • ****
  • Posts: 168
    • View Profile
    • Idaho Garagecade
Re: Stupid Programming Question
« Reply #2 on: February 08, 2019, 01:19:09 PM »
Perhaps this wasn't such a stupid question after all?

 :o

Visit my arcade blog ... www.idahogaragecade.com (updated 12-13-18)

keilmillerjr

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 815
    • View Profile
Re: Stupid Programming Question
« Reply #3 on: February 08, 2019, 01:27:16 PM »
Share more of the code please.

FrizzleFried

  • Sr. Member
  • ****
  • Posts: 168
    • View Profile
    • Idaho Garagecade
Re: Stupid Programming Question
« Reply #4 on: February 08, 2019, 03:03:35 PM »
Share more of the code please.

OK... I have a separate star.nut file...

Currently the only code I have in the Layout file is:

</ label="Star speed", help="Speed of starfield | negative = backwards|positive = forwards|0 = stop (-25 to 25, default=4)", order=o++ /> speed="4";

in the settings section and of course:

fe.do_nut("scripts/star.nut");

...down from the settings a bit.

Currently you're required to put in a number between -25 to 25 to determine the speed of the stars.  Negative numbers are "reverse" while positive numbers are forward and zero is "standing still".

I want to make the settings more "arcade cabinet" friendly by setting up 7 or 9 pre-determined settings to choose from... for example:

WARP 10 would set speed="20"
WARP 5 would set speed="10"
CRUISE would set speed="3"
LIMPING would set speed="1"
STALLED would set speed="0"
BACK PEDDLING would set speed="-1"
BACKING UP would set speed "-3"
REVERSE WARP 5 would set speed="-10"
REVERSE WARP 10 would set speed="-20"

...or something to that effect...

Seems like it SHOULD be easy to do this... but whatever I try fails.

STAR.NUT is attached as well.
Visit my arcade blog ... www.idahogaragecade.com (updated 12-13-18)

FrizzleFried

  • Sr. Member
  • ****
  • Posts: 168
    • View Profile
    • Idaho Garagecade
Re: Stupid Programming Question
« Reply #5 on: February 11, 2019, 10:58:35 AM »
This problem has been solved by guntherm ... my latest partner in crime on this particular layout... I look forward to releasing it very soon.
Visit my arcade blog ... www.idahogaragecade.com (updated 12-13-18)

gunthermic

  • Full Member
  • ***
  • Posts: 25
    • View Profile
Re: Stupid Programming Question
« Reply #6 on: February 12, 2019, 12:35:12 AM »
This problem has been solved by guntherm ... my latest partner in crime on this particular layout... I look forward to releasing it very soon.

hahahaha.. partner in crime. you got that right!