Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Decimal multiplication in XML

Featured Replies

In the following code, each click on a gauge button increases the CourseSet variable by one. It will count up to 359, then reset to zero on the next click. These values are degrees on the compass. On the last line, I want to convert the degree value into radian for further calculations. When the degrees are multiplied by .01745, a zero value always results. If the code below is incorrect, how do you multiply decimal values in XML?(L:CourseSet, degrees) 1 + (>L:CourseSet, degrees) ;(L:CourseSet, degrees) 359 > if{ 0 (>L:CourseSet, degrees) } ;(L:CourseSet, degrees) .01745 * (>L:CourseRadian, radian)I've also substituted this code on the last line above to see if XML would do the conversion for me, but no luck.(L:CourseSet, degrees) (>L:CourseRadian, radian)Thanks,Glenn

Hi Glenn,I've never been able to figure out which conversions work for L:Vars and which don't.So I'll always use "number" and "bool" for my variables.And this:(L:CourseSet,number) 0.01745 * (>L:CourseRadian,number)will definitely work.It could also be the missing 0 before the decimal point.Rob

Hi,May be this works:(L:CourseSet,degrees) dgrd (>L:CourseRadian,radian)or use number:(L:CourseSet,number) dgrd (>L:CourseRadian,number)Hope it helps,Jan"Beatus Ille Procul Negotiis"

Jan

 

 

 

"Beatus ille qui procul negotiis..."

Hi,>>>(L:CourseSet, degrees) (>L:CourseRadian, radian)This won't work.Rather is a direct conversion, just change the unit:(L:CourseSet, radians)Tom

  • Commercial Member

This works:180 (>L:CourseSet, degrees)(L:CourseSet, radians) will equal 3.14 'ish'pi (>L:CourseSet, radians)(L:CourseSet, degrees) dnor will equal 180This will also work,180 (>L:CourseSet, enum)(L:CourseSet, enum) dgrd = 3.14pi (>L:CourseSet, enum)(L:CourseSet, enum) rddg = 180--Jon

Thanks, good answers. I went with adding a zero in front of the decimal. Apparently, XML does not recognize decimals unless they are surrounded by digits. I

Hi,Do you use or ?Jan"Beatus Ille Procul Negotiis"

Jan

 

 

 

"Beatus ille qui procul negotiis..."

I used . What I

Hi Glen,You could use this construction: (M:Event) 'LeftSingle' scmp ! if{ (G:Var1) ++ (>G:Var1) (G:Var1) 1 == if{ (P:ABSOLUTE TIME,seconds) (>G:Var2) } (P:ABSOLUTE TIME,seconds) (G:Var2) - 1 < if{ "code that increments your var by 1" } els{ "code that increments your var by 10" } } (M:Event) 'LeftRelease' scmp ! if{ 0 (>G:Var1) }So:Normally Var1 is 0.When the mouse is depressed and held, the 'LeftSingle' section is continuously executed.The first "click" (Var1 = 1) sets Var2 to current time.Keeping it depressed will continuously increment Var1, so Var2 is set only once ("start-time").So the first second the "incr by 1" code is executed.When the "current-time - start-time > 1 sec", the "incr by 10" code is executed.Releasing the mouse sets Var1 back to zero, to initialise it for a next "click-and-hold" event.This construction is never affected by "acceleration" problem you see in many gauges, and makes it very easy to use another "hold-time" than 1 sec. Just replace the "1" by another period.Cheers, Rob Barendregt

That solution looks good. I'll give it a try tomorrow. Thanks,Glenn

I tried the code. It works in this fashion: When I single-click the mouse, the cursor rotates in 10-degrees increments. When I keep the mouse button down, the cursor then rotates continously in 1-degree increments. But, upon releasing the button, the cursor jumps 10-degrees one final time before stopping.I think I

Hi Glenn,I'd appreciate if you could show me where my example is wrong :-)Because I can't explain the behaviour you describe ..Rob

Hi Rob,I took a glance to your code, just by curiosity :-)At first thought it has something to do with (P:Absolute time) being negative, but then realized it's ok...so I second your post.Regards,Tom

If you guys see nothing wrong, then I may have followed your instructions incorrectly although it looks okay to me. I can

Hi Glenn,Try to replace:(P:ABSOLUTE TIME,seconds) (G:Var2) - 1 " as ">") in an XML expression.Rob

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.