예제 #1
0
        private void TextToEvent(string str, int insertPoint = -1, bool isClear = false)
        {
            this.PushUndo();

            if (isClear)
            {
                this.ProcsScript.Clear();
            }

            string[] lines = str.Split('\n');
            for (int i = 0; i < lines.Length; i++)
            {
                byte[] bin = LineToEventByte(lines[i]);
                if (bin.Length < 4)
                {//壊れているか違うコード
                    continue;
                }

                EventScript.OneCode code = Program.ProcsScript.DisAseemble(bin, 0);
                if (insertPoint <= -1)
                {//末尾に追加.
                    this.ProcsScript.Add(code);
                }
                else
                {//特定場所に追加.
                    this.ProcsScript.Insert(insertPoint, code);
                }
            }

            //最後に自下げ処理実行.
            EventScriptUtil.JisageReorder(this.ProcsScript);
            //リストの更新.
            this.Script.DummyAlloc(this.ProcsScript.Count, this.Script.SelectedIndex);
        }
예제 #2
0
        public static void JisageReorder(List <EventScript.OneCode> eventAsm)
        {
            List <uint> needLabel    = new List <uint>();
            uint        jisageCount  = 0;
            bool        isBeforeGoto = false;

            for (int i = 0; i < eventAsm.Count; i++)
            {
                EventScript.OneCode code = eventAsm[i];
                if (code.Script.Has == EventScript.ScriptHas.LABEL_CONDITIONAL)
                {
                    if (jisageCount > 0)
                    {
                        uint cond_id = GetScriptLabelID(code);

                        needLabel.RemoveAll((uint x) => { return(x == cond_id); });
                        if (needLabel.Count == 0)
                        {//必要なラベルをすべて探索し終わった。おそらく複雑な字下げが行われているのだろう.
                            jisageCount = 0;
                        }
                        else
                        {
                            jisageCount--;
                        }
                        code.JisageCount = jisageCount;
                    }
                    if (needLabel.Count != 0 && isBeforeGoto)
                    {//まだ探索しなければいけないラベルがあり、直前にgotoがあった場合
                        //おそらくこれはelse区です
                        jisageCount++;
                    }
                    isBeforeGoto = false;
                }
                else if (code.Script.Has == EventScript.ScriptHas.IF_CONDITIONAL)
                {
                    code.JisageCount = jisageCount++;
                    uint conditional_id = GetScriptConditionalID(code);
                    if (conditional_id != U.NOT_FOUND)
                    {
                        needLabel.Add(conditional_id);
                    }
                    isBeforeGoto = false;
                }
                else if (code.Script.Has == EventScript.ScriptHas.GOTO_CONDITIONAL)
                {
                    code.JisageCount = jisageCount;
                    uint conditional_id = GetScriptConditionalID(code);
                    if (conditional_id != U.NOT_FOUND)
                    {
                        needLabel.Add(conditional_id);
                    }
                    isBeforeGoto = true;
                }
                else
                {
                    code.JisageCount = jisageCount;
                    isBeforeGoto     = false;
                }
            }
        }
예제 #3
0
        int ShowFloatingControlpanelInner(EventScript.OneCode code, int index)
        {
            if (index < 0 || index >= this.Script.Items.Count)
            {
                return(0);
            }

            //編集する項目の近くに移動させます.
            Rectangle rect = this.Script.GetItemRectangle(index);
            int       y    = this.ListBoxPanel.Location.Y
                             + this.Script.Location.Y
                             + rect.Y + rect.Height + 20
            ;

            if (y + ControlPanel.Height >= Script.Height)
            {//下に余白がないので上に出す.
                y = this.ListBoxPanel.Location.Y
                    + this.Script.Location.Y
                    + rect.Y
                    - ControlPanel.Height - 20;
                if (y < 0)
                {//上にも余白がないので、 Y = 0 の位置に出す
                    y = 0;
                }
            }
            return(y);
        }
예제 #4
0
        void ShowFloatingControlpanel()
        {
            int index = this.Script.SelectedIndex;

            if (index < 0 || index >= this.ProcsScript.Count)
            {//一件もない
                this.ASMTextBox.Text     = "";
                this.ScriptCodeName.Text = "";
                this.CommentTextBox.Text = "";
                this.AddressTextBox.Text = "";
                OneLineDisassembler();
            }
            else
            {
                EventScript.OneCode code = this.ProcsScript[index];

                //コードを書く
                this.ASMTextBox.Text     = U.convertByteToStringDump(code.ByteData);
                this.ScriptCodeName.Text = EventScript.makeCommandComboText(code.Script, false);
                this.CommentTextBox.Text = code.Comment;
                this.AddressTextBox.Text = U.ToHexString(EventScript.ConvertSelectedToAddr((uint)this.Address.Value, index, this.ProcsScript));

                //Eventをデコードして、引数等を求めなおす.
                OneLineDisassembler();
            }
            //変更ボタンが光っていたら、それをやめさせる.
            InputFormRef.WriteButtonToYellow(this.UpdateButton, false);
            InputFormRef.WriteButtonToYellow(this.NewButton, false);

            ControlPanel.Show();
        }
예제 #5
0
        private void UpdateButton_Click(object sender, EventArgs e)
        {
            InputFormRef.WriteButtonToYellow(this.AllWriteButton, true);
            PushUndo();

            if (this.Script.SelectedIndex < 0 || this.Script.SelectedIndex >= this.ProcsScript.Count)
            {//追加で処理する.
                NewButton.PerformClick();
                return;
            }
            OneLineDisassembler();

            //文字列からバイト列に
            byte[] selectedByteData = U.convertStringDumpToByte(this.ASMTextBox.Text);

            //バイト列をイベント命令としてDisassembler.
            EventScript.OneCode code = Program.ProcsScript.DisAseemble(selectedByteData, 0);
            code.Comment = this.CommentTextBox.Text;

            //選択されているコードを入れ替える.
            this.ProcsScript[this.Script.SelectedIndex] = code;

            //最後に自下げ処理実行.
            EventScriptUtil.JisageReorder(this.ProcsScript);
            //リストの更新.
            this.Script.DummyAlloc(this.ProcsScript.Count, -1);

            HideFloatingControlpanel();
        }
예제 #6
0
        private string EventToTextOne(int number)
        {
            StringBuilder sb = new StringBuilder();

            EventScript.OneCode code = this.ProcsScript[number];
            return(EventScriptInnerControl.EventToTextOne(code));
        }
예제 #7
0
 private Size Draw(ListBox lb, int index, Graphics g, Rectangle listbounds, bool isWithDraw)
 {
     if (index < 0 || index >= this.ProcsScript.Count)
     {
         return(new Size(listbounds.X, listbounds.Y));
     }
     EventScript.OneCode code = this.ProcsScript[index];
     return(EventScriptForm.DrawCode(lb, g, listbounds, isWithDraw, code));
 }
예제 #8
0
        private void OneLineDisassembler()
        {
            int i;

            if (this.ASMTextBox.Text.Length < 8)
            {//命令は最低でも8バイトでないとダメ.
                for (i = this.ASMTextBox.Text.Length; i < 8; i++)
                {
                    this.ASMTextBox.Text += "0";
                }
            }

            //文字列からバイト列に
            byte[] selectedByteData = U.convertStringDumpToByte(this.ASMTextBox.Text);
            if (selectedByteData.Length < 4)
            {
                return;
            }
            string hint = this.ScriptCodeName.Text;

            //バイト列をイベント命令としてDisassembler.
            EventScript.OneCode code = Program.ProcsScript.DisAseemble(selectedByteData, 0, hint);

            //命令を選択.
            this.ScriptCodeName.Text = EventScript.makeCommandComboText(code.Script, false);

            //引数
            int n = 0;

            for (i = 0; i < 2; i++, n++)
            {
                if (n >= code.Script.Args.Length)
                {
                    break;
                }
                EventScript.Arg arg = code.Script.Args[n];
                uint            v   = EventScript.GetArgValue(code, arg);

                if (EventScript.IsFixedArg(arg))
                {//固定長になっているところは入力できないようにする.
                    i--;
                    continue;
                }

                EventScriptForm.SetOneScriptEditSetTables(ScriptEditSetTables[i], arg, v);
            }

            for (; i < 2; i++)
            {
                //使わないパラメータはあっかりーんする
                EventScriptForm.HideOneScriptEditSetTables(ScriptEditSetTables[i]);
            }
            int y = ShowFloatingControlpanelInner(code, this.Script.SelectedIndex);

            ControlPanel.Location = new Point(ControlPanel.Location.X, y);
        }
