Posted by: RocketMan
« on: 24. January 2014, 17:43:51 »Since I have *FINALLY* been able to decipher the enigma that is quest bits (actually so far only qbset and qbfilter) by random experimentation, I thought I'd post my interpretation of how they work for like-minded people because for the life of me I couldn't understand the explanations that were already available. Call it a learning disability but it just didn't compute. So here goes:
Suppose you want to accomplish some sort of goal or mission in the game. Say you want to have a door open itself when you cross over a tripwire in the hallway leading to it AND ONLY IF a button has already been pressed, enabling this all to happen. In this case pressing the button is your mission! Shodan is being a bitch and she locked the door on you so you have to go on a mission to override the door lock using the super magic override button. Let's ignore the fact that this doesn't require the quest system to accomplish. If you like, think of the door being on a different level, as this would then require the quest system. Anyway, you want to have it so that you walk down a hallway, cross a tripwire in the hallway and then have the game decide whether to open the door or not based on whether a button has previously been pressed (say the button is a "MASTER DOOR LOCK OVERRIDE" or some such nonsense). To put this a different way, IF (Button Press == TRUE & Tripwire Activation == TRUE) THEN (Open door). This'd be kind of how you'd logically code such an event. Since this isn't yet how the quest system works, let's write it another way (just some shitty pseudo-code):
Button Press == 0;
Tripwire Activation == FALSE;
IF ((Button Press > 6) & (Tripwire Activation == TRUE))
THEN (Open Door)
So you see that we have some essential ingredients. We have 2 variable declarations, we have an IF/THEN conditional check and we have an action that results if the condition is true (if both conditions are true)
In ShockED there are entities which do the same job as each of these but I didn't know until now because they're somewhat camoflauged.
First of all your Button Press variable is basically a switchlink from "a button". If you don't click the button, it doesn't fire If you click the button, it fires. As for the tripwire, once again, if you don't cross it it won't fire (FALSE) and if you cross it, it will fire (TRUE). These OBJECTS in ShockED, the button and the tripwire are your variables. Your IF/THEN statement is a QB Filter. This is part of the quest system. The QB Filter, like an IF/THEN, compares 2 values to each other and if the comparision is TRUE, it executes an actiion. In the case of QB Filter, the only action it executes is to permit a signal to cross it. Therefore it is a bridge between 2 other objects that are trying to send and recieve a signal. You must create a link FROM the sending object (the tripwire) TO the QB Filter and then FROM the QB Filter TO the door. Now the QB Filter, unlike a generic IF/THEN statement seems to only be capable of checking if a variable is greater than a specified value. The variable it compares is defined in QB Set.
So let's back up and go back to the fact that we consider pressing a button to setting a variable TRUE. This is one of the prerequisites to allowing the door to open. in order to use the button as a variable, we have to create a QB Set object and then create a variable name (by adding the property QB Name) and also telling that variable what value to take when initialized (by adding the property QB Val). Since we want this variable to be TRUE when the button is pressed, we choose something greater than 6 in the above example, like 7 and put that in QB Val. Now we switchlink the button to the QB Set object and pressing the button will create a variable and assign the value 7 to it.
Now that we have configured the machinery to create a variable with the value 7, at the press of a button, we need to feed that into the IF/THEN statement (the QB Filter). So, as stated, make a switchlink from the tripwire to the QB Filter and from the QB Filter to the door. Now inside the QB Filter, create your conditional statement by adding QB Name and QB Val, QB Name being the same as the one in QB Set and QB Val being the number 6 because that's what we want to compare our variable to. Since our variable is 7, it's greater than 6 so this is TRUE and when we cross the tripwire, that will also fire TRUE thus satisfying both conditional requirements and permitting the switchlink to cross the filter and hit the door.
To summarize:
You want: IF A = TRUE and B = TRUE, THEN allow a signal to pass and do some shit
Here, A is some sort of mission, and B is some sort of triggering entity that does some shit
The label A is the QB Name property in QB Set
The value of A is the QB Val property in QB Set
There is no label for B, it's just an object that sends a signal like the tripwire above.
The value of B is going to be TRUE when you activate it and FALSE before that.
The value you want to compare A to is QB Val in QB Filter.
The comparison is always IF A > (the value in QB Filter) THEN don't block signals from linked objects
So you portalize and launch your level. You cross the tripwire. It fires a signal to the door but gets blocked by the QB Filter because the button hasn't been pressed. So you go back and press the button. The button fires TRUE to the QB Set and creates a variable "George" with value "7". Now you cross the switchlink again and the filter checks "Is George > 6?" "Yes it appears to be" "Ok you can pass a signal now" and the switchlink passes the filter and hits the door. The door opens. Shodan is very displeased.
Suppose you want to accomplish some sort of goal or mission in the game. Say you want to have a door open itself when you cross over a tripwire in the hallway leading to it AND ONLY IF a button has already been pressed, enabling this all to happen. In this case pressing the button is your mission! Shodan is being a bitch and she locked the door on you so you have to go on a mission to override the door lock using the super magic override button. Let's ignore the fact that this doesn't require the quest system to accomplish. If you like, think of the door being on a different level, as this would then require the quest system. Anyway, you want to have it so that you walk down a hallway, cross a tripwire in the hallway and then have the game decide whether to open the door or not based on whether a button has previously been pressed (say the button is a "MASTER DOOR LOCK OVERRIDE" or some such nonsense). To put this a different way, IF (Button Press == TRUE & Tripwire Activation == TRUE) THEN (Open door). This'd be kind of how you'd logically code such an event. Since this isn't yet how the quest system works, let's write it another way (just some shitty pseudo-code):
Button Press == 0;
Tripwire Activation == FALSE;
IF ((Button Press > 6) & (Tripwire Activation == TRUE))
THEN (Open Door)
So you see that we have some essential ingredients. We have 2 variable declarations, we have an IF/THEN conditional check and we have an action that results if the condition is true (if both conditions are true)
In ShockED there are entities which do the same job as each of these but I didn't know until now because they're somewhat camoflauged.
First of all your Button Press variable is basically a switchlink from "a button". If you don't click the button, it doesn't fire If you click the button, it fires. As for the tripwire, once again, if you don't cross it it won't fire (FALSE) and if you cross it, it will fire (TRUE). These OBJECTS in ShockED, the button and the tripwire are your variables. Your IF/THEN statement is a QB Filter. This is part of the quest system. The QB Filter, like an IF/THEN, compares 2 values to each other and if the comparision is TRUE, it executes an actiion. In the case of QB Filter, the only action it executes is to permit a signal to cross it. Therefore it is a bridge between 2 other objects that are trying to send and recieve a signal. You must create a link FROM the sending object (the tripwire) TO the QB Filter and then FROM the QB Filter TO the door. Now the QB Filter, unlike a generic IF/THEN statement seems to only be capable of checking if a variable is greater than a specified value. The variable it compares is defined in QB Set.
So let's back up and go back to the fact that we consider pressing a button to setting a variable TRUE. This is one of the prerequisites to allowing the door to open. in order to use the button as a variable, we have to create a QB Set object and then create a variable name (by adding the property QB Name) and also telling that variable what value to take when initialized (by adding the property QB Val). Since we want this variable to be TRUE when the button is pressed, we choose something greater than 6 in the above example, like 7 and put that in QB Val. Now we switchlink the button to the QB Set object and pressing the button will create a variable and assign the value 7 to it.
Now that we have configured the machinery to create a variable with the value 7, at the press of a button, we need to feed that into the IF/THEN statement (the QB Filter). So, as stated, make a switchlink from the tripwire to the QB Filter and from the QB Filter to the door. Now inside the QB Filter, create your conditional statement by adding QB Name and QB Val, QB Name being the same as the one in QB Set and QB Val being the number 6 because that's what we want to compare our variable to. Since our variable is 7, it's greater than 6 so this is TRUE and when we cross the tripwire, that will also fire TRUE thus satisfying both conditional requirements and permitting the switchlink to cross the filter and hit the door.
To summarize:
You want: IF A = TRUE and B = TRUE, THEN allow a signal to pass and do some shit
Here, A is some sort of mission, and B is some sort of triggering entity that does some shit
The label A is the QB Name property in QB Set
The value of A is the QB Val property in QB Set
There is no label for B, it's just an object that sends a signal like the tripwire above.
The value of B is going to be TRUE when you activate it and FALSE before that.
The value you want to compare A to is QB Val in QB Filter.
The comparison is always IF A > (the value in QB Filter) THEN don't block signals from linked objects
So you portalize and launch your level. You cross the tripwire. It fires a signal to the door but gets blocked by the QB Filter because the button hasn't been pressed. So you go back and press the button. The button fires TRUE to the QB Set and creates a variable "George" with value "7". Now you cross the switchlink again and the filter checks "Is George > 6?" "Yes it appears to be" "Ok you can pass a signal now" and the switchlink passes the filter and hits the door. The door opens. Shodan is very displeased.