![]() |
|
#1
|
|||
|
|||
![]()
I was wondering if I changed this script right:
using System; using maddox.game; using maddox.game.world; using System.Collections.Generic; public class Mission : AMission { public override void OnTickGame() { if (Time.tickCounter() % 108000 == 18000) // 108000 = 60 min repeat. 18000 = 10 min delay. { GamePlay.gpPostMissionLoad("missions/channelv6/BM1/Practice.mis"); GamePlay.gpHUDLogCenter("The Battle of Britain is about to begin"); double initTime = 0.0; Timeout(initTime += 600, () => { GamePlay.gpHUDLogCenter("Intell German Bomber Raids Heading For Hawkinge"); }); } if (Time.tickCounter() % 108000 == 54000) // 108000 = 60 min repeat, 54000 = 30 min delay. { GamePlay.gpPostMissionLoad("missions/channelv6/BM1/Practice1.mis"); GamePlay.gpHUDLogCenter("Intell German Bomber Raids Heading For Lympne"); } if (Time.tickCounter() % 108000 == 90000) // 60 min repeat, 50 min delay { GamePlay.gpPostMissionLoad("missions/channelv6/BM1/Practice2.mis"); GamePlay.gpHUDLogCenter("Intell German Bomber Raids Heading For Manston/Ramsgate"); }); } } |
#2
|
|||
|
|||
![]() Code:
using System; using maddox.game; using maddox.game.world; using System.Collections.Generic; public class Mission : AMission { double initTime = 0.0; public override void OnTickGame() { if (Time.tickCounter() % 108000 == 18000) // 108000 = 60 min repeat. 18000 = 10 min delay. { GamePlay.gpPostMissionLoad("missions/channelv6/BM1/Practice.mis"); GamePlay.gpHUDLogCenter("The Battle of Britain is about to begin"); Timeout(initTime += 600, () => { GamePlay.gpHUDLogCenter("Intell German Bomber Raids Heading For Hawkinge"); }); } if (Time.tickCounter() % 108000 == 54000) // 108000 = 60 min repeat, 54000 = 30 min delay. { GamePlay.gpPostMissionLoad("missions/channelv6/BM1/Practice1.mis"); GamePlay.gpHUDLogCenter("Intell German Bomber Raids Heading For Lympne"); } if (Time.tickCounter() % 108000 == 90000) // 60 min repeat, 50 min delay { GamePlay.gpPostMissionLoad("missions/channelv6/BM1/Practice2.mis"); GamePlay.gpHUDLogCenter("Intell German Bomber Raids Heading For Manston/Ramsgate"); } } } double initTime = 0.0; Timeout(initTime += 600, () => made not much sense in OnTickGame. Every time the if clause is true initTime is reset to 0, and the message is send after 600 seconds. initTime +=600 means initTime = initTime + 600; if you like to send a message 600sec a mission is loaded you can use "Timeout(600, () =>" only if you like to send a message 600sec a mission is loaded and then after the second time 1200sec then 1800sec you should place the double initTime = 0.0; outside to make it global in the class. btw this makes more sense: double initTime = 0.0; Timeout(initTime, () => { GamePlay.gpHUDLogCenter("Attention Reds"); }); Timeout(initTime += 5, () => { GamePlay.gpHUDLogCenter("Intell German Bomber Raids Heading For Hawkinge"); }); Timeout(initTime += 5, () => { GamePlay.gpHUDLogCenter("Intercept them"); }); the first message is send directly the second 5 second later and the third 10 seconds, this is nessesary if you try for example these GamePlay.gpHUDLogCenter("Attention Reds"); GamePlay.gpHUDLogCenter("Intell German Bomber Raids Heading For Hawkinge"); GamePlay.gpHUDLogCenter("Intercept them"); only the last message "Intercept them" is shown. and there was a GamePlay.gpHUDLogCenter("Intell German Bomber Raids Heading For Manston/Ramsgate"); }); <======= this is an error } Last edited by FG28_Kodiak; 01-12-2012 at 02:01 PM. |
#3
|
|||
|
|||
![]()
using System;
using maddox.game; using maddox.game.world; using System.Collections.Generic; public class Mission : AMission { public override void OnTickGame() { if (Time.tickCounter() % 108000 == 18000) // 108000 = 60 min repeat. 18000 = 10 min delay. { GamePlay.gpPostMissionLoad("missions/channelv6/BM1/Practice.mis"); GamePlay.gpHUDLogCenter("The Battle of Britain is about to begin"); double initTime = 0.0; Timeout(initTime, () => { GamePlay.gpHUDLogCenter("Attention Airbases"); }); Timeout(initTime += 5, () => { GamePlay.gpHUDLogCenter("Intell German Bomber Raids Heading For Hawkinge"); }); Timeout(initTime += 5, () => { GamePlay.gpHUDLogCenter("Intercept them"); }); } if (Time.tickCounter() % 108000 == 54000) // 108000 = 60 min repeat, 54000 = 30 min delay. { GamePlay.gpPostMissionLoad("missions/channelv6/BM1/Practice1.mis"); GamePlay.gpHUDLogCenter("Intell German Bomber Raids Heading For Lympne"); } if (Time.tickCounter() % 108000 == 90000) // 60 min repeat, 50 min delay { GamePlay.gpPostMissionLoad("missions/channelv6/BM1/Practice2.mis"); GamePlay.gpHUDLogCenter("Intell German Bomber Raids Heading For Manston/Ramsgate"); }); } } |
#4
|
|||
|
|||
![]()
Yes but
GamePlay.gpHUDLogCenter("Intell German Bomber Raids Heading For Manston/Ramsgate"); }); <====== error delete the needless }); at the end of your script, its an error |
#5
|
|||
|
|||
![]()
Thanks.
|
#6
|
|||
|
|||
![]()
If I may interject some simple additions, I have some Basic experience from programming data loggers, but relatively new user to C# scripting myself however some rules apply to all programming all scripters should consider always to keep track of things.
Number 1 Document. You should always date the lastest mods(keen programmers will even document mod changes in separate txt file) For this sort of stuff, probably not essential, but do put a "Last Mod date" at the top of your script, maybe with any specific operational notes ie //Last update 12/01/2012 If you work with 2 or 3 others and pass the mis set about it is easy to get versions mixed up, a last mod date will help keep this error low. Documentation of what the programe does helps, and helps development aswell. 2nd major consideration is repeat programming. It can be far more effective to lower syntax errors by using commonly used components once and pull that item into code elsewhere by it's name. For example the file path for missions. if you do this at the start of the script, string MissionPath = "missions/channelv6/BM1/"; When you call missions you only have to add the mis name from this GamePlay.gpPostMissionLoad("missions/channelv6/BM1/Practice2.mis"); to this GamePlay.gpPostMissionLoad(MissionPath + "Practice2.mis"); The advantage is 2 fold, one, if you alter the folder naming you only have to do it once and two(more importantly) you are less likely to make simple syntax errors when adding multi missions to a larger script. |
![]() |
|
|