Dear forum users! In compliance with the new European GDPR regulations, we'd just like to inform you that if you have an account, your email address is stored in our database. We do not share your information with third parties, and your email address and password are encrypted for security reasons.

New to the forum? Say hello in this topic! Also make sure to read the rules.

Improving your code

Share questions, scripts and tutorials related to the ScriptAPI in SFD.
Forum rules
By using the forum you agree to the following rules.
Post Reply
User avatar
ShutDownMan
Fighter
Fighter
Posts: 32
Joined: Sat Mar 19, 2016 7:17 pm
Title: Yeah, science!
SFD Alias: ShutDownMan, Devil Shut
Started SFD: 1.2.something
Location: Hu3, Brazil
Gender:
Age: 18
Contact:

Improving your code

Post by ShutDownMan » Mon Mar 06, 2017 3:11 am

Hello people,
I'm here now to show you guys one way to improve your SFD projects...

I've made a "mini-program" some time ago, in python, just for me. The program was simple, it "welded up" the text of files inside a folder (and all sub-folders) so I could separate my code into different files. It was simple but effective, my code felt more organized, I could do more complex things without worrying about forgetting where all the pieces of the code went...

Then I started using Visual Studio, and it just got crazier, now with all the IDE + the ability to separate classes into different files I did some of my most "useless" scripts for SFD:
Image

The IDE made it all easier: The syntax check, the auto-complete, the intellisense...
Image

As I liked so much this program, I thought of sharing it with you guys. So I remade the program, now in C#, and added some more features to it. it's not the best UI I've ever made, but it's OK (I will leave the zipped project in the links part, if you wanna mess around with it).

Maybe you don't really want to make "complex scripts", but I'm sure you don't like to scroll up and down on a near 1000 lines file, it's pure PAIN!

To make it easier to understand the program usage, I've made this video clarifying the overall how-to:
https://youtu.be/GkRT5Oh22vQ
Use the pause button, the video is meant for that.


Version 1.0:
- Simple UI;
- Options:
-- Change output file name;
-- Change input file extension;
-- Code to clipboard;
-- Save used configs (input/output files paths);
-- Recent input paths;
- Snippets:
-- New project;
-- New class;

Notes:
You can always edit the snippets, they are located at the .\\Configs\\Snippets.
Also, NEVER use the word "Temporary" in your files name, the program will ignore it (in short: because Visual Studio)


Links:
Executable: Mega
Source Project: Mega
14 x
~ShutDownMan

User avatar
Gurt
Lead Programmer
Lead Programmer
Posts: 1046
Joined: Sun Feb 28, 2016 3:22 pm
Title: Lead programmer
Started SFD: Made it!
Location: Sweden
Gender:
Age: 28

Post by Gurt » Mon Mar 06, 2017 7:23 pm

Neat. I'm linking this from viewtopic.php?f=15&t=1588&p=10365#p10365.
2 x
Gurt

jamisco
Superfighter
Superfighter
Posts: 67
Joined: Sun Nov 06, 2016 11:34 pm
Title: Da God
SFD Account: Jamisco
SFD Alias: Jamisco
Started SFD: either late 2015 or early 2016
Location: Somewhere in the east of the United states
Gender:
Age: 97

Post by jamisco » Tue Mar 07, 2017 9:08 pm

Wait..How'd you get the banana to display in the map?
1 x
Is it better to be feared or respected... please, is it too much to ask for both?

User avatar
ShutDownMan
Fighter
Fighter
Posts: 32
Joined: Sat Mar 19, 2016 7:17 pm
Title: Yeah, science!
SFD Alias: ShutDownMan, Devil Shut
Started SFD: 1.2.something
Location: Hu3, Brazil
Gender:
Age: 18
Contact:

Post by ShutDownMan » Tue Mar 07, 2017 11:25 pm

jamisco wrote:Wait..How'd you get the banana to display in the map?
Short answer:
You can make "pixels" with Text objects,
You can change the text color through code.
0 x
~ShutDownMan

jamisco
Superfighter
Superfighter
Posts: 67
Joined: Sun Nov 06, 2016 11:34 pm
Title: Da God
SFD Account: Jamisco
SFD Alias: Jamisco
Started SFD: either late 2015 or early 2016
Location: Somewhere in the east of the United states
Gender:
Age: 97

Post by jamisco » Fri Mar 10, 2017 7:42 am

Holy mac and cheese ...how long that take you m8?
0 x
Is it better to be feared or respected... please, is it too much to ask for both?

User avatar
ShutDownMan
Fighter
Fighter
Posts: 32
Joined: Sat Mar 19, 2016 7:17 pm
Title: Yeah, science!
SFD Alias: ShutDownMan, Devil Shut
Started SFD: 1.2.something
Location: Hu3, Brazil
Gender:
Age: 18
Contact:

Post by ShutDownMan » Fri Mar 10, 2017 3:59 pm

jamisco wrote:Holy mac and cheese ...how long that take you m8?
Oh, no man, I didn't do it by hand, I automated it and the only challenging part was to make it "play".

I made a simple python script that generated a string of C# code with the information of frames and pixels. Then I used that to color the TextObjects. Technically I can play any GIF, but actually just small enough that don't crash the compiler.

"So, how long?"
Some hours...
1 x
~ShutDownMan

jamisco
Superfighter
Superfighter
Posts: 67
Joined: Sun Nov 06, 2016 11:34 pm
Title: Da God
SFD Account: Jamisco
SFD Alias: Jamisco
Started SFD: either late 2015 or early 2016
Location: Somewhere in the east of the United states
Gender:
Age: 97

Post by jamisco » Sun Mar 12, 2017 2:56 am

I now have this weird urge to learn python.... also by any chance is there a way u could make that gif like move around the map like a real player could?
0 x
Is it better to be feared or respected... please, is it too much to ask for both?

User avatar
ShutDownMan
Fighter
Fighter
Posts: 32
Joined: Sat Mar 19, 2016 7:17 pm
Title: Yeah, science!
SFD Alias: ShutDownMan, Devil Shut
Started SFD: 1.2.something
Location: Hu3, Brazil
Gender:
Age: 18
Contact:

Post by ShutDownMan » Tue Mar 14, 2017 5:16 pm

jamisco wrote:I now have this weird urge to learn python.... also by any chance is there a way u could make that gif like move around the map like a real player could?
You definitely don't want to do that... The "canvas" I work on have (5*8)*(6*8) "pixels" on it, this is 1920 TextObjects and moving them would be a disaster...

But, if you make a fighter animation and make it move inside the canvas, you can place the canvas so it looks like the fighter is moving, and as the background can be invisible (I have control over the alpha value) it will look like a normal fighter.
1 x
~ShutDownMan

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests