请问大佬如果代码太长了是不是运行起来比较慢


  • 宗师

    写了个比较长的代码,运行起来没那么流畅



  • @老实人 按道理来说,代码长度应该跟流畅没关系,可以发出来看看


  • 宗师

    @Bob-cn

    #input ($repeat) = 重复次数,20
    #input ($name) = 角色名字,not
    #select ($boss) = 门派任务,宋远桥|清乐比丘|高根明|苏梦清|苏星河|左全,宋远桥
    #select ($gather) = 采集随从,丫鬟|小流氓|程灵素|黄蓉|小昭|韦春芳|无,无
    #select ($fish) = 钓鱼随从,丫鬟|小流氓|程灵素|黄蓉|小昭|韦春芳|无,无
    #select ($give_up) = 自动放弃,是|不,不
    #config
    ($num_1) = 0
    stopstate
    [while] (num_1) < (repeat)
        ($iden) = false
        [if] (boss) == 宋远桥
            jh fam 1 start;go north
        [if] (boss) == 苏梦清
            jh fam 4 start;go west
        [if] (boss) == 左全
            jh fam 6 start;go down
        [if] (boss) == 清乐比丘
            jh fam 2 start
        [if] (boss) == 高根明
            jh fam 3 start    
        [if] (boss) == 苏星河 
            jh fam 5 start
        task sm {r(boss)}
        task sm {r(boss)}
        @tip (boss)对你说道:我要的是($prop),你要是找不到就换别的吧。
        pack none
        ($num)=false
        [if] {b(prop)}? == null
            [if] (prop)==<wht>布衣</wht>||(prop)==<wht>钢刀</wht>||(prop)==<wht>木棍</wht>||(prop)==<wht>英雄巾</wht>||(prop)==<wht>布鞋</wht>||(prop)==<wht>铁戒指</wht>|| (prop)==<wht>簪子</wht>||(prop)==<wht>长鞭</wht>||(prop)==<wht>钓鱼竿</wht>||(prop)==<wht>鱼饵</wht>
                jh fam 0 start
                go east;go south
                list {r杨永福}
                @dialog
                buy 1 {d(prop)} from {r杨永福}
                ($num)=true
            [if] (prop)==<hig>金创药</hig>||(prop)==<hig>引气丹</hig>||(prop)==<hig>养精丹</hig>
                jh fam 0 start
                go east[2];go north
                list {r药铺老板 平一指%}
                @dialog
                buy 1 {d(prop)} from {r药铺老板 平一指%}
                ($num)=true
            [if] (prop)==<wht>铁剑</wht>||(prop)==<wht>钢刀</wht>||(prop)==<wht>铁棍</wht>||(prop)==<wht>铁杖</wht>||(prop)==<wht>飞镖</wht>
                jh fam 0 start
                go east[2];go south
                list {r铁匠铺老板 铁匠%}
                @dialog
                buy 1 {d(prop)} from {r铁匠铺老板 铁匠%} 
                ($num)=true
            [if] (prop)==<wht>米饭</wht>||(prop)==<wht>包子</wht>||(prop)==<wht>鸡腿</wht>||(prop)==<wht>面条</wht>||(prop)==<wht>扬州炒饭</wht>||(prop)==<wht>米酒</wht>||(prop)==<wht>花雕酒</wht>||(prop)==<wht>女儿红</wht>||(prop)==<hig>醉仙酿 </hig>||(prop)==<hiy>神仙醉</hiy>
                jh fam 0 start
                go north[2];go east
                list {r店小二}
                @dialog
                buy 1 {d(prop)} from {r店小二}
                ($num)=true
            [if] (num)==false
                jh fam 0 start
                go west[2];go north;go enter
                go north
                store
                @dialog
                ($got) = false
                [if] {d(prop)}? != null
                    qu 1 {d(prop)}
                    ($got) = true
                [if] (got) == false
                    go south;go northeast
                    [if] (gather) != 无
                        dc {r(gather)} stopstate
                        pack {r(gather)}
                        @dialog
                        [if] {d(prop)}? != null
                            dc {r(gather)} give {r(name)} 1 {d(prop)}
                            ($got) = true
                        dc {r(gather)} cai
                    [if] (got) == false
                        [if] (fish) != 无
                            dc {r(fish)} stopstate
                            pack {r(fish)}
                            @dialog
                            [if] {d(prop)}? != null
                                dc {r(fish)} give {r(name)} 1 {d(prop)}
                                ($got) = true
                            dc {r(fish)} diao
        [if] (boss) == 宋远桥
            jh fam 1 start;go north
        [if] (boss) == 苏梦清
            jh fam 4 start;go west
        [if] (boss) == 左全
            jh fam 6 start;go down
        [if] (boss) == 清乐比丘
            jh fam 2 start
        [if] (boss) == 高根明
            jh fam 3 start    
        [if] (boss) == 苏星河 
            jh fam 5 start
        [if] {b(prop)}? != null    
            task sm {r(boss)}
            task sm {r(boss)} give {b(prop)}
            ($iden)=true
            ($num_1) = (num_1) + 1
        [if] {b(prop)}? == null && (give_up) == 是 && (iden) == false
            task sm {r(boss)}
            task sm {r(boss)} giveup 
    $zdwk
    
    复制上方代码

    大佬帮忙看下哪里出问题



  • @老实人 好 我看一下



  • @老实人 没发现不流畅呀,你是说执行的比较慢吗?


  • 宗师

    对,不及其他的



  • @老实人
    可以把系统指令合并到一行执行,用 ; 连接
    使用了id 占位符的如果需要前面的指令执行完才能得到的不要合并在一起
    比如

    go north;go west
    select {r张三}
    
    复制上方代码

登录后回复