Hello icant figure this out so i ask for help



Code:
 public ChatGumpa(Mobile from, ChatSystem system) : base(50, 100)
        {
            m_Caller = from;
            m_System = system;

            this.Closable=true;
            this.Disposable=true;
            this.Dragable=true;
            this.Resizable=false;

how can i call that gump? im getting errors, this is what im trying

Code:
from.SendGump(new ChatGumpa(from,this));


CS1502: Line 72: The best overloaded method match for 'Server.Gumps.ChatGump
a.ChatGumpa(Server.Mobile, Server.Gumps.ChatSystem)' has some invalid arguments
CS1503: Line 72: Argument '2': cannot convert from 'Server.Gumps.chatgumpz'
to 'Server.Gumps.ChatSystem'


Also tried

Code:
from.SendGump(new ChatGumpa(from));

CS1729: Line 72: 'Server.Gumps.ChatGumpa' does not contain a constructor tha
t takes '1' arguments
 
public ChatGumpa(Mobile from, ChatSystem system) : base(50, 100)

That bit looks like the problem...

ChatGumpa requires 2 variables, the chatsystem parts throwing the errors, the from parts ok as that's the mobile calling the gump.

What do you have defined as ChatSystem system ???
 
I shouldve post thetwhole script, there:

Edit: oops i uploaded the wrong one, this is the right one

Amd @PyrO thanks but i dont understand :oops::(
Code:
//////////////////////////////////////////////////////////////////////
// Automatically generated by Bradley's GumpStudio and roadmaster's
// exporter.dll,  Special thanks goes to Daegon whose work the exporter
// was based off of, and Shadow wolf for his Template Idea.
//////////////////////////////////////////////////////////////////////
using System;
using Server;
using Server.Gumps;
using Server.Network;
using Server.Mobiles;
using Server.Commands;
using System.Collections;

namespace Server.Gumps
{
    public class ChatGumpa : Gump
    {
        private Mobile m_Caller;
        private ChatSystem m_System;

        public static void Initialize()
        {
            CommandSystem.Register("Chat", AccessLevel.Player, new CommandEventHandler(Chat_OnCommand));
        }

        [Usage("Chat")]
        [Description("Makes a call to the chat system gump.")]
        public static void Chat_OnCommand(CommandEventArgs e)
        {
            Mobile caller = e.Mobile;
            ChatSystem system = null;
            string message = "";

            foreach (Item item in World.Items.Values)
            {
                if (item is ChatSystem)
                    system = item as ChatSystem;
            }

            if (system == null)
                system = new ChatSystem(caller);

            if (e.Length >= 1)
            {
                foreach (string str in e.Arguments)
                {
                    message += str + " ";
                }

                if (!system.m_Players.ContainsKey(caller))
                {
                    caller.SendAsciiMessage("Usage: .chat");
                    return;
                }
                else
                {
                    foreach (Mobile m in system.m_Players.Keys)
                    {

                      
                        m.SendAsciiMessage(0x49, String.Format("[{0}{1}]: {2}", (caller.AccessLevel > AccessLevel.Player ? "@" : ""), caller.Name, message));
                     
                     
                    }
                  
                  
               
            }
            else
            {
                if (system.m_Players.ContainsKey(caller))
                {
                    caller.SendAsciiMessage("Usage: .chat <mensaje>");
                    return;
                }
                else
                {
                    if (caller.HasGump(typeof(ChatGumpa)))
                        caller.CloseGump(typeof(ChatGumpa));

                    system.AddPlayer(caller);
                    caller.SendAsciiMessage(0x49, "You joined the chat");
                }
            }
        }

        public ChatGumpa(Mobile from, ChatSystem system) : base(50, 100)
        {
            m_Caller = from;
            m_System = system;

            this.Closable=true;
            this.Disposable=true;
            this.Dragable=true;
            this.Resizable=false;

            AddBackground(0, 0, 190, 330, 9200);
            AddButton(16, 269, 4005, 4007, 1, GumpButtonType.Reply, 0);
            AddLabel(40, 11, 0, @"Chat");

            string players = "";
            foreach (Mobile m in m_System.m_Players.Keys)
            {
                bool visible = true;
                m_System.m_Players.TryGetValue(m,out visible);

                if (visible)
                    players += String.Format("{1} <BR>", players, (m == null ? "" : (m.AccessLevel > AccessLevel.Player ? "@" + m.Name : m.Name)));
            }

            AddHtml(10, 50, 163, 188, players, (bool)true, (bool)true);

            AddLabel(10, 30, 0, @"Players");
            AddLabel(14, 244, 0, @" .chat <mensaje> ");


            bool isvisible = true;
            m_System.m_Players.TryGetValue(from, out isvisible);

            AddLabel(54, 270, 0, (isvisible ? @"Hide" : @"Show"));


            AddLabel(56, 298, 0, @"Quit");
            AddButton(16, 296, 4017, 4019, 0, GumpButtonType.Reply, 0);

        }

        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            switch(info.ButtonID)
            {
                case 0:
                {
                 
                    m_System.RemovePlayer(from);
                    break;
                }
                case 1:
                {
                    m_System.ToggleVisible(from);
                    m_System.UpdateGump();
                    break;
                }

            }
        }
    }
}
 
Last edited:
its simple,

the error is CS1503: Line 72: Argument '2': cannot convert from 'Server.Gumps.chatgumpz'
to 'Server.Gumps.ChatSystem'

wich means you want to put in the reference from a chatgumpz class while you then have the constructor accept ChatSystem, thats not going to work since they are not the same nor is chatgumpz a child of ChatSystem
 
You would need to edit the script (chatgumpz) wich is calling ChatGumpa so that you do not put the reference of chatgumpz (with 'this') but the actual chatsystem that you want in ChatGumpa
 
Back