Author Topic: Creating Markers/Deleting them after  (Read 1900 times)

0 Members and 1 Guest are viewing this topic.

serfma

  • Intentional Cheater
  • **
  • Posts: 28
    • View Profile
Creating Markers/Deleting them after
« on: June 09, 2012, 02:47:45 am »
So, i've been using these codes to place markers on the map to view Player Locations/Vehicle Locations. However, once I run both scripts, markers tend to blink rapidly and it's hard to read them. How would I go about making a very simple script (Which i'm trying to learn, I know you guys don't like to spoon feed people here) to delete all markers? It sounds simple, but i've not a clue. ;) OR, How would I go about having both sets of markers on the map at once without interference?


Player Locs
Code: [Select]
hint "Adding Player Markers";

unitList = allUnits;
j = count unitList;
i = 0;
markPos = true;

while {markPos} do
{
unitList = allUnits;
j = count unitList;
i = 0;

for "i" from 0 to j do
{
unit = unitList select i;
pos = position unit;
deleteMarkerLocal ("playerMarker"+ (str i));
marker = "playerMarker" + (str i);
marker = createMarkerLocal [marker,pos];
marker setMarkerTypeLocal "mil_dot";
marker setMarkerPosLocal (pos);
marker setMarkerColorLocal("ColorGreen");
marker setMarkerTextLocal format ["%1",name unit];
};
sleep 0;
};
hint "Player Marking Stopping";

Vehicle Locs
Code: [Select]
hint "Adding Vehicle Markers";

unitList = allMissionObjects "LandVehicle"; // or unitList = nearestobjects [[8000,8000],["air","car","tank"],20000]; //or  unitList = allmissionobjects "LandVehicle" + allmissionobjects "Air";
j = count unitList;
i = 0;
markPos = true;

while {markPos} do
{
unitList = allMissionObjects "LandVehicle";
j = count unitList;
i = 0;

for "i" from 0 to j do
{
unit = unitList select i;
                        _name = configName (configFile >> "CfgVehicles" >> (typeof unit)); // or _name = gettext (configFile >> "CfgVehicles" >> (typeof unit) >> "displayName");
pos = position unit;
deleteMarkerLocal ("playerMarker"+ (str i));
marker = "playerMarker" + (str i);
marker = createMarkerLocal [marker,pos];
marker setMarkerTypeLocal "mil_dot";
marker setMarkerPosLocal (pos);
marker setMarkerColorLocal("ColorGreen");
marker setMarkerTextLocal format ["%1",_name];
};
sleep 0.5;
};
hint "Vehicle Marking Stopping";

(Credits to whoever created these Scripts ;) )

joopig

  • Insane Joker
  • ****
  • Posts: 602
    • View Profile
    • A Place Of Dreams
Re: Creating Markers/Deleting them after
« Reply #1 on: June 09, 2012, 02:52:17 am »
So, i've been using these codes to place markers on the map to view Player Locations/Vehicle Locations. However, once I run both scripts, markers tend to blink rapidly and it's hard to read them. How would I go about making a very simple script (Which i'm trying to learn, I know you guys don't like to spoon feed people here) to delete all markers? It sounds simple, but i've not a clue. ;) OR, How would I go about having both sets of markers on the map at once without interference?
Looks like the one i made, change the sleep time to 0.5 for players and 5 for vehicles not sure why it was changed to sleep 0....... :icon_rolleyes2

joopig

  • Insane Joker
  • ****
  • Posts: 602
    • View Profile
    • A Place Of Dreams
Re: Creating Markers/Deleting them after
« Reply #2 on: June 09, 2012, 02:59:55 am »
Here you go, maybe detected by script detection so try to bypass that and you are home free, easier than you might think as well. :icon_thumbsup

Player markers

Code: [Select]
execVM "YourFolder\vehicleMarkers.sqf";
hint "Adding Player Markers";

unitList = allUnits;
j = count unitList;
i = 0;
markPos = true;

while {markPos} do
{
unitList = allUnits;
j = count unitList;
i = 0;

for "i" from 0 to j do
{
unit = unitList select i;
pos = position unit;
deleteMarkerLocal ("playerMarker"+ (str i));
marker = "playerMarker" + (str i);
marker = createMarkerLocal [marker,pos];
marker setMarkerTypeLocal "mil_dot";
marker setMarkerPosLocal (pos);
marker setMarkerColorLocal("ColorRed");
marker setMarkerTextLocal format ["%1",name unit];
};
sleep 0.5;
};
hint "Player Marking Stopping";