예제 #9
0
 public static uint GetScriptLabelID(EventScript.OneCode code)
 {
     for (int i = 0; i < code.Script.Args.Length; i++)
     {
         EventScript.Arg arg = code.Script.Args[i];
         if (arg.Type == EventScript.ArgType.LABEL_CONDITIONAL)
         {
             uint v = EventScript.GetArgValue(code, arg);
             return(v);
         }
     }
     return(U.NOT_FOUND);
 }
예제 #10
0
        public void UpdateCode(uint startAddr, uint oldSize, List <EventScript.OneCode> codes)
        {
            uint addr = startAddr;

            for (int i = 0; i < codes.Count; i++)
            {
                EventScript.OneCode code = codes[i];
                string old;
                if (Cache.TryGetValue(addr, out old))
                {
                    if (old != code.Comment)
                    {
                        Cache[addr] = code.Comment;
                    }
                }
                else
                {
                    if (code.Comment != "")
                    {
                        Cache[addr] = code.Comment;
                    }
                }

                uint newAddr = addr + (uint)code.ByteData.Length;
                if (addr < newAddr)
                {
                    addr++;
                    for (; addr < newAddr; addr++)
                    {
                        if (Cache.TryGetValue(addr, out old))
                        {
                            if (old == "")
                            {
                                continue;
                            }
                            Cache.Remove(addr);
                        }
                    }
                }
            }

            uint endAddr = startAddr + oldSize;

            for ( ; addr < endAddr; addr++)
            {
                if (Cache.ContainsKey(addr))
                {
                    Cache.Remove(addr);
                }
            }
        }
예제 #11
0
 static uint GetScriptConditionalID(EventScript.OneCode code)
 {
     for (int i = 0; i < code.Script.Args.Length; i++)
     {
         EventScript.Arg arg = code.Script.Args[i];
         if (arg.Type == EventScript.ArgType.IF_CONDITIONAL ||
             arg.Type == EventScript.ArgType.GOTO_CONDITIONAL)
         {
             uint v = EventScript.GetArgValue(code, arg);
             return(v);
         }
     }
     return(U.NOT_FOUND);
 }
예제 #12
0
        void LoadCodes(EventTemplate et)
        {
            this.Codes = new List <EventScript.OneCode>();

            string fullfilename = Path.Combine(Program.BaseDirectory, "config", "data", et.Filename);

            if (!File.Exists(fullfilename))
            {
                return;
            }

            string XXXXXXXX = null;
            string YYYYYYYY = null;

            if (et.Filename.IndexOf("template_event_CALL_END_EVENT") >= 0)
            {
                XXXXXXXX = ToPointerToString(EventCondForm.GetEndEvent(this.MapID));
            }
            else if (et.Filename.IndexOf("template_event_PREPARATION") >= 0)
            {
                XXXXXXXX = ToPointerToString(EventCondForm.GetPlayerUnits(this.MapID));
                YYYYYYYY = ToPointerToString(EventCondForm.GetEnemyUnits(this.MapID));
            }
            else if (et.Filename.IndexOf("_COND_") >= 0)
            {
                uint labelX = GetUnuseLabelID(0x9000);
                XXXXXXXX = ToUShortToString(labelX);

                uint labelY = GetUnuseLabelID(labelX + 1);
                YYYYYYYY = ToUShortToString(labelY);
            }


            byte[] bin = EventScriptInnerControl.ConverteventTextToBin(fullfilename
                                                                       , EventScriptInnerControl.TermCode.NoTerm
                                                                       , XXXXXXXX, YYYYYYYY);
            uint addr  = 0;
            uint limit = (uint)bin.Length;

            while (addr < limit)
            {
                EventScript.OneCode code = Program.EventScript.DisAseemble(bin, addr);
                this.Codes.Add(code);
                addr += (uint)code.Script.Size;
            }
            this.SampleEventListbox.DummyAlloc(this.Codes.Count, 0);
        }
예제 #13
0
        private void N_ReloadListButton_Click(object sender, EventArgs e)
        {
            this.ProcsScript.Clear();

            uint addr = (uint)this.Address.Value;

            addr = U.toOffset(addr);

            if (sender == null ||
                this.N_ReadCount.Value == 0)
            {
                if (U.isSafetyOffset(addr))
                {
                    uint length = CalcLength(addr);
                    U.ForceUpdate(this.N_ReadCount, length);
                }
                else
                {
                    U.ForceUpdate(this.N_ReadCount, 0);
                }
            }

            //変更通知.
            if (Navigation != null)
            {
                NavigationEventArgs arg = new NavigationEventArgs();
                arg.Address = addr;
                Navigation(this, arg);
            }

            uint bytecount = (uint)this.N_ReadCount.Value;
            uint limit     = Math.Min(addr + bytecount, (uint)Program.ROM.Data.Length);

            while (addr < limit)
            {
                EventScript.OneCode code = Program.ProcsScript.DisAseemble(Program.ROM.Data, addr);
                this.ProcsScript.Add(code);
                addr += (uint)code.Script.Size;
            }
            //最後に自下げ処理実行.
            EventScriptUtil.JisageReorder(this.ProcsScript);
            //リストの更新.
            this.Script.DummyAlloc(this.ProcsScript.Count, -1);
        }
