The online racing simulator
Button Problems
(75 posts, started )
#1 - sun
Button Problems
Hi

I had a problem with one of my buttons. I connected to the server and it said: IS_BTN - invalid dimensions.

this is the code:

[SIZE=2][COLOR=#0000ff]
private[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]void[/COLOR][/SIZE][SIZE=2] NCN([/SIZE][SIZE=2][COLOR=#2b91af]Packets[/COLOR][/SIZE][SIZE=2].[/SIZE][SIZE=2][COLOR=#2b91af]IS_NCN[/COLOR][/SIZE][SIZE=2] NCN)
{
InSim.Send_BTN_CreateButton([/SIZE][SIZE=2][COLOR=#a31515]"^7Cash:"[/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#2b91af]Flags[/COLOR][/SIZE][SIZE=2].[/SIZE][SIZE=2][COLOR=#2b91af]ButtonStyles[/COLOR][/SIZE][SIZE=2].ISB_DARK, 0, 180, 20, 5, 2, NCN.UCID, 1, [/SIZE][SIZE=2][COLOR=#0000ff]false[/COLOR][/SIZE][SIZE=2]);
AddToConnectionsList(NCN); [/SIZE][SIZE=2][COLOR=#008000]// Adds new player to the Connections[] list (don't remove line!)
[/COLOR][/SIZE][SIZE=2][COLOR=#2b91af]Debug[/COLOR][/SIZE][SIZE=2].WriteLine(NCN.UCID.ToString() + [/SIZE][SIZE=2][COLOR=#a31515]" NCN"[/COLOR][/SIZE][SIZE=2]);
}

if Any one can help me, please post.

Thanks.
[/SIZE]
Quote from sun :Hi

I had a problem with one of my buttons. I connected to the server and it said: IS_BTN - invalid dimensions.

this is the code:

[SIZE=2][COLOR=#0000ff]private[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]void[/COLOR][/SIZE][SIZE=2] NCN([/SIZE][SIZE=2][COLOR=#2b91af]Packets[/COLOR][/SIZE][SIZE=2].[/SIZE][SIZE=2][COLOR=#2b91af]IS_NCN[/COLOR][/SIZE][SIZE=2] NCN)[/SIZE]
[SIZE=2]{[/SIZE]
[SIZE=2]InSim.Send_BTN_CreateButton([/SIZE][SIZE=2][COLOR=#a31515]"^7Cash:"[/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#2b91af]Flags[/COLOR][/SIZE][SIZE=2].[/SIZE][SIZE=2][COLOR=#2b91af]ButtonStyles[/COLOR][/SIZE][SIZE=2].ISB_DARK, 0, 180, 20, 5, 2, NCN.UCID, 1, [/SIZE][SIZE=2][COLOR=#0000ff]false[/COLOR][/SIZE][SIZE=2]);[/SIZE]
[SIZE=2]AddToConnectionsList(NCN); [/SIZE][SIZE=2][COLOR=#008000]// Adds new player to the Connections[] list (don't remove line!)[/COLOR][/SIZE]
[SIZE=2][COLOR=#2b91af]Debug[/COLOR][/SIZE][SIZE=2].WriteLine(NCN.UCID.ToString() + [/SIZE][SIZE=2][COLOR=#a31515]" NCN"[/COLOR][/SIZE][SIZE=2]);[/SIZE]
[SIZE=2]}[/SIZE]

if Any one can help me, please post.

Thanks.

Replace the 0 with something like 5 or 6 and see what happends.
-
(sun) DELETED by the_angry_angel
#3 - sun
Thanks Nova It works!
-
(sun) DELETED by the_angry_angel
-
(eimer_) DELETED by the_angry_angel
#4 - sun
Hi i have another problem.

i have my MCI packet at the bottom end line. E.G example.

Private void MCI(Packets.IS_MCI MCI)
{

InSim.Send_MST_Message("Speed " + MCI.Info[0].Speed);
}

after that i made a buttin in the Private void NCN packets.

and the button works but it doesnt say my speed.

Regards.

Owen.
Quote from sun :Hi i have another problem.

i have my MCI packet at the bottom end line. E.G example.

Private void MCI(Packets.IS_MCI MCI)
{

InSim.Send_MST_Message("Speed " + MCI.Info[0].Speed);
}

after that i made a buttin in the Private void NCN packets.

and the button works but it doesnt say my speed.

Regards.

Owen.

Because you are sending a message to LFS, not a button...and if nothing is coming up, you haven't enabled the MCI event...
#6 - sun
i've uncommented the MCI event
If you have uncommented thd MCI, then the server would be spamming your speed...or spamming a Speed: 0 message anyway...

Out of curiosity, why did you put the button in the NCN method?
-
(sun) DELETED by the_angry_angel
#8 - sun
i put the button in side the ncn packet because i thought you where supposed to make the button in there. do they have to be together for it to work ?
OK, the button is basically the same as a message to LFS. You can send it whenever and wherever you need to. But if you want to delete a button, you need to use its method...which I can't think of off the top of my head...ISP_BFN I think...
#10 - sun
Quote from dougie-lampkin :OK, the button is basically the same as a message to LFS. You can send it whenever and wherever you need to. But if you want to delete a button, you need to use its method...which I can't think of off the top of my head...ISP_BFN I think...

Actually i was asking that do i have to put the button inside the Private void MCI packet with the info:

InSim.Send_MST_Message("Speed " + MCI.Info[0].Speed);
7 posts up, I told you that MST_Message has nothing to do with buttons. The MST_Message is like typing chat in LFS. But now your sorta asking that question again...along with another question I answered 2 posts ago...you should at least have an intellectual guess at what you're programming, before asking how to do it...
#12 - sun
Well how come its not showing my speed ? i tried guessing and been thinking for 3 hours
If your code was

InSim.Send_MST_Message("Speed " + MCI.Info[0].Speed);

then your speed WOULD be showing (or, if your not connection 1, a message saying Speed 0). The only thing that I think of, is that you haven't enabled the MCI event. The code above could be called "debug code", as it could be used to test that the speed is reading correctly.

If nothing is coming up, then you haven't enabled the MCI event...
#14 - sun
when you say enable do you mean uncomment ?
Yes, remove the comments before the code that enables the MCI event.

[COLOR=Red]//[/COLOR]LFS_External.InSim.Events.MCI_Received += new LFS_External.InSim.Events.MCI_EventHandler(MCI);

-
(sun) DELETED by the_angry_angel
#16 - sun
actually it is uncommented and its still not showing. I dont get speed 0, or any thing like that at all.
#17 - sun
What ? remove all the comments accept the ones i'am using ?
Sun, Please stop double, triple posting. People will reply when they get chance..
Well then it isn't uncommented, simple as that...

If it was, either you would get an error for wrong code, or else it would spam a message...are you sure you've saved the code and compiled it properly? And that you're running the right exe?
#20 - sun
i got an error when i uncommented it at first then thats when i added the line 'Private void MCI (Packets.IS_MCI MCI)'.

and then i put the code in and i compiled it then no errors then i tested it in lfs and its not coming through my button.
It wouldn't be coming through the button, it would be spamming a message...
#22 - sun
Ok, like

speed = 0
speed = 5
speed = 20

wud it show that if oyur doing that speed ?
With the code you posted above, it would keep spamming "Speed 0", or else large numbers if you were driving...The speed isn't in MPH or KM/H, it's in LFS units (Or maybe they're real life units, IDK). I'll leave it to you to figure out the conversion...
-
(sun) DELETED by the_angry_angel
#24 - sun
Ok.

My friend tried running my insim and it worked and spamming a message, But when i run it it doesnt do nout. I probebley should of told you this a long time ago, but when i load my insim and i join my server if times out after about 10 or 20 seconds. Its all connected right and in the server CFG it says: 'InSim=29999' like it should.

i tried it with a diffrent piece of code and thats:

for (int i = 0; i < MCI.NumC; i++)
{

InSim.Send_MST_Message("Speed of player id " + MCI.Info[i].PLID + " is " + MCI.Info[i].Speed);

}

}

}

Thanks!

Regards

Owen.
Type into your dedi window /insim=29999 then run the insim program...

Button Problems
(75 posts, started )
FGED GREDG RDFGDR GSFDG