发帖
 找回密码
 立即注册
搜索
首页历史版块_9Message Trigger 这东西怎么用?

Message Trigger 这东西怎么用?

5
回复
5
查看
[ 复制链接 ]

主题

0

回帖

12

积分

新手上路

积分
12
2011-5-24 19:38:22 显示全部楼层 阅读模式
第一步:
treenode item = parnode(1);
treenode current = ownerobject(c);
treenode source=node("/source",model());
int port = parval(2);
if(
        content(current)>=20
)
sendmessage(source,current,1,0,0);
return 1;
第二步:
/**Custom Code*/
treenode item = parnode(1);
treenode current = ownerobject(c);
treenode source=node("/source",model());
int port = parval(2);
if(
        content(current)<5
)
sendmessage(source,current,2,0,0);
return 5;
第三步:

/**Custom Code*/
treenode current = ownerobject(c);
unsingned int uservalue=(unsigned int) msgparam(1);
switch(uservalue){
        case 1:closeoutput(current);break;
        case 2:openoutput(current);break;
}
最后系统报错是第三步,说是没有定义uservalue:

line 3        unknown variable "unsingned"

line 3        syntax error, unexpected type identifier, expecting ';'
Could not finish parsing because of previous errors.

请问各位大大这是怎么一回事....

主题

0

回帖

111

积分

注册会员

积分
111
2011-5-26 14:18:40 显示全部楼层
应该是这样子的吧:
/**Custom Code*/
treenode current = ownerobject(c);
int uservalue= msgparam(1);
switch(uservalue)
{
        case 1:closeoutput(current);break;
        case 2:openoutput(current);break;
}
你试试,看看行不行

主题

0

回帖

12

积分

新手上路

积分
12
2011-5-26 14:52:25 楼主 显示全部楼层
[b] [url=http://www.flexsim.asia/redirect.php?goto=findpost&pid=2130&ptid=878]2#[/url] [i]atdmin[/i] [/b]


嗯,这样的话已经不报错了,就是功能还是无法完成...很奇怪

主题

0

回帖

111

积分

注册会员

积分
111
2011-5-27 09:35:56 显示全部楼层
你要的功能是这样子的吗:
第一步:(写在传送带或者缓存区的进入触发)
当当前实体上的临时实体个数大于或者等于20的时候,给发生器发送消息,并赋予第三步的uservalue值为1;
第二步:(写在传送带或者缓存区的离开触发)
当当前实体上的临时实体个数小于5的时候,给发生器发送消息,并赋予第三步的uservalue值为2;
第三步:(写在发生器的消息触发)
当uservalue值为1时,关闭发生器的输出端口;
当uservalue值为2时,打开发生器的输出端口;

     我也是新手,互相学习下!

主题

0

回帖

111

积分

注册会员

积分
111
2011-5-27 09:39:14 显示全部楼层
[b] [url=http://www.flexsim.asia/redirect.php?goto=findpost&pid=2131&ptid=878]3#[/url] [i]rightred[/i] [/b]

这是我建的模型,你可以看看,或许对你有用!

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x

主题

0

回帖

12

积分

新手上路

积分
12
2011-5-29 11:17:57 楼主 显示全部楼层
[b] [url=http://www.flexsim.asia/redirect.php?goto=findpost&pid=2134&ptid=878]5#[/url] [i]atdmin[/i] [/b]


嗯...是这样的。谢谢你的模型拉
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则