예제 #14
0
        private void NewButton_Click(object sender, EventArgs e)
        {
            if (this.ProcsScript == null)
            {
                return;
            }
            InputFormRef.WriteButtonToYellow(this.AllWriteButton, true);
            PushUndo();

            OneLineDisassembler();

            //文字列からバイト列に
            byte[] selectedByteData = U.convertStringDumpToByte(this.ASMTextBox.Text);

            //バイト列をイベント命令としてDisassembler.
            EventScript.OneCode code = Program.ProcsScript.DisAseemble(selectedByteData, 0);
            code.Comment = this.CommentTextBox.Text;

            int selected;

            //選択されている部分に追加
            if (this.Script.SelectedIndex < 0)
            {
                this.ProcsScript.Add(code);
                selected = this.ProcsScript.Count - 1;
            }
            else
            {
                this.ProcsScript.Insert(this.Script.SelectedIndex + 1, code);
                selected = this.Script.SelectedIndex + 1;
            }

            //最後に自下げ処理実行.
            EventScriptUtil.JisageReorder(this.ProcsScript);
            //リストの更新.
            this.Script.DummyAlloc(this.ProcsScript.Count, selected);

            //コントロールパネルを閉じる.
            HideFloatingControlpanel();
        }
예제 #15
0
 static uint GetScriptSomeLabel(EventScript.OneCode code)
 {
     if (code.Script.Has == EventScript.ScriptHas.LABEL_CONDITIONAL ||
         code.Script.Has == EventScript.ScriptHas.IF_CONDITIONAL ||
         code.Script.Has == EventScript.ScriptHas.GOTO_CONDITIONAL
         )
     {
         for (int i = 0; i < code.Script.Args.Length; i++)
         {
             EventScript.Arg arg = code.Script.Args[i];
             if (arg.Type == EventScript.ArgType.LABEL_CONDITIONAL ||
                 arg.Type == EventScript.ArgType.IF_CONDITIONAL ||
                 arg.Type == EventScript.ArgType.GOTO_CONDITIONAL
                 )
             {
                 uint v = EventScript.GetArgValue(code, arg);
                 return(v);
             }
         }
     }
     return(U.NOT_FOUND);
 }
예제 #16
0
        public static void UpdateRelatedLine(ListBoxEx addressList, List <EventScript.OneCode> eventAsm)
        {
            addressList.ClearAllSetRelatedLine();

            int index = addressList.SelectedIndex;

            if (index < 0)
            {
                return;
            }
            if (index >= eventAsm.Count)
            {
                return;
            }
            EventScript.OneCode current = eventAsm[index];
            uint needLabelID            = GetScriptSomeLabel(current);

            if (needLabelID == U.NOT_FOUND)
            {
                return;
            }

            for (int i = 0; i < eventAsm.Count; i++)
            {
                if (i == index)
                {//自分自身を調べても意味がない
                    continue;
                }
                EventScript.OneCode code = eventAsm[i];
                uint labelID             = GetScriptSomeLabel(code);
                if (labelID == needLabelID)
                {
                    addressList.SetRelatedLine(i);
                }
            }
        }
