![]() |
|
#1
|
||||
|
||||
![]()
Hi chaps,
figured I'd crash and burn on my first attempt. I'd like to mention the fact that I have virtually no experience with C# and am more or less learning this stuff via copy and paste ![]() ![]() Kodiak, I dropped your script from post#2 (trying to keep it simple) into one of my missions, pressed compile and was greeted with numerous error messages that I can't wrap my head around atm. It is the only script within the mission. ----------------------------------------------------------------------- c:\Users\Gromic\Documents\1C SoftClub\il-2 sturmovik cliffs of dover\missions\Multi\Dogfight\BOB\BOB1.cs(1,13): error CS1518: Klasse, Delegat, Enumeration, Schnittstelle oder Struktur erwartet. c:\Users\Gromic\Documents\1C SoftClub\il-2 sturmovik cliffs of dover\missions\Multi\Dogfight\BOB\BOB1.cs(1,67): error CS1001: Bezeichner erwartet c:\Users\Gromic\Documents\1C SoftClub\il-2 sturmovik cliffs of dover\missions\Multi\Dogfight\BOB\BOB1.cs(1,69): error CS1518: Klasse, Delegat, Enumeration, Schnittstelle oder Struktur erwartet. c:\Users\Gromic\Documents\1C SoftClub\il-2 sturmovik cliffs of dover\missions\Multi\Dogfight\BOB\BOB1.cs(14,44): error CS1518: Klasse, Delegat, Enumeration, Schnittstelle oder Struktur erwartet. c:\Users\Gromic\Documents\1C SoftClub\il-2 sturmovik cliffs of dover\missions\Multi\Dogfight\BOB\BOB1.cs(22,13): error CS1022: Typ- oder Namespacedefinition oder Dateiende erwartet. ----------------------------------------------------------------------- I figured that the initial script was in raw form so I ammended line 9 from: GamePlay.gpHUDLogCenter(null, msg, parms); to GamePlay.gpHUDLogCenter("en", "msg red", null ); Help! And let me be so kind as to say in advance, thank you for all that you, and others, have done with scripting. Especially with the lack of documentation from 1C. Cheers Gromic
__________________
I5-750 @ 3,8GHz / MSI P55-GD65 / MSI GTX570 Twin Frozr II / 4x2GB G.Skill 1600MHz / Corsair TX650 PSU / RAID 0 2x640GB WD Black W7 Pro x64 SP1 / MS FFB2 +Saitek X45 / Freetrack + NP Clip Pro + PS3 Eye / Samsung BX2450 24" HDMI LED |
#2
|
|||
|
|||
![]()
Seems you have set a wrong or missing Bracket. Can you show me your complete code please.
Deutsche Fehlermeldungen mir deucht ich hab nen Landsmann (oder Umgebung) vor mir ![]() GamePlay.gpHUDLogCenter("en", "msg red", null ); couldn't work gpHUDLogCenter needs in this case a array of players as first argument (or null - null meens send message to all) Added a example script Last edited by FG28_Kodiak; 10-12-2011 at 12:00 PM. |
#3
|
||||
|
||||
![]()
Moin Kodiak
![]() This is the code I was using. It's yours from post 2 of this thread. Code:
private void sendScreenMessageTo(int army, string msg, object[] parms) { if (army != -1) { //Singleplayer (for Testing) if (GamePlay.gpRemotePlayers() == null || GamePlay.gpRemotePlayers().Length <= 0) { if (GamePlay.gpPlayer() != null && GamePlay.gpPlayer().Army() == army) GamePlay.gpHUDLogCenter(null, msg, parms); } else // Multiplayer { List<Player> Players = new List<Player>(); foreach (Player p in GamePlay.gpRemotePlayers()) { if (p.Army() == army) Players.Add(p); } GamePlay.gpHUDLogCenter(Players.ToArray(), msg, parms); } } else GamePlay.gpHUDLogCenter(null, msg, parms); } private void sendChatMessageTo(int army, string msg, object[] parms) { if (army != -1) { //Singleplayer (for Testing) if (GamePlay.gpRemotePlayers() == null || GamePlay.gpRemotePlayers().Length <= 0) { if (GamePlay.gpPlayer() != null && GamePlay.gpPlayer().Army() == army) GamePlay.gpLogServer(null, msg, parms); } else // Multiplayer { List<Player> Players = new List<Player>(); foreach (Player p in GamePlay.gpRemotePlayers()) { if (p.Army() == army) Players.Add(p); } GamePlay.gpLogServer(Players.ToArray(), msg, parms); } } else GamePlay.gpLogServer(null, msg, parms); } P.S. Landsmann ist richtig. Dürfte vermutlich nicht mal so weit von dir sein da "Bayern" auch bei mir im Perso steht. Nähe Aschaffenburg. Schöne Grüße und danke für alles was du bisher für die Community getan hast!
__________________
I5-750 @ 3,8GHz / MSI P55-GD65 / MSI GTX570 Twin Frozr II / 4x2GB G.Skill 1600MHz / Corsair TX650 PSU / RAID 0 2x640GB WD Black W7 Pro x64 SP1 / MS FFB2 +Saitek X45 / Freetrack + NP Clip Pro + PS3 Eye / Samsung BX2450 24" HDMI LED |
#4
|
|||
|
|||
![]()
Ah ok now i know the error:
These lines you copy are useless, without using System; using System.Collections; using System.Collections.Generic; using maddox.game; using maddox.game.world; public class Mission : AMission { // place the code here } |
#5
|
||||
|
||||
![]()
Right, now I really look foolish. I'd forgotten to add the librarys.
We've got a chap in our squad that works with C# professionally and he sacrificed some time and helped me with a script, using the ones that you've so kindly donated as a basis to go on. He's come up with a script that works perfectly. We have it running on our dedicated server. Here's an excerpt from one of our sub-missions. Code:
using System.Collections.Generic; using maddox.game; using maddox.game.world; public class Mission : AMission { private const int All = -1; private const int Allies = 1; private const int Axis = 2; public override void OnPlaceEnter(Player player, AiActor actor, int placeIndex) { base.OnPlaceEnter(player, actor, placeIndex); SendScreenMessageTo(All, "Welcome Everyone"); SendScreenMessageTo(Axis, "Lucie-Anton: good hunting over the channel. Weather reports clear skys with mild cloudbase at 1500 meters."); SendScreenMessageTo(Allies, "Sector control reports 79 squadron on inbound leg to patrol SE Dover area. Over."); } private void SendScreenMessageTo(int army, string message) { if (army == All) { GamePlay.gpHUDLogCenter(message); } else { //Singleplayer (for Testing) if (GamePlay.gpRemotePlayers() == null || GamePlay.gpRemotePlayers().Length <= 0) { if (GamePlay.gpPlayer() != null && GamePlay.gpPlayer().Army() == army) { GamePlay.gpHUDLogCenter(message); } } else // Multiplayer { var playersInArmy = new List<Player>(); foreach (var player in GamePlay.gpRemotePlayers()) { if (player.Army() == army) { playersInArmy.Add(player); } } GamePlay.gpHUDLogCenter(playersInArmy.ToArray(), message); } } } private void SendChatMessageTo(int army, string message) { if (army == All) { GamePlay.gpLogServer(null, message, null); } else { //Singleplayer (for Testing) if (GamePlay.gpRemotePlayers() == null || GamePlay.gpRemotePlayers().Length <= 0) { if (GamePlay.gpPlayer() != null && GamePlay.gpPlayer().Army() == army) { GamePlay.gpLogServer(null, message, null); } } else // Multiplayer { var playersInArmy = new List<Player>(); foreach (var player in GamePlay.gpRemotePlayers()) { if (player.Army() == army) { playersInArmy.Add(player); } } GamePlay.gpLogServer(playersInArmy.ToArray(), message, null); } } } } Cheers Gromic
__________________
I5-750 @ 3,8GHz / MSI P55-GD65 / MSI GTX570 Twin Frozr II / 4x2GB G.Skill 1600MHz / Corsair TX650 PSU / RAID 0 2x640GB WD Black W7 Pro x64 SP1 / MS FFB2 +Saitek X45 / Freetrack + NP Clip Pro + PS3 Eye / Samsung BX2450 24" HDMI LED |
![]() |
|
|