i = 0;
for "i" from 0 to j do
{
veh = unitList select i;
deleteMarkerLocal ("playerMarker"+ (str i));
};


Vehicle Markers

Code: [Select]
hint "Adding Vehicle Markers";

vehicleList = vehicles;
j = count vehicleList;
i = 0;
markPosVeh = true;

while {markPosVeh} do
{
vehicleList = vehicles;
j = count vehicleList;
i = 0;

for "i" from 0 to j do
{
veh = vehicleList select i;

deleteMarkerLocal ("VehMarker"+ (str i));
marker2 = "VehMarker" + (str i);
marker2 = createMarkerLocal [marker2,getPos veh];
marker2 setMarkerTypeLocal "mil_dot";
marker2 setMarkerPosLocal (getPos veh);
marker2 setMarkerColorLocal("ColorGreen");
marker2 setMarkerTextLocal format ["%1",typeOf veh];
};
sleep 20;
};
hint "Vehicle Markings Stopping";
i = 0;
for "i" from 0 to j do
{
veh = vehicleList select i;
deleteMarkerLocal ("VehMarker"+ (str i));
};
« Last Edit: June 09, 2012, 04:48:04 am by joopig »

serfma

  • Intentional Cheater
  • **
  • Posts: 28
    • View Profile
Re: Creating Markers/Deleting them after
« Reply #3 on: June 09, 2012, 03:13:06 am »
Hmm, if I may ask, what does "sleep" do with these markers? I know for things such as the weapon crates, they "despawn" after X amount of seconds with sleep, but it seems as if after X amount of seconds they switch on then off rather quickly? Player locations are solid and no longer blinking. :)

joopig

  • Insane Joker
  • ****
  • Posts: 602
    • View Profile
    • A Place Of Dreams
Re: Creating Markers/Deleting them after
« Reply #4 on: June 09, 2012, 03:15:48 am »
Hmm, if I may ask, what does "sleep" do with these markers? I know for things such as the weapon crates, they "despawn" after X amount of seconds with sleep, but it seems as if after X amount of seconds they switch on then off rather quickly? Player locations are solid and no longer blinking. :)
The code you had before was removing and then creating the markers constantly, so you could clearly see this, whereas if you put a sleep delay between this its doing it fast enough for the markers to be updated but slow enough for them to remain solid. :icon_magician

serfma

  • Intentional Cheater
  • **
  • Posts: 28
    • View Profile
Re: Creating Markers/Deleting them after
« Reply #5 on: June 09, 2012, 04:41:01 am »
Hmm, vehicle locations are no longer showing. Unless this server has 0 vehicles. But if we were to find one and it didn't display, what would I go about doing to fix this? Last night it was working 100% fine besides the flickering. :P

EDIT: Nevermind, just the server was bugged after it crashed/restarted. 0 vehicles spawned. :/
« Last Edit: June 09, 2012, 05:58:13 am by serfma »

pjez102

  • Cheater Apprentice
  • *
  • Posts: 11
    • View Profile
Re: Creating Markers/Deleting them after
« Reply #6 on: June 09, 2012, 07:31:55 pm »
Code: [Select]
       unitList2 = allmissionobjects "LandVehicle" + allmissionobjects "Air";
unitList = allUnits;
        k = count unitList;
        h = 0;
        j = count unitList2;
i = 0;
markPos = true;

while {markPos} do
{
unitList2 = allmissionobjects "LandVehicle" + allmissionobjects "Air";
j = count unitList2;
i = 0;

for "i" from 0 to j do
{
unit = unitList2 select i;
                        _name = gettext (configFile >> "CfgVehicles" >> (typeof unit) >> "displayName");
pos = position unit;
deleteMarkerLocal ("vehicleMarker"+ (str i));
marker = "vehicleMarker" + (str i);
marker = createMarkerLocal [marker,pos];
marker setMarkerTypeLocal "mil_dot";
marker setMarkerPosLocal (pos);
marker setMarkerColorLocal("ColorBlue");
marker setMarkerTextLocal format ["%1",_name];
};
sleep 2;

        unitList = allUnits;
k = count unitList;
h = 0;

               for "h" from 0 to k do
{
unit = unitList select h;
pos = position unit;
deleteMarkerLocal ("playerMarker"+ (str h));
marker = "playerMarker" + (str h);
marker = createMarkerLocal [marker,pos];
marker setMarkerTypeLocal "mil_dot";
marker setMarkerPosLocal (pos);
marker setMarkerColorLocal("ColorRed");
marker setMarkerTextLocal format ["%1",name unit,_name];
};



sleep 2;
};
hint "Markers Added";

in scripting i'm not strong...
credits on "markers" joopig i guess.. i just edit and make 2in1 veh and players
p/s I do not know correct or not this code.. but it works :D
« Last Edit: June 09, 2012, 07:38:39 pm by pjez102 »

DanDiDo

  • Cheater Apprentice
  • *
  • Posts: 19
    • View Profile
Re: Creating Markers/Deleting them after
« Reply #7 on: June 09, 2012, 09:31:48 pm »
Hey Guys!
I just wrote my own script, but it doesnt do anything.
Can someone help me solving this problem?
I'm still learning this stuff and I dont get what I did wrong.
Code: [Select]
unitList = allMissionObjects "LandVehicle" + allMissionObject "Air";
unitList2 = allUnits;
a = count unitList;
b = count unitList2;
c = 0;
d = 0;

while {true} do
{
unitList = allMissionObjects "LandVehicle" + allMissionObjects "Air";
a = count unitList;
c = 0;

for "c" from 0 to a do
{
unit = unitList select c
_name = (configFile >> "ConfigVehicles" >> (typeof unit) >> "displayName");
marker = ("vehicleMarker"+ (str i));
marker createMarkerLocal [marker, pos];
marker setMarkerTypeLocal "mil_dot";
marker setMarkerPosLocal (pos);
marker setMarkerColorLocal ("ColorBlue");
marker setMarkerTextLocal format ["%1", _name];

};
sleep ;

unitList2 = allUnits;
b = count UnitList2;
d = 0;

for d from 0 to b do
{
unit = unitList select d;
pos = position unit;
deleteMarkerLocal ("playerMarker"+ (str d));
marker = "playerMarker" + (str d);
marker = createMarkerLocal [marker, pos];
marker setMarkerTypeLocal "mil_dot";
marker setMarkerPosLocal (pos);
marker setMarkerColorLocal ("ColorRed");
marker setMarkerTextLocal format ["%1", name unit, _name];
};
sleep 1;
};
hint "derp";



plosky1

  • Intentional Cheater
  • **
  • Posts: 33
    • View Profile
Re: Creating Markers/Deleting them after
« Reply #8 on: June 09, 2012, 09:42:43 pm »
Hey Guys!
I just wrote my own script, but it doesnt do anything.
Can someone help me solving this problem?
I'm still learning this stuff and I dont get what I did wrong.
Code: [Select]
unitList = allMissionObjects "LandVehicle" + allMissionObject "Air";
unitList2 = allUnits;
a = count unitList;
b = count unitList2;
c = 0;
d = 0;

while {true} do
{
unitList = allMissionObjects "LandVehicle" + allMissionObjects "Air";
a = count unitList;
c = 0;

for "c" from 0 to a do
{
unit = unitList select c
_name = (configFile >> "ConfigVehicles" >> (typeof unit) >> "displayName");
marker = ("vehicleMarker"+ (str i));
marker createMarkerLocal [marker, pos];
marker setMarkerTypeLocal "mil_dot";
marker setMarkerPosLocal (pos);
marker setMarkerColorLocal ("ColorBlue");
marker setMarkerTextLocal format ["%1", _name];

};
sleep ;

unitList2 = allUnits;
b = count UnitList2;
d = 0;

for d from 0 to b do
{
unit = unitList select d;
pos = position unit;
deleteMarkerLocal ("playerMarker"+ (str d));
marker = "playerMarker" + (str d);
marker = createMarkerLocal [marker, pos];
marker setMarkerTypeLocal "mil_dot";
marker setMarkerPosLocal (pos);
marker setMarkerColorLocal ("ColorRed");
marker setMarkerTextLocal format ["%1", name unit, _name];
};
sleep 1;
};
hint "derp";




Well first the code for _name isn't correct. Google some examples and you'll see how to do it. Also for your first unit list you have a sleep command, but you don't say how long for it to sleep for?

DanDiDo

  • Cheater Apprentice
  • *
  • Posts: 19
    • View Profile