예제 #17
0
        public Size Draw(ListBox lb, int index, Graphics g, Rectangle listbounds, bool isWithDraw)
        {
            if (index < 0 || index >= lb.Items.Count)
            {
                return(new Size(listbounds.X, listbounds.Y));
            }
            SolidBrush brush            = new SolidBrush(lb.ForeColor);
            SolidBrush foreKeywordBrush = new SolidBrush(OptionForm.Color_Keyword_ForeColor());
            Font       normalFont       = lb.Font;
            Font       boldFont         = new Font(lb.Font, FontStyle.Bold);
            Rectangle  bounds           = listbounds;
            int        lineHeight       = normalFont.Height;

            UseFlagID current = this.FlagList[index];
            string    text;
            int       maxWidth = 0;

            if (index == 0 || current.ID != this.FlagList[index - 1].ID)
            {     //フラグ名を描画
                if (index != 0)
                { //空行を入れる
                    bounds.Y += lineHeight;
                }

                //フラグのアイコンを描画
                Bitmap bitmap = ImageSystemIconForm.FlagIcon();
                U.MakeTransparent(bitmap);

                Rectangle b = bounds;
                b.Width   = lineHeight;
                b.Height  = lineHeight;
                bounds.X += U.DrawPicture(bitmap, g, isWithDraw, b);
                bitmap.Dispose();

                //フラグ名を書く
                string dummy;
                text      = ":";
                bounds.X += U.DrawText(text, g, normalFont, brush, isWithDraw, bounds);

                text      = U.ToHexString(current.ID);
                bounds.X += U.DrawText(text, g, boldFont, brush, isWithDraw, bounds);

                text      = "  " + InputFormRef.GetFlagName(current.ID, out dummy);
                bounds.X += U.DrawText(text, g, normalFont, brush, isWithDraw, bounds);

                //次の行へ
                maxWidth  = bounds.X;
                bounds.Y += lineHeight;
                bounds.X  = listbounds.X;
            }

            //名称の表示
            bounds.X += 10;
            text      = MainSimpleMenuEventErrorForm.TypeToString(current.DataType, current.Addr, current.Tag);
            bounds.X += U.DrawText(text, g, boldFont, foreKeywordBrush, isWithDraw, bounds);

            //次の行へ
            maxWidth  = Math.Max(bounds.X, maxWidth);
            bounds.Y += lineHeight;
            bounds.X  = listbounds.X;

            //情報を書く.
            bounds.X += 6;
            text      = current.Info;

            Size ss;

            if (current.DataType == FELint.Type.BATTTLE_TALK || current.DataType == FELint.Type.HAIKU)
            {
                ss = DrawUnitAllowToAllow(text, lb, g, bounds, isWithDraw);
            }
            else if (current.DataType == FELint.Type.EVENT_COND_ALWAYS)
            {
                ss = EventCondForm.DrawEventListAlwaysOneLiner(current.Addr, lb, g, bounds, isWithDraw);
            }
            else if (current.DataType == FELint.Type.EVENT_COND_OBJECT)
            {
                ss = EventCondForm.DrawEventListObjectOneLiner(current.Addr, lb, g, bounds, isWithDraw);
            }
            else if (current.DataType == FELint.Type.EVENT_COND_TALK)
            {
                ss = EventCondForm.DrawEventListTalkOneLiner(current.Addr, lb, g, bounds, isWithDraw);
            }
            else if (current.DataType == FELint.Type.EVENT_COND_TURN)
            {
                ss = EventCondForm.DrawEventListTurnOneLiner(current.Addr, lb, g, bounds, isWithDraw);
            }
            else if (current.DataType == FELint.Type.EVENTSCRIPT)
            {
                EventScript.OneCode code = Program.EventScript.DisAseemble(Program.ROM.Data, current.Tag);
                ss = EventScriptForm.DrawCode(lb, g, bounds, isWithDraw, code);
            }
            else
            {
                bounds.X += U.DrawText(text, g, normalFont, brush, isWithDraw, bounds);
                bounds.Y += lineHeight;
                ss        = new Size(bounds.X, bounds.Y);
            }
            bounds.X = ss.Width;
            bounds.Y = ss.Height;

            brush.Dispose();
            foreKeywordBrush.Dispose();

            //最後の改行
            maxWidth = Math.Max(bounds.X, maxWidth);
            return(new Size(maxWidth, bounds.Y));
        }
        private string EventToTextOne(int number)
        {
            StringBuilder sb = new StringBuilder();

            EventScript.OneCode code = this.ProcsScript[number];
            for (int n = 0; n < code.ByteData.Length; n++)
            {
                sb.Append(U.ToHexString(code.ByteData[n]));
            }
            sb.Append("\t//");

            //スクリプト名.
            sb.Append(code.Script.Info[0]);

            for (int i = 1; i < code.Script.Info.Length; i += 2)
            {
                char symbol = ' ';
                if (code.Script.Info[i].Length > 2)
                {// [X みたいな文字列が入る. 2文字目のXが シンボル名.
                    symbol = code.Script.Info[i][1];
                }

                for (int n = 0; n < code.Script.Args.Length; n++)
                {
                    EventScript.Arg arg = code.Script.Args[n];
                    if (EventScript.IsFixedArg(arg))
                    {
                        continue;
                    }
                    if (symbol != arg.Symbol)
                    {
                        continue;
                    }

                    sb.Append("[");

                    uint   v;
                    string hexstring = EventScript.GetArg(code, n, out v);
                    sb.Append(arg.Name);
                    sb.Append(":");

                    sb.Append(hexstring);

                    if (arg.Type == EventScript.ArgType.TEXT ||
                        arg.Type == EventScript.ArgType.CONVERSATION_TEXT ||
                        arg.Type == EventScript.ArgType.SYSTEM_TEXT ||
                        arg.Type == EventScript.ArgType.ONELINE_TEXT ||
                        arg.Type == EventScript.ArgType.POINTER_TEXT
                        )
                    {
                        sb.Append(" ");
                        string text = TextForm.DirectAndStripAllCode((v));
                        if (text.Length > 30)
                        {//長いテキストは省略
                            sb.Append(U.escape_return(U.strimwidth(text, 0, 20)));
                        }
                        else
                        {//長くないテキストはすぐ横に表示
                            sb.Append(U.escape_return(text));
                        }
                    }
                    else if (arg.Type == EventScript.ArgType.UNIT)
                    {
                        sb.Append(" ");
                        sb.Append(UnitForm.GetUnitName(v));
                    }
                    else if (arg.Type == EventScript.ArgType.CLASS)
                    {
                        sb.Append(" ");
                        sb.Append(ClassForm.GetClassName(v));
                    }
                    else if (arg.Type == EventScript.ArgType.POINTER_PROCS)
                    {
                        sb.Append(" ");
                        string dummy;
                        sb.Append(Program.AsmMapFileAsmCache.GetASMName(v, true, out dummy));
                    }
                    else if (arg.Type == EventScript.ArgType.POINTER_ASM)
                    {
                        sb.Append(" ");
                        string dummy;
                        sb.Append(Program.AsmMapFileAsmCache.GetASMName(v, false, out dummy));
                    }
                    else if (arg.Type == EventScript.ArgType.FSEC)
                    {//FSEC
                        sb.Append(" ");
                        sb.Append(InputFormRef.GetFSEC(v));
                    }
                    sb.Append("]");
                    break;
                }
            }
            sb.AppendLine("");

            return(sb.ToString());
        }
