Jump to content

Trouble with script in advanced waypoint command


Recommended Posts

Posted

Tried the whole afternoon but couldn't make it work. Basically I have a group having as an advanced waypoint action Perform Command and then Run script. So far all ok.

Trouble is because I am using clone then the group is basically cloning the code itself and if the new cloned group is called grpn ger 2 the script is obviously not working because the original group is called blue-grp.

Is there a way to get the group name in the advanced waypoint with a script? Something like local name = Group:getName() or something similar ?

[sIGPIC]OK[/sIGPIC]

Posted

Also, if someone can really confirm that schedule function is being cycled every x seconds because I have tried something like

 

mist.scheduleFunction(checkToSpawnAssets,{},timer.getAbsTime() + 60, 3600);

 

and added a message inside function checkToSpawnAssets but the message is shown only once. I know, I wrote getAbsTime but the same result occurs when I use getTime.

[sIGPIC]OK[/sIGPIC]

Posted

You can get the group object which you can use to grab the group name from.

 

local group = ...
local groupName = group:getName()

 

Literally the ... means 'self'. It only works with a script attached to a waypoint and it returns the group object. Which is the same as local group = Group.getByName()

 

Your scheduleFunction will run 60 seconds after it is called and will repeat every hour on the dot.

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Posted

Thank you for answer Grimes. It looks like I misunderstood the last parameter on the schedule function. So, basically if I add instead of 3600 say 60 then the same function will be repeated every minute, correct?

 

Now, for the group. I had no clue that I can call the selected group like that. Thanks a bunch, you saved me a lot of time :)

[sIGPIC]OK[/sIGPIC]

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...