Re: Creating Markers/Deleting them after
« Reply #9 on: June 09, 2012, 09:48:41 pm »
Thanks plosky!
Found another mistake, I accidentally put the variable "i" instead of "c".

edit:
Still not working. Gotta spend a couple of hours figuring out what I did wrong, lol
« Last Edit: June 09, 2012, 10:03:09 pm by DanDiDo »

MrMedic

  • MasstKer
  • ********
  • Posts: 8900
  • programmer/dev/software engineer
    • View Profile
Re: Creating Markers/Deleting them after
« Reply #10 on: June 09, 2012, 11:40:23 pm »
Hey Guys!
I just wrote my own script, but it doesnt do anything.
Can someone help me solving this problem?
I'm still learning this stuff and I dont get what I did wrong.
Code: [Select]
unitList = allMissionObjects "LandVehicle" + allMissionObject "Air";
unitList2 = allUnits;
a = count unitList;
b = count unitList2;
c = 0;
d = 0;

while {true} do
{
unitList = allMissionObjects "LandVehicle" + allMissionObjects "Air";
a = count unitList;
c = 0;

for "c" from 0 to a do
{
unit = unitList select c
_name = (configFile >> "ConfigVehicles" >> (typeof unit) >> "displayName");
marker = ("vehicleMarker"+ (str i));
marker createMarkerLocal [marker, pos];
marker setMarkerTypeLocal "mil_dot";
marker setMarkerPosLocal (pos);
marker setMarkerColorLocal ("ColorBlue");
marker setMarkerTextLocal format ["%1", _name];

};
sleep ;

unitList2 = allUnits;
b = count UnitList2;
d = 0;

for d from 0 to b do
{
unit = unitList select d;
pos = position unit;
deleteMarkerLocal ("playerMarker"+ (str d));
marker = "playerMarker" + (str d);
marker = createMarkerLocal [marker, pos];
marker setMarkerTypeLocal "mil_dot";
marker setMarkerPosLocal (pos);
marker setMarkerColorLocal ("ColorRed");
marker setMarkerTextLocal format ["%1", name unit, _name];
};
sleep 1;
};
hint "derp";




Thanks plosky!
Found another mistake, I accidentally put the variable "i" instead of "c".

edit:
Still not working. Gotta spend a couple of hours figuring out what I did wrong, lol

hmm , wonder if its anything to do with counting sheep WWII style.. :smile
EnCoded Message: i3iy9yl8kr2xf3g2Txs3pr6ye3ya7jg5ty2z

https://www.youtube.com/watch?v=62_7-AYfdkQ
you need a paypal account for the private versions.

Website:
http://bit.ly/medic101

Teamspeak 3: 85.236.101.5:10157

Buster

  • Klass Klown
  • ***
  • Posts: 295
  • Kool Kat
    • View Profile
Re: Creating Markers/Deleting them after
« Reply #11 on: June 09, 2012, 11:56:49 pm »
Hey Guys!
I just wrote my own script, but it doesnt do anything.
Just wait while I pick myself up off the floor  :icon_laugh
Can't stop laughing ffs  :icon_laugh

DanDiDo

  • Cheater Apprentice
  • *
  • Posts: 19
    • View Profile
Re: Creating Markers/Deleting them after
« Reply #12 on: June 10, 2012, 12:46:30 am »
Hey Guys!
I just wrote my own script, but it doesnt do anything.
Just wait while I pick myself up off the floor  :icon_laugh
Can't stop laughing ffs  :icon_laugh

Well, thats motivating :D
Glad you liked that, lol :P

pjez102

  • Cheater Apprentice
  • *
  • Posts: 11
    • View Profile
Re: Creating Markers/Deleting them after
« Reply #13 on: June 10, 2012, 12:47:36 am »
Hey Guys!
I just wrote my own script, but it doesnt do anything.
hahah
look Reply #6 and #1 and #2
fail
« Last Edit: June 10, 2012, 01:04:59 am by pjez102 »

DanDiDo

  • Cheater Apprentice
  • *
  • Posts: 19
    • View Profile
Re: Creating Markers/Deleting them after
« Reply #14 on: June 10, 2012, 12:58:31 am »

hmm , wonder if its anything to do with counting sheep WWII style.. :smile

Hmm... gotta try to combine both for-loops...
I'm off trying that out :smile