ParanoiaPhD submitted a new resource:

A prefab system for streamlining building (Claude.ai generated based on CEO's YAAAG as ref) - Work smarter not harder...

Simply drop both scripts into custom scripts...

Build your prefabs using movable objects is key. The objects must be movable in order to be recorded into the prefab file. Once the prefab is ready its saved with a name chosen by you to \prefabs\ where the gump will then list it as a button. The gump will dynamically grow as more and more prefabs are created.

Directions...

1. Build using moveable objects only.
2. Activate the [copy command.
3. Click the northwest corner of your prefab.
4...

Read more about this resource...
 
public class PrefabGump : Gump....

Create dir:
    private List<string> GetPrefabNames()
    {
        string prefabDirectory = Path.Combine(Core.BaseDirectory, "Prefabs");

        // Check if the directory exists
        if (!Directory.Exists(prefabDirectory))
        {
            // If the directory does not exist, create it
            Directory.CreateDirectory(prefabDirectory);
        }

        string[] prefabFiles = Directory.GetFiles(prefabDirectory, "*.txt");
        List<string> prefabNames = new List<string>();

        foreach (string prefabFile in prefabFiles)
        {
            string prefabName = Path.GetFileNameWithoutExtension(prefabFile);
            prefabNames.Add(prefabName);
        }

        return prefabNames;
    }

}
Creates the directory if it does not exist, otherwise, the server restarts. You should attach an example of a Prefab.txt here so that people can get an idea of how and what it addresses. Otherwise, add a button that creates an example.1710963403920.png
public class PrefabGump : Gump:
public class PrefabGump : Gump
{
    private const int ButtonsPerPage = 50;
    private const int ButtonsPerRow = 5;
    private const int ButtonWidth = 100; // Gump Width
    private const int ButtonHeight = 50; // Gump Height
    private const int MaxButtonTextLength = 10;

    private readonly Mobile m_From;
    private readonly List<string> m_PrefabNames;
    private readonly int m_Page;

    public PrefabGump(Mobile from, int page = 0) : base(50, 50)
    {
        m_From = from;
        m_PrefabNames = GetPrefabNames();
        m_Page = page;

        int totalRows = (m_PrefabNames.Count - (page * ButtonsPerPage) + ButtonsPerRow - 1) / ButtonsPerRow;
        int gumpHeight = totalRows * ButtonHeight + 40;

        AddPage(0);
        AddBackground(0, 0, ButtonWidth * ButtonsPerRow, gumpHeight, 9200);
        AddLabel(10, 10, 0x481, "Prefab Selection");

        int index = page * ButtonsPerPage;
        int row = 0;
        int col = 0;

        while (index < m_PrefabNames.Count && index < (page + 1) * ButtonsPerPage)
        {
            string prefabName = m_PrefabNames[index];
            string buttonText = prefabName.Length <= MaxButtonTextLength ? prefabName : prefabName.Substring(0, MaxButtonTextLength);

            AddButton(col * ButtonWidth + 10, row * ButtonHeight + 50, 4023, 4024, index + 1, GumpButtonType.Reply, 0);
            AddLabel(col * ButtonWidth + 15, row * ButtonHeight + 55, 0x481, buttonText);

            col++;
            if (col >= ButtonsPerRow)
            {
                col = 0;
                row++;
            }

            index++;
        }

        if (page > 0)
            AddButton(10, gumpHeight - 30, 4014, 4015, 501, GumpButtonType.Reply, 0);

        if ((page + 1) * ButtonsPerPage < m_PrefabNames.Count)
            AddButton(ButtonWidth * ButtonsPerRow - 30, gumpHeight - 30, 4005, 4006, 502, GumpButtonType.Reply, 0);

        // Add a button that runs the [copy command
        AddButton(10, 30, 4005, 4006, 0, GumpButtonType.Reply, 0);
        AddLabel(45, 30, 0x481, "Copy Command");
    }
public override void OnResponse(NetState sender, RelayInfo info):
public override void OnResponse(NetState sender, RelayInfo info)
{
    Mobile from = sender.Mobile;

    if (info.ButtonID == 0)
    {
        // Execute the [copy command when the button is pressed
        CommandSystem.Handle(from, "[copy");
    }
    if (info.ButtonID == 501)
    {
        from.SendGump(new PrefabGump(from, m_Page - 1));
    }
    else if (info.ButtonID == 502)
    {
        from.SendGump(new PrefabGump(from, m_Page + 1));
    }
    else if (info.ButtonID >= 1 && info.ButtonID <= m_PrefabNames.Count)
    {
        string selectedPrefab = m_PrefabNames[info.ButtonID - 1];
        from.SendMessage($"Selected prefab: {selectedPrefab}");
        from.Target = new InternalTarget(selectedPrefab);
    }
}

With that, the [copy command is already included in the gump. It could now also be expanded to address the statics. and a checkbox that activates this...As an idea.
 
Last edited:
took me a while to figure out what you were saying yeah man if you wanna fix it up feel free this is just barely functional for my need and i cant even code
 
So I had an Idea.. Archive the prefab folder and keep them organized. Build prefab folders for specific tasks. You can load them and unload them while the server is running. I plan to make tree prefabs tomorrow. plants. and what have you. I will think it out and post here with a few zips.
 
took me a while to figure out what you were saying yeah man if you wanna fix it up feel free this is just barely functional for my need and i cant even code
It's no issue if you can't program; it turned out well. I tested and expanded it only so that if a folder isn't present, it gets created instead of the server restarting when the command [prefabgump is triggered. And the command is built directly into the Gump now. You can incorporate it if you want; I'm working on other things, more towards expanding Ultima..
So I had an Idea.. Archive the prefab folder and keep them organized. Build prefab folders for specific tasks. You can load them and unload them while the server is running. I plan to make tree prefabs tomorrow. plants. and what have you. I will think it out and post here with a few zips.
Good idea, expand on it.!!
 
Ok just wondering....since UOAR doesnt seem to work for alot of us anymore...anyway of making this recognize the .uoa files so we can bring in some of the buildings that people have made using UOAR?
 
I would take the approach of reading out and converting UOAR, basically reformatting it. I think that would be the best solution. The architect needs adjustment anyway. I believe the Orbsydia team is back at it, one of them is around here. They should just release the source code so it can be integrated. Many still use the tool anyway. I believe Khaybel is on board.
What you could try is to directly import into the Multi.mul and then export from it again. As far as I've seen, the .uoa files from Architect cannot be read by Fiddler directly from Architect. In any case, that section should be revised.
 
Last edited:
Ok just wondering....since UOAR doesnt seem to work for alot of us anymore...anyway of making this recognize the .uoa files so we can bring in some of the buildings that people have made using UOAR?
you could easily do it the cluck all you have to do is set ur building to moveable...


  1. RedRooster:

    [area set movable true



    • [9:14 PM]RedRooster:

      Also cluck

thats from discord yeah so make it all just moveable pieces with that command and then go the the north west corner and [copy on yourself and then go to the southeast corner and click on yourself then name it unique. u will have a uniqe preface that will show up in the gump! just click it in the button and it will work as long as u go north west to south east. XD good luck.
 
Ok I am talking about bringing in files. Not creating them. I have a .uoa building that I am wanting to bring into my shard, but cant because uoar isnt working and letting me connect.
 
Try figuring out how its set up. my prefab scripts set up so each line is a single tile if uoa is also that way its possible.
if you can decod how each line is in the uoa file and each line reps one tile tell claude or openai to formula then tel it the formula for the prefab system and there u go tell it to create a python script that will batch convert your folder of uoa files lol
 
i add and fix some script in copyprefabgump.cs.

you can get prefabtool.
[add prefabtool
スクリーンショット 2024-04-14 13.17.44.png

double click and open prefabgump
スクリーンショット 2024-04-14 13.18.14.png

almost prefab control can execute from this gump.
 

Attachments

  • copyprefabgump.cs
    8.9 KB · Views: 2
Back