我不能让这个回报一个好的价值。请帮忙! C编程MUD [英] I cannot get this to return a good value. Please help! C programming MUD

查看:75
本文介绍了我不能让这个回报一个好的价值。请帮忙! C编程MUD的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  else   if ((GET_OBJ_TYPE(cont)!= ITEM_CONTAINER )||(GET_OBJ_TYPE(续)!= ITEM_TABLE))
act( $ p不是容器或者表。,FALSE,ch,cont, 0 ,TO_CHAR);





我尝试了什么:



一切。我不知道在哪里放括号来为项目返回一个好的值

解决方案

p不是容器或表。,FALSE,ch ,cont, 0 ,TO_CHAR);





我是什么尝试过:



所有。我不知道在哪里放括号来为项目返回一个好的值
< blockquote>它不是括号:||是OR,所以你说相当于

如果A不是B或A不是C那么这样做

如果A是B,那么第一次测试失败,然后传递第二次测试。

如果A是C,那么它通过第一次测试而第二次测试失败。 br />
如果A是D,那么它会通过第一次和第二次测试。

或者说如果其中一种是真的,总数是真的

所以在所有情况下,它至少传递一个测试并执行 act 代码。

你需要的是AND,而不是OR:

  else   if ((GET_OBJ_TYPE(cont)!= ITEM_CONTAINER)&& (GET_OBJ_TYPE(续)!= ITEM_TABLE))
act(


< blockquote> p不是容器或表。,FALSE,ch,cont, 0 ,TO_CHAR);



AND说如果两者都是真的,则总数为真


else if ((GET_OBJ_TYPE(cont) !=  ITEM_CONTAINER) || (GET_OBJ_TYPE(cont) != ITEM_TABLE))
    act("$p is not a container or table.", FALSE, ch, cont, 0, TO_CHAR);



What I have tried:

everything. im not sure where to put the brackets to return a good value for the item

解决方案

p is not a container or table.", FALSE, ch, cont, 0, TO_CHAR);



What I have tried:

everything. im not sure where to put the brackets to return a good value for the item


It's not brackets: || is OR, so you are saying the equivalent of

If A isn't B OR A isn't C then Do this

If A is a B, then it fails the first test, and passes the second.
If A is a C, then it passes the first test and fails the second.
if A is a D, then it passes the first and the second tests.
OR says "If either is true, the total is true"
So in all cases, it passes at least one test and executes the act code.
What you need is AND, not OR:

else if ((GET_OBJ_TYPE(cont) !=  ITEM_CONTAINER) && (GET_OBJ_TYPE(cont) != ITEM_TABLE))
    act("


p is not a container or table.", FALSE, ch, cont, 0, TO_CHAR);


AND says "If both are true, the total is true"


这篇关于我不能让这个回报一个好的价值。请帮忙! C编程MUD的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