FSDeveloper Community

Go Back   FSDeveloper Community > Microsoft Flight Simulator development > Aircraft Design > Gauges

Gauges Use this forum for all your gauges related discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 04 May 2012, 08:08
Vylsain Vylsain is offline
  france
Join Date: Jan 2012
Posts: 47
[Solved] <CallbackCode> bug

Hello everyone.

I have a really strange bug in my MouseRect.

I wrote this code :

Code:
        <PartInfo>
        <Name>sna_prep</Name>
        <AnimLength>10</AnimLength>
        <Animation>
            <Parameter>
                <Code>(L:PrepPos, bool) 5 *</Code>
	        <Lag>50</Lag>
            </Parameter>   
        </Animation>
        <MouseRect>
            <Cursor>Hand</Cursor>
	    <TooltipText>Selection du but de preparation</TooltipText>			
	    <MouseFlags>LeftSingle+LeftRelease</MouseFlags>
            <CallbackCode>
            </CallbackCode>
        </MouseRect>
    </PartInfo>
It was working perfectly !

Ok, so I keep going and I write the code inside the CallbackCode :

Code:
(M:Event) 'LeftSingle' scmp 0 == 
	if{ 1 (>L:PrepPos, bool) }				
(M:Event) 'LeftRelease' scmp 0 == 
	if{ 0 (>L:PrepPos, bool) }
Dammit, the cursor disappears... Then I delete this part of the code and come back to the working one.

But, it's still doesn't work...
The code is exactly the same than before but it doesn't work anymore.

The funny part is that I have a dozen of such "sna_...", all identical and those I didn't modify still work.

So I have this one not working :

Code:
<PartInfo>
        <Name>sna_dest</Name>
        <AnimLength>10</AnimLength>
        <Animation>
            <Parameter>
                <Code>(L:DestPos, bool) 5 *</Code>
				<Lag>50</Lag>
            </Parameter>   
        </Animation>
        <MouseRect>
            <Cursor>Hand</Cursor>
			<TooltipText>Selection du but de destination</TooltipText>
			<MouseFlags>LeftSingle+LeftRelease</MouseFlags>
            <CallbackCode>
            </CallbackCode>
        </MouseRect>
    </PartInfo>
and this one working perfectly :

Code:
<PartInfo>
        <Name>sna_bad</Name>
        <AnimLength>10</AnimLength>
        <Animation>
            <Parameter>
                <Code>(L:BadPos, bool) 5 *</Code>
				<Lag>50</Lag>
            </Parameter>   
        </Animation>
        <MouseRect>
            <Cursor>Hand</Cursor>
			<TooltipText>But ADditionnel</TooltipText>
			<MouseFlags>LeftSingle+LeftRelease</MouseFlags>
            <CallbackCode>
            </CallbackCode>
        </MouseRect>
    </PartInfo>
It's exactly the same code with only the variable's name changing. I tried some XForm in GMax to check the clickable zone, tried to redo the animation and Mouserect procedures in GMax but no result...

I really don't understand how 2 identical codes are leading me to 2 different results...

Do you have an idea ?

Thanks

Edit : ": D" are replaced with in the code but I did not put any smileys in my XML code ^^

Last edited by Vylsain; 10 May 2012 at 05:53.
Reply With Quote
  #2  
Old 04 May 2012, 15:57
n4gix n4gix is offline
  unitedstates
Location: Hammond, Indiana
Join Date: Sep 2006
Posts: 8,522
Odd, that! I see nothing at all wrong with your XML script...

By the way, when posting XML or C code, use the # icon of the editor to wrap your snippet of script/code with the [code] tags!

Code:
  <PartInfo>
    <Name>sna_prep</Name>
    <AnimLength>10</AnimLength>
    <Animation>
      <Parameter>
        <Code>(L:PrepPos, bool) 5 *</Code>
        <Lag>50</Lag>
      </Parameter>
    </Animation>
    <MouseRect>
      <Cursor>Hand</Cursor>
      <TooltipText>Selection du but de preparation</TooltipText>
      <MouseFlags>LeftSingle+LeftRelease</MouseFlags>
      <CallbackCode>
        (M:Event) 'LeftSingle' scmp 0 ==
             if{ 1 (>LestPos, bool) }
        (M:Event) 'LeftRelease' scmp 0 ==
             if{ 0 (>LestPos, bool) }
      </CallbackCode>
    </MouseRect>
  </PartInfo>
__________________
Bill Leaming
3d Modeler Max/GMax
C & XML Gauge Programmer
Eaglesoft Development Group
http://eaglesoftdg.com

Intel® Core™ i7-3770k 4.2GHz - Crucial 16GB DDR3 - Dual Radeon HD770 1GB DDR5 (Crossfire) - Eco II Watercooling - Win7 64bit
Intel® Core™ i7-2600k 3.4GHz - Crucial 4GB DDR3 - NVIDIA GeForce GTX550Ti 1GB - Win7 64bit
Intel® Core™ i7-860 2.8GHz - Crucial 8GB DDR3 - NVIDIA GeForce GTS240 1GB - Win8 64bit
NOTE: Unless explicitly stated otherwise, everything written by my hand is MY opinion. I do NOT speak for any company, real or imagined...
Reply With Quote
  #3  
Old 04 May 2012, 17:15
taguilo taguilo is offline
  argentina
Location: San Isidro-BsAs
Join Date: Oct 2006
Posts: 612
I agree with Bill, nothing seems wrong at first sight.

I think that maybe you have an illegal character (hidden?) somewhere in the code that prevents it for being loaded into the MDL. If I were you I would make these test:

1) Check that the complete <Part> with trouble is actually stored inside the MDL , using an Hex editor.

2) If the problem exists in the Variable name, use another one on the same piece of code and see what happens.

Tom
Reply With Quote
  #4  
Old 06 May 2012, 18:02
Vylsain Vylsain is offline
  france
Join Date: Jan 2012
Posts: 47
Ok thanks, I'll check this on Wednesday.

n4gix : thx for the tip
Reply With Quote
  #5  
Old 09 May 2012, 01:55
Vylsain Vylsain is offline
  france
Join Date: Jan 2012
Posts: 47
I downloaded an Hex Editor and opened my mdl file but how do you know if the <Part> with trouble is stored inside the MDL ?

I found the text of the TooltipText but the rest is unreadable, made of unicode characters.

Quote:
If the problem exists in the Variable name, use another one on the same piece of code and see what happens.
Even if I delete all the variables of the section and leave only the tags it doesn't work. As I said, I have 2 identical PartInfo sections, one works and not the other one...

Thanks

Last edited by Vylsain; 09 May 2012 at 02:10.
Reply With Quote
  #6  
Old 09 May 2012, 02:59
Vylsain Vylsain is offline
  france
Join Date: Jan 2012
Posts: 47
Update : The problem may come from GMax since that if I apply this MouseRect to another knob it works.

The 3D knob would be the problem ? I tried to redo the AttachPointTool process, tried to apply an XForm but nothing works...

Edit : I tried with a 3rd button :
- it was working, showing the cursor and the text
- I wrote the XML code : working ok
- I make the link with the AnimationManager : doesn't work anymore

Last edited by Vylsain; 09 May 2012 at 03:39.
Reply With Quote
  #7  
Old 09 May 2012, 10:34
n4gix n4gix is offline
  unitedstates
Location: Hammond, Indiana
Join Date: Sep 2006
Posts: 8,522
Select the knob giving the problem, then open the Track View. Check the Animation/Scale entry. You must see X=100.0 Y=100.0 Z=100.0

If any one of the three are not 100.0 then you will need to add an X-Form Modifier, then Reset Scale, then collapse back to E-Poly or E-Mesh as desired.

Alternatively, build a new knob and make sure that if you need to scale it to final size that you do so only at one of the sub-levels (vertex, edges, faces, polys, element).
__________________
Bill Leaming
3d Modeler Max/GMax
C & XML Gauge Programmer
Eaglesoft Development Group
http://eaglesoftdg.com

Intel® Core™ i7-3770k 4.2GHz - Crucial 16GB DDR3 - Dual Radeon HD770 1GB DDR5 (Crossfire) - Eco II Watercooling - Win7 64bit
Intel® Core™ i7-2600k 3.4GHz - Crucial 4GB DDR3 - NVIDIA GeForce GTX550Ti 1GB - Win7 64bit
Intel® Core™ i7-860 2.8GHz - Crucial 8GB DDR3 - NVIDIA GeForce GTS240 1GB - Win8 64bit
NOTE: Unless explicitly stated otherwise, everything written by my hand is MY opinion. I do NOT speak for any company, real or imagined...
Reply With Quote
  #8  
Old 10 May 2012, 05:11
Vylsain Vylsain is offline
  france
Join Date: Jan 2012
Posts: 47
It works !! Thank you very much Bill

The XForm however change the scale when applied to a group of objects. Is there a way to scale a group of objects without changing their scale values or must we apply the XForm for each object and it might take a whole day ? ^^

For my 3D gauge, there's only one button that still doesn't work : do you see any error in the code ?

