A Strange Breakdown In Functionality Due To A Rule Checking A Table
This is a very strange occurrence that is screwing up my game. I was wondering if anyone else has seen anything like this. I am using 11.0.13.
So if you look at the picture, this rule isn't doing much. If the ScrollNumber is > than 0 AND if that tableCellValue is 0 it should make the actor visible and display text the price. Now it works perfectly fine if I remove the tableCellValue check. It works exactly how it should. As soon as I add this tableCellValue check it breaks down. On the game screen the actor no longer shows up, nor does the display text happen. Another odd thing that happens is another aspect of the code breaks down as well, but what is weird is it is something that is not even touched with this rule. (Basically the attribute ScrollNumber will go up to 6 even though in an entirely different actor it is limited to only 5. It works perfectly prior to adding this tableCellValue check rule in a completely unrelated actor). I have a Display Text that displays the exact same tableCellValue. This works perfectly fine. It shows the 0's and 1's in the table just as I would expect. It's just when it is checked in the rule that it ceases functioning properly.
So to sum it up.
*Works fine WITHOUT tableCellValue check in the rule
*Add tableCellValue check in rule, it no longer functions properly and breaks entirely unrelated code
*The whole time Display Text of tableCellValue works properly
I can't figure this out for the life of me. There is literally only one change taking place between working and broken. Adding the tableCellValue check. Anyone else seen anything like this before?
@CodeWizard @dgackey Have you seen this? If this isn't a known issue I'll open a support ticket.
Best Answers
-
gyroscope I am here.Posts: 6,598
Hi, I'll be honest, I didn't study your post too deeply, but I think I gleaned why your problem is. So try the following:
Put the tableCellValue into an attribute (
Change Attribute CellCheck to tableCellValue
, etc)Then in your Rule, make it:
Rule: When ScrollNumber is > than 0 AND CellCheck= 0
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
-
tatiang Posts: 11,949
I don't want to speak for @gyroscope but my understanding of this issue is that nesting expressions can cause problems. So something like tableCellValue(tableName,1,tableCellValue(otherTableName,1,1)) may not work as expected. Yours wasn't a nested expression but you did nest a look up within a rule condition... I guess it comes down to the speed of the processor to look up that data before processing whether the condition is true. Better sometimes to be safe and calculate the expression first before using it (as an attribute) within the rule condition.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Answers
Just a guess and it's probably not helpful but: having parentheses as part of your attribute name might be causing problems.
You're saying that if you use a Display Text behavior outside of any rules and duplicate the tableCellValue expression that's causing problems, it displays correctly?
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
@tatiang That was a good suggestion. Didn't even think of that as a potential problem. I changed the attributes and even went a step further and removed the #. Sadly, the exact same problem still occurs .
Yes exactly I have the Display Text outside of all rules displaying the exact same tableCellValue that is causing problems. It does display properly as expected.
@gyroscope Thanks that works, but shouldn't it have worked properly the other way still? All that was accomplishing was adding another step to the codes process. Reason I was trying to compare tables directly in the rule was to avoid excess and unnecessary steps when it could be simplified.
The other odd thing is I have already been using these rules checking tables directly in like 4 other actors in numerous spots. All of them have functioned as I intended. This is the only one that has given me these issues. Still wondering why it works sometimes, but on this particular one it doesn't.
(Just trying to cut out as much excess code as possible because this will be a very large project. Wanted to make it as concise as possible. Using that method involves using a Constrain Attribute which is just an excess and should be unnecessary addition.)
This working only proves again though that the problem must be the rules checking tables. Which is something that should be working.
@tatiang Sorry, but what do you mean by "nest a look up within a rule condition"? Are you referring to having the rule look up the table cell's value? I've done that plenty in projects as I thought that was supposed to be a benefit of using tables, and why they even include the "tableCellValue" function.
Oh well, I suppose I have no other choice but to use the work around. I appreciate both of you taking the time to help me out with this.
@FallacyStudios Hmm, yeah you're right, that is the point of having the numeric expression as an option on the left side of the rule. I'm probably over-thinking it. #mondaymorning
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
@tatiang Nah you are just trying to come up with an explanation for this misbehavior, which is what I was asking for anyways. I appreciate it. I was trying to make sure I didn't screw it up myself or use it in the wrong way. Spent a good portion of yesterday trying to figure out why this thing that should work perfectly fine in theory was not behaving properly and was even causing unrelated aspects to break. My current conclusion is it is the programs fault lol. Anyways thanks again for your help