This forum is locked and will eventually go offline. If you have feedback to share you can find us in our Discord channel "MythoLogic Interactive" https://discord.gg/nECKnbT7gk

Forum rules

New to scripting.

Here you can find answered ScriptAPI topics.
Forum rules
By using the forum you agree to the following rules.
Locked
ClockworkDice
Fighter
Fighter
Posts: 28
Joined: Wed Nov 02, 2016 12:59 am
Started SFD: Sometime in Pre-Alpha
Gender:

New to scripting.

Post by ClockworkDice » Tue Nov 08, 2016 2:55 am

Hello, so I'm interested in getting into scripting and I'm wondering about a couple of things. #1: I am not new to programming but I am new to C#. I know python and I'm wondering if there is a way to use it as the language for m scripts, if not I'd like to know if anyone has any good resources they could point me to in order to learn C#. #2: I know that there is a script tab in the map editor but I can't find a way to make standalone scripts(the ones run using the /startscript command). Is there a way to use the map editor API without making a map? or do I just have to use notepad or something?#3: I on't really know where I can learn all of the methods and classes in the game and how to use them, I know that there is probably something on this forum but I'm having a hard time finding it if there is one.
Thanks in advance.
(Edit: I found the tutorial by Gurt on here, but does anyone have any other resources? not that the one by Gurt is bad, jet that I'd like to have multiple places to learn from.)
0 x

User avatar
Motto73
Superfighter
Superfighter
Posts: 316
Joined: Mon May 09, 2016 7:35 am
Title: Lazy ass
SFD Account: Motto73
Started SFD: Multiplayer Test Demo
Location: Sunny City
Gender:
Age: 26

Post by Motto73 » Tue Nov 08, 2016 9:24 am

ClockworkDice wrote:Hello, so I'm interested in getting into scripting and I'm wondering about a couple of things. #1: I am not new to programming but I am new to C#. I know python and I'm wondering if there is a way to use it as the language for m scripts, if not I'd like to know if anyone has any good resources they could point me to in order to learn C#. #2: I know that there is a script tab in the map editor but I can't find a way to make standalone scripts(the ones run using the /startscript command). Is there a way to use the map editor API without making a map? or do I just have to use notepad or something?#3: I on't really know where I can learn all of the methods and classes in the game and how to use them, I know that there is probably something on this forum but I'm having a hard time finding it if there is one.
Thanks in advance.
(Edit: I found the tutorial by Gurt on here, but does anyone have any other resources? not that the one by Gurt is bad, jet that I'd like to have multiple places to learn from.)
Hi ClockWorkDice!

I'm always glad to have as many coders as possible here.
You can find the awesome Script Api_ in the installation fodler, or easily opening map editor and script window and pressing F1.
To make standalone scripts, you usually need to use the method OnStartup(). It is called like Main() in many programs. You have to save the scripts then to your Documents\Superfighters Deluxe\Scripts. You can start them by chatting "/startscript [ScriptName]".
And now, the questions:

#1: No one has good resources to translate python into C# with .net. Learn C#.

#2: There are 3 ways:
1. Use the map editor. It is the main way to script in SFD. It is the only tool (at least the best that I know) to compile the script and chekc for errors straightly.
2. Notepad. Notepad is a great tool to save files into .txt. The usage is pretty good, but ctrl+commands is quite shitty. At least use this as the saving tool.
3. Load some IDE. I use Xamarin Studio (was MonoDevelop before), but Gurt recommends using Visual studio, since it's the home of C#. Then you have just edit references and add SFD.GameScriptInterface to your project. You can now code fast and effectively, and then you just copy the script into the window.

#3 As said upper, the Api_ documentation is the main way that you should use. But the best way to learn to use them is to make maps and read code made by other people.

I hope that this helped.
4 x
Image

Locked