View Full Version : Something that APPAERS
impresora
4th June 2011, 13:12
Hello all programers, im sorry to be annoying, but i gotta ask something:
How to create a button that when i stop in a place appaer a BUTTON that should i have options etc.
Where do i put coordinates for appaer button and when i press button what to do?
(Example: BANK)
sinanju
4th June 2011, 13:48
I googled APPAERS and it came up with 'did you mean APPEARS?'.
Assuming that's what you actually mean then you can either set a button to appear at a node or at a X,Y location.
Then you need to bind a sub-routine to the button so that when clicked, it takes you to sub-routine.
The first thing your sub-routine should do is close the first button, then it.....
...what to do?
...does something else.
See HERE (http://www.youtube.com/watch?v=MRXOTwv5PKU) if you want to see some of the things you can do with opening and closing buttons.
impresora
4th June 2011, 14:05
Yes in some place i type !info and appaer a BUTTON, where do i put X, and Y coordinates?
hyntty
4th June 2011, 14:22
Yes in some place i type !info and appaer a BUTTON, where do i put X, and Y coordinates?
What exactly do you need the coordinates if you want to make something appear when typing something?
Look mate, here's a quick, very rough checklist you need to do. If you don't know how to do these things you need to get someone who does.
1) create a insim connection
2) bind the event of receiving a IS_MSO packet to a function that checks what has just been typed in chat.
3) Make a function that does whatever it is you want it to do.
4) ???
5) Profit!
impresora
4th June 2011, 14:31
Okey but in a place that i stop and appear TEXT or message. Only explainme that please
sinanju
4th June 2011, 14:34
I suppose it all depends on what insim program you use.
I use LFSLapper.
For instance, part of my code is
RegisterZoneAction( "SO1" , 143,378, 3 , SE_leavepits,SE_bluelights );
When you leave the SO1 pits at x,y of 143,378, then sub-routine SE_leavepits and sub-routine, SE_bluelights both start. These sub-routines show on my HUD display at top of screen.
Instead of something happing automatically, I could have easily made a sub-routine to open a button, and clicking on this button then does something.
For instance, if you get stuck in a sandtrap somewhere, I could have a button open. Button could say something like "Click to reset car to back of pack". And if button clicked, it then starts a sub-routine that puts you in the pits.
hyntty
4th June 2011, 14:48
Okey but in a place that i stop and appear TEXT or message. Only explainme that please
Path nodes are in the NLP packet. Coordinates are in the MCI packet. Bind receiving either of them to a function that will compare the node or coordinates to a set location.
I'm not sure what the best way to figure out if you are stationary or not. Perhaps if the coordinates between two updates do not change you can be considered stopped.
impresora
4th June 2011, 14:54
Im using open SOURCE cruise insim sir.
If you cold help me please? :S
impresora
6th June 2011, 07:49
Help please?
impresora
7th June 2011, 06:44
I have been created a button that i added ISB_CLICK and in server we can click them, now how do i put an action in this button?
MadCatX
7th June 2011, 11:17
When you create a button via InSim, you can assign a ClickID to it. When a button created by InSim is clicked, LFS sends a IS_BTC packet that contains a ClickID of the button that's been clicked. You can use that to create actions for buttons.
impresora
7th June 2011, 12:34
Okey its working :D Now how i add !engage command to the BUTTON?
Copy all the command?
(COMMAND:)
case "!chase":
if (StrMsg.Length == 1)
{
if (Connections[GetConnIdx(MSO.UCID)].IsOfficerORCadet != 0)
{
if (Connections[GetConnIdx(MSO.UCID)].ChaseCondition == 0)
{
ChaseInitiated = 1;
ChaserUCID = MSO.UCID;
}
if (Connections[GetConnIdx(MSO.UCID)].ChaseCondition == 4)
{
Connections[GetConnIdx(MSO.UCID)].ChaseCondition = 5;
BumpCondition = 1;
BumpUCID = MSO.UCID;
}
if (Connections[GetConnIdx(MSO.UCID)].ChaseCondition == 3)
{
Connections[GetConnIdx(MSO.UCID)].ChaseCondition = 4;
BumpCondition = 1;
BumpUCID = MSO.UCID;
}
if (Connections[GetConnIdx(MSO.UCID)].ChaseCondition == 2)
{
Connections[GetConnIdx(MSO.UCID)].ChaseCondition = 3;
BumpCondition = 1;
BumpUCID = MSO.UCID;
}
if (Connections[GetConnIdx(MSO.UCID)].ChaseCondition == 1)
{
Connections[GetConnIdx(MSO.UCID)].ChaseCondition = 2;
BumpCondition = 1;
BumpUCID = MSO.UCID;
}
}
else
{
InSim.Send_MTC_MessageToConnection("^1Not Authorised", MSO.UCID, 0);
}
}
else
{
InSim.Send_MTC_MessageToConnection("^6|^7 Invalid command. Please see ^2!help^7 for a command list", MSO.UCID, 0);
}
break;
MariusMM
7th June 2011, 14:50
Yes you could copy the whole command, but you'd of cause need to make some modifications to it since you will be using the BTC packet and not the MSO packet...
Connections[GetConnIdx(MSO.UCID)].IsOfficerORCadet
That for example needs to be something like
Connections[GetConnIdx(BTC.UCID)].IsOfficerORCadet
Also, you really should make some changes to that whole clock of code, such as making...
var user = Connections[GetConnIdx(BTC.UCID)]; in the top of your MSO class,
and then just do user.IsOfficerORCadet whenever you need it.
impresora
7th June 2011, 16:27
okey it is working man ;) now i could put all of commands in buttons eheh :D
Now i have more one question, is about locations when i stop somewhere and a button appear. How do i make that? (LAST QUESTION :P)
impresora
8th June 2011, 19:02
repply? ***
Dygear
8th June 2011, 19:36
Stop spamming the forum.
impresora
10th June 2011, 09:46
Im not spamming.
broken
10th June 2011, 19:49
Stop spamming the forum.
+1
Im not spamming.
Um, yes you are.
azasmith14
10th June 2011, 21:27
Okey but in a place that i stop and appear TEXT or message. Only explainme that please
Are you sure you're British?
MadCatX
10th June 2011, 21:41
Are you sure you're British?
Something I've been wondering about too:)
@impersora: What you want to do is NOT that hard. Think, experiment, use your brain, that's how you'll learn to write InSim apps. We really can't just dump some code here for you. It most likely won't work without substantial modifications anyway and Dygear once said it well, read broken's sig for the words that should be written in stone and displayed in every "Programming help" forum section.
impresora
13th June 2011, 13:02
I only need that to finish my insim :'(
MadCatX
14th June 2011, 16:53
Seriously, how hard is something like
Check car's positions
If position matches, tell InSim to create a button
Store the fact that you've created a button in your app
Check car's positions again
If the car leaves the "display" area tell InSim to remove the button
to figure out? We won't write it for you, we actually can't write it for you even if we wanted.
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.