예제 #19
0
        bool Get_Select_ParamSrc_Object(object sender
                                        , out EventScript.OneCode outCode //編集しているコード
                                        , out int outSelectID             //選択されたNumboxのindex(label等に関連づく)
                                        , out int outArg                  //引数の数(FIxed等非表示の引数があるので調べる)
                                        )
        {
            outCode     = null;
            outSelectID = 0;
            outArg      = 0;
            if (this.Script.SelectedIndex < 0 || this.Script.SelectedIndex >= this.ProcsScript.Count)
            {
                return(false);
            }

            //文字列からバイト列に
            byte[] selectedByteData = U.convertStringDumpToByte(this.ASMTextBox.Text);
            string hint             = this.ScriptCodeName.Text;

            //バイト列をイベント命令としてDisassembler.
            EventScript.OneCode code = Program.ProcsScript.DisAseemble(selectedByteData, 0, hint);

            Control senderobject = ((Control)sender);

            int selectID = (int)U.atoi(senderobject.Name.Substring("ParamSrc".Length));

            if (selectID <= 0)
            {
                selectID = (int)U.atoi(senderobject.Name.Substring("ParamLabel".Length));
                if (selectID <= 0)
                {
                    selectID = (int)U.atoi(senderobject.Name.Substring("ParamImage".Length));
                    if (selectID <= 0)
                    {
                        return(false);
                    }
                }
            }
            selectID = selectID - 1;
            EventScript.Arg arg;
            int             i = 0;
            int             n = 0;

            for (; i < code.Script.Args.Length; i++)
            {
                arg = code.Script.Args[i];
                if (EventScript.IsFixedArg(arg))
                {//固定長になっているところは入力できないようにする.
                    continue;
                }
                if (n < selectID)
                {
                    n++;
                    continue;
                }
                break;
            }

            if (i >= code.Script.Args.Length)
            {
                return(false);
            }
            outCode     = code;     //編集しているコード
            outSelectID = selectID; //選択されたNumboxのindex(label等に関連づく)
            outArg      = i;        //引数の数(FIxed等非表示の引数があるので調べる)
            return(true);
        }