Code:
	<PartInfo>
        <Name>sna_rotbudbad</Name>
        <AnimLength>12</AnimLength>
        <Animation>
            <Parameter>
                <Code>(L:RotButBadPos, enum)</Code>
				<Lag>50</Lag>
            </Parameter>   
        </Animation>
        <MouseRect>
            <Cursor>Hand</Cursor>
			<TooltipText>Selecteur de parametre</TooltipText>
			<MouseFlags>LeftSingle+RightSingle+WheelUp+WheelDown</MouseFlags>
            <CallbackCode>
			(M:Event) 'LeftSingle' scmp 0 == (M:Event) 'WheelUp' scmp 0 == ||
				if{ (L:RotButBadPos, enum) 1 + (>L:RotButBadPos, enum) }			
			(M:Event) 'RightSingle' scmp 0 == (M:Event) 'WheelDown' scmp 0 == ||
				if{ (L:RotButBadPos, enum) 1 - (>L:RotButBadPos, enum) }
				
			(L:RotButBadPos, enum) 13 == 
				if{ 1 (>L:RotButBadPos, enum) } 
			(L:RotButBadPos, enum) -1 == 
				if{ 11 (>L:RotButBadPos, enum) }
            </CallbackCode>
        </MouseRect>
    </PartInfo>
I have many other questions on other subjects but I'll create a new topic.

Last edited by Vylsain; 10 May 2012 at 08:43.
Reply With Quote
  #9  
Old 10 May 2012, 11:17
n4gix n4gix is offline
  unitedstates
Location: Hammond, Indiana
Join Date: Sep 2006
Posts: 8,522
Although "logically" this should work, I've never been successful using this format:

Code:
(M:Event) 'LeftSingle' scmp 0 == (M:Event) 'WheelUp' scmp 0 == ||
     if{ do*something }
Instead, I've always broken them up into two separate mouse events:
Code:
(M:Event) 'LeftSingle' scmp 0 == 
     if{ do*something }

(M:Event) 'WheelUp' scmp 0 == 
     if{ do*something }
__________________
Bill Leaming
3d Modeler Max/GMax
C & XML Gauge Programmer
Eaglesoft Development Group
http://eaglesoftdg.com

Intel® Core™ i7-3770k 4.2GHz - Crucial 16GB DDR3 - Dual Radeon HD770 1GB DDR5 (Crossfire) - Eco II Watercooling - Win7 64bit
Intel® Core™ i7-2600k 3.4GHz - Crucial 4GB DDR3 - NVIDIA GeForce GTX550Ti 1GB - Win7 64bit
Intel® Core™ i7-860 2.8GHz - Crucial 8GB DDR3 - NVIDIA GeForce GTS240 1GB - Win8 64bit
NOTE: Unless explicitly stated otherwise, everything written by my hand is MY opinion. I do NOT speak for any company, real or imagined...
Reply With Quote
  #10  
Old 10 May 2012, 14:20
Vylsain Vylsain is offline
  france
Join Date: Jan 2012
Posts: 47
Ok I'll try this tomorrow.

Thank you !
Reply With Quote
  #11  
Old 11 May 2012, 01:58
Vylsain Vylsain is offline
  france
Join Date: Jan 2012
Posts: 47
No results

It's really hard to find the cause of this without any clue !

Is there a way to see how the variable is modified during the game ? Some kind of debugging tool ?
Reply With Quote
  #12  
Old 11 May 2012, 14:41
tgibson tgibson is online now
  us-california
Location: San Diego
Join Date: Sep 2006
Posts: 3,168
I set up a little gauge with a digital readout of the variable, or modify an existing digital gauge to temporarily display this variable instead. But there are special gauges out there to display the values of variables too.

Hope this helps,
__________________
Tom Gibson
CalClassic Propliners
http://www.calclassic.com
Reply With Quote
  #13  
Old 12 May 2012, 17:50
Vylsain Vylsain is offline
  france
Join Date: Jan 2012
Posts: 47
Ok I'll search for these gauges.

Thanks
Reply With Quote
  #14  
Old 14 May 2012, 09:37
Vylsain Vylsain is offline
  france
Join Date: Jan 2012
Posts: 47
Code:
<PartInfo>
       <Name>sna_rotbudbad</Name>
        <AnimLength>12</AnimLength>
        <Animation>
            <Parameter>
                <Code>(L:RotButBadPos, enum)</Code>
		<Lag>50</Lag>
            </Parameter>   
        </Animation>
        ...


So much time spent on this...

Thanks for your help, I managed to make a 2D debug gauge and noticed that my variable was working pefectly. I glanced at my modeldef another time and found this mistake...

Thank you for your help, problem solved !
Reply With Quote
  #15  
Old 14 May 2012, 10:45
Naruto-kun's Avatar
Naruto-kun Naruto-kun is offline
  southafrica
Join Date: Jun 2010
Posts: 393
Send a message via MSN to Naruto-kun
The joys of FSX programming where you so easily put the wrong letter or miss a bracket or in C++, a break.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:51.

Kirsch designed by Andrew & Austin


Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.