完整代码
[@Message_100]
#act
; 获取到发送过来的用户名字,赋值给自定义变量
mov S$收到特殊交易玩家 <$CUSTMSGPARAM>
mov S$发起特殊交易玩家 <$username>
; 背包获取
mov S$物品数据
mov S$物品数量
mov S$新物品唯一
mov N$左侧物品ID
mov N$数量flag 0
while N$数量flag < 49
inc N$数量flag 1
mov S$物品ID_<$str(N$数量flag)>
mov S$物品数量_<$str(N$数量flag)>
mov S$物品唯一序号_<$str(N$数量flag)>
endwhile
LoopBagItems @获取当前背包所有物品 N$物品唯一ID S$物品的名称 N$物品的数量 N$绑定状态
GETVALIDSTRSUPER <$str(S$物品数据)> , S$物品ID_
GETVALIDSTRSUPER <$str(S$物品数量)> , S$物品数量_
GETVALIDSTRSUPER <$STR(S$新物品唯一)> , S$物品唯一序号_
;补全物品
mov N$数量flag 0
while N$数量flag < 49
inc N$数量flag 1
mov N$物品ID_<$str(N$数量flag)> <$str(S$物品ID_<$str(N$数量flag)>)>
mov N$物品数量_<$str(N$数量flag)> <$str(S$物品数量_<$str(N$数量flag)>)>
mov N$物品唯一序号_<$str(N$数量flag)> <$str(S$物品唯一序号_<$str(N$数量flag)>)>
endwhile
goto @打开特殊交易面板
[@打开特殊交易面板]
#act
;基础背包XY
mov N$基础背包X 346
mov N$基础背包Y 98
; 基础背包语句
mov S$基础背包 <ItemShow|x=<$str(N$基础背包X)>|y=<$str(N$基础背包Y)>|width=70|height=70|itemid=<$str(N$物品ID_1)>|itemcount=<$str(N$物品数量_1)>|bgtype=1|link=@点击物品#物品参数=<$str(N$物品ID_1)>#物品数量=<$str(N$物品数量_1)>#物品序号ID=<$str(N$物品唯一序号_1)>>
mov N$基础背包总数 0
mov N$基础背包层数 0
mov N$递归背包X 346
mov N$递归背包Y 98
mov n$flag 2
;补全行
while N$基础背包总数 < 6
formulation <$str(N$递归背包X)>+69 N$递归背包X
inc S$基础背包 <ItemShow|x=<$str(N$递归背包X)>|y=<$str(N$基础背包Y)>|width=70|height=70|itemid=<$str(N$物品ID_<$str(n$flag)>)>|itemcount=<$str(N$物品数量_<$str(n$flag)>)>|bgtype=1|link=@点击物品#物品参数=<$str(N$物品ID_<$str(n$flag)>)>#物品数量=<$str(N$物品数量_<$str(n$flag)>)>#物品序号ID=<$str(N$物品唯一序号_<$str(n$flag)>)>>
inc N$基础背包总数 1
inc n$flag 1
endwhile
mov N$flag1 9
mov N$flag2 10
mov N$flag3 11
mov N$flag4 12
mov N$flag5 13
mov N$flag6 14
; 补全列
while N$基础背包层数 < 6
mov N$x1 346
mov N$x2 415
mov N$x3 484
mov N$x4 553
mov N$x5 622
mov N$x6 691
formulation <$str(N$递归背包Y)>+69 N$递归背包Y
formulation <$str(N$x1)>+69 N$递归背包X1
formulation <$str(N$x2)>+69 N$递归背包X2
formulation <$str(N$x3)>+69 N$递归背包X3
formulation <$str(N$x4)>+69 N$递归背包X4
formulation <$str(N$x5)>+69 N$递归背包X5
formulation <$str(N$x6)>+69 N$递归背包X6
inc S$基础背包 <ItemShow|x=<$str(N$基础背包X)>|y=<$str(N$递归背包Y)>|width=70|height=70|itemid=<$str(N$物品ID_<$str(n$flag)>)>|itemcount=<$str(N$物品数量_<$str(n$flag)>)>|bgtype=1|link=@点击物品#物品参数=<$str(N$物品ID_<$str(n$flag)>)>#物品数量=<$str(N$物品数量_<$str(n$flag)>)>#物品序号ID=<$str(N$物品唯一序号_<$str(n$flag)>)>>
inc S$基础背包 <ItemShow|x=<$str(N$递归背包X1)>|y=<$str(N$递归背包Y)>|width=70|height=70|itemid=<$str(N$物品ID_<$str(n$flag1)>)>|itemcount=<$str(N$物品数量_<$str(n$flag1)>)>|bgtype=1|link=@点击物品#物品参数=<$str(N$物品ID_<$str(n$flag1)>)>#物品数量=<$str(N$物品数量_<$str(n$flag1)>)>#物品序号ID=<$str(N$物品唯一序号_<$str(n$flag1)>)>>
inc S$基础背包 <ItemShow|x=<$str(N$递归背包X2)>|y=<$str(N$递归背包Y)>|width=70|height=70|itemid=<$str(N$物品ID_<$str(n$flag2)>)>|itemcount=<$str(N$物品数量_<$str(n$flag2)>)>|bgtype=1|link=@点击物品#物品参数=<$str(N$物品ID_<$str(n$flag2)>)>#物品数量=<$str(N$物品数量_<$str(n$flag2)>)>#物品序号ID=<$str(N$物品唯一序号_<$str(n$flag2)>)>>
inc S$基础背包 <ItemShow|x=<$str(N$递归背包X3)>|y=<$str(N$递归背包Y)>|width=70|height=70|itemid=<$str(N$物品ID_<$str(n$flag3)>)>|itemcount=<$str(N$物品数量_<$str(n$flag3)>)>|bgtype=1|link=@点击物品#物品参数=<$str(N$物品ID_<$str(n$flag3)>)>#物品数量=<$str(N$物品数量_<$str(n$flag3)>)>#物品序号ID=<$str(N$物品唯一序号_<$str(n$flag3)>)>>
inc S$基础背包 <ItemShow|x=<$str(N$递归背包X4)>|y=<$str(N$递归背包Y)>|width=70|height=70|itemid=<$str(N$物品ID_<$str(n$flag4)>)>|itemcount=<$str(N$物品数量_<$str(n$flag4)>)>|bgtype=1|link=@点击物品#物品参数=<$str(N$物品ID_<$str(n$flag4)>)>#物品数量=<$str(N$物品数量_<$str(n$flag4)>)>#物品序号ID=<$str(N$物品唯一序号_<$str(n$flag4)>)>>
inc S$基础背包 <ItemShow|x=<$str(N$递归背包X5)>|y=<$str(N$递归背包Y)>|width=70|height=70|itemid=<$str(N$物品ID_<$str(n$flag5)>)>|itemcount=<$str(N$物品数量_<$str(n$flag5)>)>|bgtype=1|link=@点击物品#物品参数=<$str(N$物品ID_<$str(n$flag5)>)>#物品数量=<$str(N$物品数量_<$str(n$flag5)>)>#物品序号ID=<$str(N$物品唯一序号_<$str(n$flag5)>)>>
inc S$基础背包 <ItemShow|x=<$str(N$递归背包X6)>|y=<$str(N$递归背包Y)>|width=70|height=70|itemid=<$str(N$物品ID_<$str(n$flag6)>)>|itemcount=<$str(N$物品数量_<$str(n$flag6)>)>|bgtype=1|link=@点击物品#物品参数=<$str(N$物品ID_<$str(n$flag6)>)>#物品数量=<$str(N$物品数量_<$str(n$flag6)>)>#物品序号ID=<$str(N$物品唯一序号_<$str(n$flag6)>)>>
inc N$基础背包层数 1
inc n$flag 7
inc N$flag1 7
inc N$flag2 7
inc N$flag3 7
inc N$flag4 7
inc N$flag5 7
inc N$flag6 7
endwhile
; 打开特殊交易面板
#say
<Layout|x=346.0|y=68.0|width=80|height=80|link=@exit>
<Img|x=37.0|y=137.0|width=300|height=300|loadDelay=1|reset=1|img=public/bg_cjbxzy_01.png|show=0|esc=1|move=0|bg=1>
<Text|x=95.0|y=184|size=18|color=255|text=请放入需要交易的物品>
<Button|x=126.0|y=340|size=18|color=255|nimg=public/00000365.png|link=@确定特殊交易#当前选择物品唯一ID=<$str(N$当前选择物品ID)>>
<Img|x=334.0|y=83.0|width=500|height=500|rotate=0|scale9l=20|esc=0|scale9b=20|scale9r=20|img=public/1900000602.png|scale9t=20>
<Button|x=820.0|y=63.0|nimg=public/1900000510.png|pimg=public/1900000511.png|link=@exit>
<$str(S$基础背包)>
<ITEMBOX|x=147.0|y=237.0|width=70|height=70|boxindex=0|stdmode=*|img=public/1900000651_4.png>
<ItemShow|ax=0|x=147|y=239.0|width=70|height=70|itemid=<$str(N$左侧物品ID)>|itemcount=1|showtips=1|bgtype=0>
; 获取当前背包所有物品
[@获取当前背包所有物品]
#ACT
getitembindinfo <$STR(N$物品唯一ID)> N$绑定状态
#if
equal N$绑定状态 0
#act
GetDBItemFieldValue <$STR(S$物品的名称)> idx S$物品IDX
inc S$物品数据 <$str(S$物品IDX)>,
inc S$物品数量 <$str(N$物品的数量)>,
inc S$新物品唯一 <$str(N$物品唯一ID)>,
; 点击物品提示
[@点击物品]
#if
large <$str(S$物品参数)> 0
#act
; 添加物品到左边框里面
mov N$左侧物品ID <$str(S$物品参数)>
mov N$当前选择物品ID <$str(S$物品序号ID)>
sethumvar <$str(S$收到特殊交易玩家)> n$左侧物品ID <$str(N$左侧物品ID)>
sethumvar <$str(S$收到特殊交易玩家)> S$物品数量 <$str(S$物品数量)>
goto @打开特殊交易面板
<$str(S$收到特殊交易玩家)>.goto @接收玩家界面
[@确定特殊交易]
#if
equal S$物品参数 0
#act
sendmsg 9 未选择物品!
break
#if
equal S$物品数量 0
#act
sendmsg 9 无法获得物品数量!
break
#if
equal S$收到特殊交易玩家
#act
sendmsg 9 无法获取玩家名称!
break
#if
#act
sethumvar <$str(S$收到特殊交易玩家)> n$左侧物品ID <$str(N$左侧物品ID)>
sethumvar <$str(S$收到特殊交易玩家)> S$物品数量 <$str(S$物品数量)>
getdbidxitemfieldvalue <$str(N$左侧物品ID)> NAME S$发送物品名称
sethumvar <$str(S$收到特殊交易玩家)> S$发送物品名称 <$str(S$发送物品名称)>
takes <$str(N$左侧物品ID)>#<$str(S$物品数量)> N$数量flag 1 1
<$str(S$收到特殊交易玩家)>.give <$str(S$发送物品名称)> <$str(S$物品数量)>
sendmsg 9 交易成功!
close
<$str(S$收到特殊交易玩家)>.close
<$str(S$收到特殊交易玩家)>.sendmsg 9 您通过特殊交易获得了<$str(S$发送物品名称)>*<$str(S$物品数量)>!
[@接收玩家界面]
#say
<Layout|x=346.0|y=68.0|width=80|height=80|link=@exit>
<Img|x=345.0|y=141.0|width=300|height=300|move=0|loadDelay=1|reset=1|show=0|img=public/bg_cjbxzy_01.png|esc=1|bg=1>
<Text|x=418.0|y=185.0|size=18|color=255|text=这是您交易到的物品>
<Button|x=442.0|y=343.0|size=18|color=255|nimg=public/00000365.png|link=@exit>
<ITEMBOX|x=460.0|y=241.0|width=70|height=70|boxindex=0|stdmode=*|img=public/1900000651_4.png>
<ItemShow|ax=0|x=463.0|y=242.0|width=70|height=70|itemid=<$str(N$左侧物品ID)>|itemcount=<$str(S$物品数量)>|showtips=1|bgtype=0>