Fulqrum Publishing Home   |   Register   |   Today Posts   |   Members   |   UserCP   |   Calendar   |   Search   |   FAQ

Go Back   Official Fulqrum Publishing forum > Fulqrum Publishing > IL-2 Sturmovik: Cliffs of Dover > FMB, Mission & Campaign builder Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 01-10-2012, 07:31 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default [Tutorial] Simple Scripting Lessons - Preparations

After looking into the posibilities of using triggers on Cliffs of Dover without scripting (http://forum.1cpublishing.eu/showthread.php?t=28454) , in this lesson we will make some preperations to make scripting easier for us.

When scripting in Cliffs of Dover, we will be using C# (C Sharp) (http://en.wikipedia.org/wiki/C_Sharp...mming_language). This has some advantages, but also some disadvantages. The advantages are that one doesn't have to learn a programming language which was specificaly designed for CloDo. There are enough books and pages on the internet which can be helpful in learning the language. Also, one can use all the posibilieties of .Net. The disadvantages are that especially beginners (I just wanted a victory message!) can be shocked by the posibilites of scripting. The commands are cryptical in part, and that the language is object-oriented doesn't make it easier. Although, beginners will probably have the most problems with missing semicolons or wrongly placed brackets.

Because of this, at first, we will have a look at the Editor which is integrated into Cliffs of Dover. Sadly, it neither supports syntax highlighting nor aumotatic intenting. Basicly, it offers less than Windows Notepad.


Although, one can open a menu by right clicking which can compile the code. This can be useful when searching for mistakes. As an example, in this code a semicolon was forgoten, and then the code was compiled:


As expected, the output window shows us an error message:


Now we correct the missing semicolon and try it again:


Now everything seems to be all right:


After saving, the CloDo editor automaticaly creates a file with the ending "cs". Script files in Cliffs of Dover have to have the same name as the mission file, but with the ending "cs" instead of "mis".


As one can see, Cliffs of Dover doesn't offer to much help with scripting. Because of this, one should look for alternatives to the integrated editor. There are two posibilites: One can use an extended editor, like the freeware Notepad++ http://notepad-plus-plus.org/. It offers syntax highlighting and automated intenting, at least.


Or one gets a professional developing environment. In this case we are lucky, as Microsoft offers one free of charge (registration is requiered though), namely Microsoft Visual C# Express
http://www.microsoft.com/visualstudi...csharp-express

Especially for beginners, I would recommend downloading and installing this package, because the editor offers a lot of funtions which make programming a lot easier. Syntax errors are shown directly in the editor by a red marking, for example.


After downloading and installing Microsoft Visual C# Express, we start a new project.


In the window which now pops up, we choose "Class Library" and enter a fiting name for our "project", as we will loose track at "ClassLibrary10", at the latest. Now we click OK.


Express now creates all necessary files and opens the editor. The code lines which are already in there can be deleted, as we don't need them.


We simply replace them with the standard framework (more of that in the next lesson), which is needed to script a mission.


After adding it, the Express editor already shows us the first errors. "The type or Namespace ...". This means, that the developing environment doesn't know the used assemblies (http://en.wikipedia.org/wiki/.NET_assembly). To change that, we select "References" in the Solution Explorer (orange arrow) and click it with the right mouse button.


Now we click "Add References"


In the dialogue box we choose "Browse" and navigate to the folder ..\Steam\SteamApps\common\il-2 sturmovik cliffs of dover\parts\core and highlight the files "antlr.runtime.dll", "core.dll", "gamePages.dll", "gamePlay.dll", "gameWorld.dll", "HostView.dll", "maddox.dll", "part.dll", "sound.dll" and "Strategy.dll"


and in the folder ..\Steam\SteamApps\common\il-2 sturmovik cliffs of dover\parts\bob the files "partBob.dll" and "Campaign.dll". We don't need all of them, but it doesn't hurt to add them to the project so we don't have to look for them later, if we might need them.


To call up another useful tool of the Express Editor, namely the Object-Explorer, we switch the Editor into expert mode.


Now we activate the Object-Browser (and yes, a simple "CTRL+W, J would have done the job, too)


In the Object-Explorer we can look more closely at the classes which are present in the Dlls.


The Express Editor also has the useful function autocomplete at it's disposal.



In the next lesson we will finally start with scripting - I promise!

Suggestions or criticism are always welcome.

Thanks again to FG28_Elatan for the translation.

Last edited by FG28_Kodiak; 01-11-2012 at 04:51 PM.
Reply With Quote
  #2  
Old 01-10-2012, 08:25 PM
KDN KDN is offline
Approved Member
 
Join Date: Sep 2010
Posts: 114
Default

Keep it coming ...if possible
I got Visual C sharp installed and got a dummies book along with another one that takes a littel different approach and have started getting into it but since I have no reference "pegs" my motivation is kind of ...limp!!
You have given me something to build on since it is CoD related, now I can go back with more enthusiasm.
Cheers!!

Last edited by KDN; 01-11-2012 at 01:56 PM.
Reply With Quote
  #3  
Old 01-10-2012, 10:26 PM
Smokeynz Smokeynz is offline
Approved Member
 
Join Date: Apr 2011
Posts: 106
Default

I downloaded and installed the ms express editor, as a newbie to C# the editor has alot of advantages. I recommend getting it.

As noted it finds missing brackets and colons and basic syntax errors, however it does not see many other errors

Something I get caught up in with clod is exchanging information, passing data from one section to another. common error is "cannot covert "int" to "bool""

Although C# has a reasonble learning curve, maybe list commonly used elements with relation to clod as it stands, maybe why they are there.

examples,
using system xxxxx

main class
Amission

int
pvt int
bool
string

advance stuff
indexing
switches
Reply With Quote
  #4  
Old 01-11-2012, 08:39 AM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

Great work as usual! Thank you very much for going into all the details!

Last edited by Ataros; 01-11-2012 at 12:42 PM.
Reply With Quote
  #5  
Old 01-11-2012, 08:45 AM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

Quote:
Originally Posted by KDN View Post
I got Visual C sharp installed and got a dummies book along with another one that takes a littel different approach and have started getting into it but since I have no reference "pegs" my motivation is kind of ...limp!!
You can try starting making your own simple mission based on these scripts http://forum.1cpublishing.eu/showthread.php?t=26523 Or just study those scripts for starters and use your textbook to find answers when you are lost.

It is much more fun to work with CloD related code.
Reply With Quote
  #6  
Old 01-11-2012, 12:26 PM
Pato Salvaje's Avatar
Pato Salvaje Pato Salvaje is offline
Approved Member
 
Join Date: Jan 2010
Posts: 123
Default

OOOOOOHHHH!!!! MY GOD!...

Kodiak, you´ve made my day!! I was learning by my own, but this is a great step forward for me!!!... please keep coming...
I have MS express ready and waiting to script...
__________________
Phenom II X4 970 3,5 Ghz, Gigabyte 890GPA UD3H, 4GB RAM GSKILL RIP-JAWS 1333, Gigabyte 560Ti OC 1GB, W7 64
Reply With Quote
  #7  
Old 01-11-2012, 01:25 PM
salmo salmo is offline
Approved Member
 
Join Date: Mar 2011
Posts: 632
Default

<Post deleted .... problem fixed> Thanks Kodiak for a useful tutorial
__________________
When one engine fails on a two engine bomber, you will always have enough power left to get to the scene of the crash.

Get the latest COD Team Fusion patch info HERE

Last edited by salmo; 01-11-2012 at 01:27 PM.
Reply With Quote
  #8  
Old 01-11-2012, 02:14 PM
SG1_Lud's Avatar
SG1_Lud SG1_Lud is offline
Approved Member
 
Join Date: Jul 2010
Location: Spain
Posts: 376
Default

Awesome! TY very much Kodiak.
S!
Reply With Quote
  #9  
Old 01-28-2012, 07:52 PM
Blackdog_kt Blackdog_kt is offline
Approved Member
 
Join Date: Jan 2008
Posts: 2,715
Default

I've started a computer science course this year and we're learning Java, which is very similar in syntax and "mentality" to C#.

I've got a couple of exams to end this semester and then a 3 week break, i think i'll try to make something CoD related during the break.

For me the biggest issue is that i don't have knowledge of the libraries. I mean, i have a rough dynamic campaign structure in my head for online play that will support tracking of supplies for each side, but i don't know if/what kind of classes, methods and objects already exist in what the sim gives us.

If i had a brief explanation of what the provided classes/methods do in the game's .dll libraries i'd probably be able to get right down to making something useful and testing it.
Reply With Quote
  #10  
Old 03-29-2012, 04:23 PM
SiThSpAwN's Avatar
SiThSpAwN SiThSpAwN is offline
Approved Member
 
Join Date: Jul 2011
Location: Vancouver, BC Canada
Posts: 665
Default

Great stuff, looking forward to more!!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:21 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright © 2007 Fulqrum Publishing. All rights reserved.