News:

Wondering if this will always be free?  See why free is better.

Main Menu

[WIP] Mod Builder

Started by NanoSector, December 24, 2012, 08:05:46 PM

Previous topic - Next topic

NanoSector

Quote from: Arantor on February 07, 2013, 03:14:51 PM
Stop being literal.

Whatever process that occurs whereupon the id is collated, notify the user and abort the process.
Which leads me to what I was saying, there is no way to abort a TextChanged event.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Arantor

How much processing is the event handler doing, exactly?

Put all the bulk of the processing in another function, and have the event handler do enough to validate the contents of the object... then defer it to the other function if successful.

NanoSector

        #region Mod ID Generator
        private void modName_TextChanged(object sender, EventArgs e)
        {
            generateModID();

            modName.BackColor = Color.White;
        }

        private void genPkgID_CheckedChanged(object sender, EventArgs e)
        {
            if (genPkgID.Checked == true)
            {
                modID.Enabled = false;
                generateModID();
            }
            else
                modID.Enabled = true;
        }

        private void authorName_TextChanged(object sender, EventArgs e)
        {
            generateModID();
        }

        private void modID_TextChanged(object sender, EventArgs e)
        {
            string tmpstr = System.Text.RegularExpressions.Regex.Replace(modID.Text, @"[^a-zA-Z0-9:_-]", "");
            if (tmpstr.Length > 32)
                tmpstr = tmpstr.Substring(0, 32);
            modID.Text = tmpstr;


            modID.BackColor = Color.White;
        }

        private void generateModID()
        {
            if (genPkgID.Checked == true && !string.IsNullOrEmpty(authorName.Text) && !string.IsNullOrEmpty(modName.Text))
            {
                string an = System.Text.RegularExpressions.Regex.Replace(authorName.Text, @"[^a-zA-Z0-9_-]", "");
                string mn = System.Text.RegularExpressions.Regex.Replace(modName.Text, @"[^a-zA-Z0-9_-]", "");
                string tmpstr = (an + ":" + mn);
                if (tmpstr.Length > 32)
                    tmpstr = tmpstr.Substring(0, 32);
                modID.Text = tmpstr;
            }
        }
        #endregion


You're saying I need to do the checking in the TextChanged events?
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Arantor

Oh, now I see the code, it's really simple.

Both event handlers should just call generateModID. If it is valid, they set the modID Text property, and either way set enabled based on whether it is valid.

NanoSector

That bumps into the next problem - whether the modID textbox is enabled or not depends on whether the ID should be automatically generated... :P

* Yoshi2889 knows he is a PITA
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Arantor

You're not a PITA. The problem is that you're thinking too linearly.

If the ID is automatically generated... is there a circumstance when it could ever be invalid? Could it be automatically made to be valid?

Bear in mind that I haven't looked at any code other than what you've posted in this last page. I think the problem is you're so set in how you think you have to look at it that you can't approach the problem from any other direction.

NanoSector

If it gets generated it gets chopped down to 32 characters. I don't think there's a way to get it to be invalid when generated.

What I could also do...
If it exceeds 32 characters when in Manual mode, display a red bold message underneath and refuse to build the project once asked to with a big warning box saying "The Mod ID exceeds 32 characters, please shorten it."
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Arantor

Now you're thinking more like it :)

NanoSector

Thanks Arantor, pushed 1.1.3 which should add what I mentioned above :)
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

NanoSector

After some fiddling around I got this to run *natively* in Ubuntu... :D

It crashes upon opening the Mod Editor though, so I'll need to fix that.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

XienDev

I've got some idea about modbuilder, i understood your position as helping for someone to create a mod easily, without deep knowledge about smf structure and etc. OK, i think it would be cool if you add some visual asist to mode builder, in example:

you have got a list of all important smf scripts and you show a hint that contains a description for a script. After you chose that script, you can apply a hook to any containing function (before call, after call), or choose a list of db queries or echo comands and modify them. Other thing is a list of helper hooks, in example: You display a textarea where user can post any php script, and below this textarea, show other dynamically created field:

"execute when:" "choose from a list"

you can select:

