The online racing simulator
Coding help
(13 posts, started )
Coding help
So I have this open source insim , And I'm trying to learn a little , experiment with the codes , but the thing is the project is missing the file .csproj
And no matter what I do the insim remains the same after opening and editing some of the source files , like "form1.cs" and so on .
I tried with vs 2008 and vs 2010 but the same thing.
Is it because that csproj file missing ? I would appreciate some tips from a more experienced guy.
#2 - PoVo
Yes, you need to recompile the project to generate a new .EXE file. You need the missing project file to do that.

When you get the project file, open it then press F6 and it will recompile the code and generate a new .EXE file for you to use.
Seems like I can't do anything

Anyway thanks for your answer PoVo !


EDIT: Looks like a miracle , I double clicked by mistake while I was in that folder and it worked without giving the missing csproj error ,
I pressed F6 but it has some errors. At least I have something to kill time
One more question :P

How do I make a button close on click ?

InSim.Send_BTN_CreateButton("^1X", Flags.ButtonStyles.ISB_DARK | Flags.ButtonStyles.ISB_CLICK, 6, 6, 52, 90, 173, UniqueID, 2, false);

Maybe something like DeleteBTN(173, UniqueID); if its clicked?

I can't figure it out how , I saw something with ClickID, Do I have to set the button id first ?

And what does the "2" before false or true represents ?
#5 - PoVo
When you create a button you set a click id. When you receive an IS_BTC packet event, you check if the BTC->ClickID equals to the button id and then delete the button if it does.


<?php 
CreateButton
("TEXT", {clickid},...);

void btcEvent(IS_BTC btc)
{
     if (
btc.ClickId == {clickid})
     {
            
DeleteButton({clickid},...);
     }
}
?>

And then if you have many buttons, you use a switch block:


<?php 
CreateButton
("TEXT", {clickid},...);
CreateButton("TEXT", {clickid2},...);
CreateButton("TEXT", {clickid3},...);
CreateButton("TEXT", {clickid4},...);
CreateButton("TEXT", {clickid5},...);

void btcEvent(IS_BTC btc)
{
     switch (
btc.ClickId)
     {
            case {
clickid}:
                 
DeleteButton({clickid},...);
                 break;

            case {
clickid2}:
                 
DeleteButton({clickid2},...);
                 break;

            case {
clickid3}:
                 
DeleteButton({clickid3},...);
                 break;

            case {
clickid4}:
                 
DeleteButton({clickid4},...);
                 break;

            case {
clickid5}:
                 
DeleteButton({clickid5},...);
                 break;
     }
}
?>

Thanks for you quick reply , I figured it out by this

I added the button

<?php 
InSim
.Send_BTN_CreateButtonFlags.ButtonStyles.ISB_CLICK, , , , 200 MSO.UCID40false);

and 
in private void BTC_ButtonClicked(Packets.IS_BTC BTC)

 switch (
BTC.ClickID)
                {
                    
#region

                    
case 200:
                        
DeleteBTN(200BTC.UCID);
                        break;
                }
                        
#endregion
?>

But yours is better and easier , PoVo your the man !
wat

Since you know the clickID and UCID already, why not just say DeleteButton(ClickID, UCID) instead of making a useless case structure? I must be missing something here?
#8 - PoVo
Quote from hyntty :wat

Since you know the clickID and UCID already, why not just say DeleteButton(ClickID, UCID) instead of making a useless case structure? I must be missing something here?

He wants to delete when the button is clicked.
Quote from PoVo :He wants to delete when the button is clicked.

No i realized it now, presumably you want to do something else too besides deleting the button..
#10 - PoVo
Quote from hyntty :No i realized it now, presumably you want to do something else too besides deleting the button..

His button text is an X so I presume he wants to delete a number of buttons to close a window.
I won't start another topic , So ... I was wondering (again)

Is it possible to send a Msg when two cars hit each other ?

I saw that since 0.6b , car contact detection can be possible

something with setting ISF_ flag , But i wonder how it works , the insim.txt doesn't say that much
You have to pass ISF_CON as a flag in IS_ISI to receive car contact packets.
I'm still having a problem ...
The insim keeps crashing after a while and I see in the host display

ISP_BFN -Invalid ClickID ,Every time someone clicks the X of a panel to close it .

It closes correctly the panel correctly but I don't understand why I get that invalid click id ...

May be that the cause of crashing?

Coding help
(13 posts, started )
FGED GREDG RDFGDR GSFDG