Cockpit

* User Profile

Welcome, Guest. Please login or register.

Login with username, password and session length

Who's Online

  • *Users: 3
  • *Guests: 42
  • *Total: 45

FlightSimExpo 2018

Our Discord

GDPR - Important Notice


From the 26th of May, ALL USERS CONTINUING TO USE THIS WEBSITE - Agree to the amended "End User License Agreement"
This includes the European GDPR changes, whereby continuing to use this forum you agree to those amended terms as we have them stated.

If any user is unwilling to accept the AMENDED EULA with regard to the European GDPR Changes, He/She can email me directly and request their account be deleted.

Thank You, Trevor Hale

Author Topic: How to increase an Lvar value by 6 or -6 ? - ANSWERED  (Read 949 times)

Offline Stinger2k2

  • CockpitBuilder
  • *
  • Posts: 14
  • Karma: +1/-0
  • Aviation Enthusiast
  • First Name: Keith
  • Home Location: Bexhill , England
How to increase an Lvar value by 6 or -6 ? - ANSWERED
« on: February 11, 2017, 10:41:26 AM »
Hi,

I am trying to increase the value of my Lvar in increments of 6 from 0-354.

Whats the LUA code for this as my existing code results in
an error saying that I am trying to perform arithmetic on a string.

Heres what I wrote....

function AltPlusSlow
if ipc.readLvar("name") == 354 then
ipc.writeLvar("name", 0) else
ipc.writeLvar("name" +6)
end
end

thanks for looking!

cheers
Stinger
« Last Edit: February 13, 2017, 04:41:05 AM by Stinger2k2 »

Offline Stinger2k2

  • CockpitBuilder
  • *
  • Posts: 14
  • Karma: +1/-0
  • Aviation Enthusiast
  • First Name: Keith
  • Home Location: Bexhill , England
Re: How to increase an Lvar value by 6 or -6 ?
« Reply #1 on: February 13, 2017, 04:40:22 AM »
Okay now,
A kind fellow on another forum helped me sort it out.
It just needed me to write in a local var.
The code now looks something like this....

function AltPlusSlow
local var = ipc.readLvar("name")
   if var = 354 then
ipc.writeLvar("name", 0)
else
var = var +6
ipc.writeLvar("name", var)
end
end

Sorry for sounding like a coding newbie but
that's exactly what I am !! lol.
cheers
Stinger

Offline Trevor Hale

  • Administrator
  • I am chained to this website!
  • *
  • Posts: 3,530
  • Karma: +21/-0
    • Cockpitbuilders.com
  • First Name: Trevor
  • Home Location: New Liskeard, Ontario
Re: How to increase an Lvar value by 6 or -6 ? - ANSWERED
« Reply #2 on: February 13, 2017, 07:16:14 AM »
Don't be sorry. We all appreciate you posting your answers here.


Thank you.
Trevor Hale

Owner
http://www.cockpitbuilders.com

Director of Operations
Worldflight Team USA
http://www.worldflightusa.com

VATSIM:

 

Recent Posts

Interfacing Cole Starter Switches
by Trevor Hale
[Today at 03:10:34 PM]
JetMax Overhead Support
by jackpilot
[Today at 02:32:24 PM]
Join me on Vatsim Tonight
by Trevor Hale
[May 25, 2018, 06:31:25 PM]
Cole Starter Switches
by fsaviator
[May 25, 2018, 05:47:45 PM]
Cockpitbuilders EULA UPDATE May 25th 2018
by Trevor Hale
[May 25, 2018, 10:19:41 AM]
HELP NEEDED WITH "PAUSE ON TASK SWITCH" PLEASE!
by Trevor Hale
[May 25, 2018, 08:49:52 AM]
King Air B200 reference material
by archen
[May 25, 2018, 08:43:37 AM]
F-18 cockpit(s) for sale
by SAMEtech
[May 24, 2018, 01:00:34 PM]
MH-60 Helicopter (retired Navy simulator) for sale
by navymustang
[May 24, 2018, 09:43:41 AM]
737-800 Arduino X-Plane Build
by kurt-olsson
[May 24, 2018, 07:32:39 AM]
AIRBUS-A-310-SERIES-FMC/CDU FOR SALE
by N606DL
[May 23, 2018, 06:54:26 AM]
For Sale GoFlight Jet Console, 2 Private Pilot Racks all with GoFlight Modules.
by blueskydriver
[May 23, 2018, 03:27:09 AM]
For Sale-Real Cockpit Gauges...
by blueskydriver
[May 23, 2018, 03:24:59 AM]
Two Cockpits For Sale
by blueskydriver
[May 23, 2018, 03:21:12 AM]
B737-800 nose pitching up too much during take-off run
by Lee737
[May 22, 2018, 09:49:50 PM]
PMDG 737 on P3dV4 and 1PC Setup
by seedosip
[May 22, 2018, 10:21:40 AM]
FDS 747 MIP Price reduced!
by 777 driver
[May 21, 2018, 10:03:40 PM]
Faceplates for instruments
by ifeliciano
[May 19, 2018, 04:01:07 PM]
Homebuilt TQ has been sold
by Maurice
[May 18, 2018, 04:18:29 PM]
Wanted: Boeing 737 Throttle
by jackpilot
[May 18, 2018, 03:35:46 PM]
What have you done for your simulator today?
by jackpilot
[May 18, 2018, 09:23:59 AM]
TQ 737 Jet Max for sale
by pilota1748
[May 18, 2018, 07:29:52 AM]
Inclinometer
by Atomic_Sheep
[May 18, 2018, 04:55:33 AM]
Hola from Spain
by seedosip
[May 17, 2018, 05:36:44 AM]
Gas strut newton for elevation
by kurt-olsson
[May 16, 2018, 03:44:25 PM]
Vendor Questions
by Trevor Hale
[May 16, 2018, 03:20:56 PM]
Another AC/DC Panel dimenssion request
by bernard S
[May 16, 2018, 12:23:58 PM]
Mickey's Flightdeck - A Boeing 737-800 Cockpit on Youtube
by seedosip
[May 16, 2018, 05:10:28 AM]
New member - new topic - Hagstrom KEUSB 108 - windows 7 problem
by sedge
[May 14, 2018, 10:34:35 PM]
Purchased: Real Boeing 737 TQ
by Steenos
[May 14, 2018, 03:20:34 PM]