> user
> membergroups
> messages
> statistics
> register
> posts
> etc

in example we choose messages, then we have

"execute when:" "messages" "choose from a list":

>count
>time
>reputation
>replies
> etc.

we choose count:

"execute when:" "messages" "count" "choose from a list":

>is
>at
>since
>for

---> is:

"execute when:" "messages" "count" "is" "choose from a list":

>greater then
>less than
>equal to
>greater or equal to
>less then or equal to
>etc

--->greater than

"execute when:" "messages" "count" "is" "greater than" [entervalue]:

---------------------

and in a text field for script should be a visual assist:

when you enter:

send [pm]
         [message]
         [notification]
         [warning]
         [....]

.....

send pm to [admin]
                  [user]
                  [other guys]

.....

send pm to user ("bla bla bla");

---------------------------------------------------------------------------------

Something like this, but it's hard to implement, and you should take a time for construct a whole image about it.
I'm not a native English speaker, so feel free to check my posts for spelling errors and improve them

NanoSector

XienDev, thanks for your suggestion :)

It is hard to implement as you said. But it's not impossible, it just requires a whole lot of time and effort to create it.
I'll put it on the Bug Tracker on GitHub:
https://github.com/Yoshi2889/ModManager/issues/6
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Matthew K.

XienDev, what you are suggesting is not practical at all.

Arantor

It's not practical in the mod builder, sure.

But it IS practical to make it a core feature. And before anyone gets all 'it's difficult'... yes, it's difficult. Except I've already done 85% of it already so I know exactly how difficult or not difficult it is. (It is essentially the same concept as the moderation filters system in Wedge)

XienDev

Quote from: Labradoodle-360 on February 09, 2013, 12:14:34 PM
XienDev, what you are suggesting is not practical at all.

I do not say that this should replace custom codding or codding snippets. I say that this helpers can show you examples of code, when U do not know how to do something, it can build your query (php example how this should look like). Imagine that like bbcodes  at the top of "Post reply". If you know them, they not usefull for U, but if u make your first post.... I think this is very usefull.. IMHO
I'm not a native English speaker, so feel free to check my posts for spelling errors and improve them

XienDev

Quote from: Arantor on February 09, 2013, 12:18:42 PM
It's not practical in the mod builder, sure.

But it IS practical to make it a core feature. And before anyone gets all 'it's difficult'... yes, it's difficult. Except I've already done 85% of it already so I know exactly how difficult or not difficult it is. (It is essentially the same concept as the moderation filters system in Wedge)

Make this feature is not difficult to code. The most difficult thing here is collect all possible and useful "triggers", but coding should not take a lot of time.
I'm not a native English speaker, so feel free to check my posts for spelling errors and improve them

NanoSector

Quote from: Labradoodle-360 on February 09, 2013, 12:14:34 PM
XienDev, what you are suggesting is not practical at all.
It is practical. This program is designed to make creating mods a breeze.

I might not be able to add in the exact suggested feature... However what I can do is create some sort of variable inserter or something.

Right now my main concern is getting it to run correctly in MonoDevelop.
Due to .NET 4.0 being used the SplitContainers used are making Mono go all dafuq, so I'll need to find a way of getting the source compiled for .NET 3.5.

XienDev: Depending on how many options you have, it requires more code data. Think of it as a table, the more columns the wider the rows.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Arantor

Quote from: XienDev on February 09, 2013, 12:32:12 PM
Make this feature is not difficult to code. The most difficult thing here is collect all possible and useful "triggers", but coding should not take a lot of time.

You keep telling yourself that. Trust me, it's far more complex than you think. As I said, I've already done a large amount of this. It took me the best part of a week, full time, to implement it all properly.

XienDev

hmm.. i thought that the code is like a "container" for db query  (or in  .Net you can make throught iterators (or linked lists),arrays, pairs by id's, u need only linked data and a chain [1]->[2]->
  • ...  );  but it should be easier.. but think it is not so hard,  seems that i was wrong... hmm.

I'm not a native English speaker, so feel free to check my posts for spelling errors and improve them

NanoSector

Well, you can't just paste code together, that won't work.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Advertisement: