by rld » Thu Oct 28, 2010 8:31 am
foody wrote:I have the following macro code #13:
1: IF A = 0 THEN 2
2: LMSG 4
3: STOP
4: IF A = 1 THEN 5
5: LMSG 5
6: STOP
at the dialog box for an NPC at the (INTRO) topic under response:
MACRO #13
I have set variable A to be 0 at the begging of the game where the player pass by it, it set variable A = 0. When I speak with the NPC all I get is a black screen no long message even though LMSG 4 AND 5 is filled with text. Any help here? Thanks in advance.
Your code is using the IF/THEN statement incorrectly here. For example, on line 1, the code checks if A is 0. If so, it will jump to line 2. If not, it will simply continue to the next line as usual. So, in either case, it is going to line 2, which is not what you want.
I'm not sure why you would see a blank screen, because it appears that you should always have LMSG 4 displayed, regardless of the value of A. I tried identical code and this is what I saw.
To display different messages based on the value of A, you want something like this:
Code: Select all
Macro 13:
1: IF A = 1 THEN 4
2: IF A = 2 THEN 6
3: STOP
4: LMSG 13
5: STOP
6: LMSG 14
7: STOP
8:
This way, message 13 will be displayed if A=1, message 14 will be displayed if A=2, and no message will be displayed otherwise. You could add a default case after the last IF/THEN, before the STOP, by putting another LMSG command there.
[quote="foody"]I have the following macro code #13:
1: IF A = 0 THEN 2
2: LMSG 4
3: STOP
4: IF A = 1 THEN 5
5: LMSG 5
6: STOP
at the dialog box for an NPC at the (INTRO) topic under response:
MACRO #13
I have set variable A to be 0 at the begging of the game where the player pass by it, it set variable A = 0. When I speak with the NPC all I get is a black screen no long message even though LMSG 4 AND 5 is filled with text. Any help here? Thanks in advance.[/quote]
Your code is using the IF/THEN statement incorrectly here. For example, on line 1, the code checks if A is 0. If so, it will jump to line 2. If not, it will simply continue to the next line as usual. So, in either case, it is going to line 2, which is not what you want.
I'm not sure why you would see a blank screen, because it appears that you should always have LMSG 4 displayed, regardless of the value of A. I tried identical code and this is what I saw.
To display different messages based on the value of A, you want something like this:
[code]
Macro 13:
1: IF A = 1 THEN 4
2: IF A = 2 THEN 6
3: STOP
4: LMSG 13
5: STOP
6: LMSG 14
7: STOP
8:
[/code]
This way, message 13 will be displayed if A=1, message 14 will be displayed if A=2, and no message will be displayed otherwise. You could add a default case after the last IF/THEN, before the STOP, by putting another LMSG command there.