What is wrong with my syntax?
karnage
Member Posts: 92
I have looked, compared, and tried several variations, but I keep getting "syntax error" or "trigger not recognized".
// =========== REJOINED AFTER KICKED OUT =====================
// This series of exchanges describes rejoining the party after being kicked out.
IF ~Global("zkwHughBooted","LOCALS",1)~ THEN BEGIN CameBack
SAY ~Hi! Have you changed your mind?~
IF ~~ THEN REPLY ~Yes. We have had a change of heart. We would like you to join our party.~ GOTO Rejoined
IF ~~ THEN REPLY ~Yeah, but I still don't want you in the party.~ GOTO RefusedAgain
END
// =========== REJOINED AFTER KICKED OUT =====================
// This series of exchanges describes rejoining the party after being kicked out.
IF ~Global("zkwHughBooted","LOCALS",1)~ THEN BEGIN CameBack
SAY ~Hi! Have you changed your mind?~
IF ~~ THEN REPLY ~Yes. We have had a change of heart. We would like you to join our party.~ GOTO Rejoined
IF ~~ THEN REPLY ~Yeah, but I still don't want you in the party.~ GOTO RefusedAgain
END
0
Comments
I don't think either of that should crash the game, though. If the syntax error is in the first line, often the error is actually with the block before it. Are you perhaps missing an END, or forgetting a quotation mark in an exit variable?
Funny thing is, I compared my syntax above to Keldorn's script and I am at a total loss still ...
Thanks for your input!
I understand when variable need to be local or global when different subroutines need to access the same variable and I understand the passing of variables (I am quite good at programming with Visual Basic for Applications) but using that knowledge for WeiDu eludes me.
I had assumed that GLOBALS could be accessed by any script, etc. (as that is the rules with most freeform programming languages, like C++, and this is C++ based).
LOCALS, however, had me thrown a bit. As LOCALS are seeable only by the subroutines that created/defined them, those remain slightly unclear ....
So, as "locals" are stored with the CRE file, does that correspond to the CRE's dialog files as well?
In short, can the LOCAL defined in the J file be seen by the D file as well?
btw, I think the Branwen mod is going to be very helpful. The one who put that together explained everything; I think they spent more time tutoring than they did programming, LoL.
yes, because the locals are stored with the creature itself, not with a script ...
... Correct?
My script:
IF ~Global("zkwHughBooted","LOCALS",1)~ THEN BEGIN CameBack
Keldorn's Script:
IF ~Global("KeldornMove","GLOBAL",1)
Dead("bheye")
~ THEN BEGIN 11 // from:
SAY #8428 /* ~Welcome to the guildhouse of my Order, old friends. It seems you fared better than I in those sewers -- I felt the evil below me fade, which is well. Tell me, how might I be of service to you?~ [KELDOR83] */
Branwen's Script:
IF ~Global("O#BranToBKickedOut","GLOBAL",1)~ b2
Where is the difference!?
I don't see it.
Refuses to compile.
~syntax error
~trigger ~global~ not recognized
... I'll try that ...
But this time, it's not giving me much to go on, but enough that maybe, my syntax error isn't where I thought it was:
[zkwmods\Hugh\zkwhugh.d] PARSE ERROR at line 74 column 1-60
Near Text: (
syntax error
[zkwmods\Hugh\zkwhugh.d] ERROR at line 74 column 1-60
Near Text: (
Parsing.Parse_error
ERROR: parsing [zkwmods\Hugh\zkwhugh.d]: Parsing.Parse_error
ERROR: compiling [zkwmods\Hugh\zkwhugh.d]!
Stopping installation because of error.
I'll try again tomorrow, beginning by commenting out sections then uncommenting until the corrupt block is located/confirmed.
Ach! I found my errors. (Yes, plural). They weren't in the block posted, but in the next block.
1. Old habits die hard! I had SAY ~blah blah blah"
2. I had a command after SAY ~blah blah blah~ Do xxxx
Silly me. Thanks for your patience, and sorry to be a bother ...
Good luck with your NPC!
https://docs.google.com/document/d/1ZNVRttHGVV8GOQ-CYWyTMHh-3MErQ1T_KusJkCtYtk0/edit?pli=1#heading=h.2y496ribckav
More specifically, the Syntax Highlighter for Notepad++? It's been a major help for me. Using it, you'll notice the font will go different if you make obvious screwups, like leaving out a ~ somewhere or even missing a quotation mark. It won't solve everything, but it does sense your most common mistakes, and once you see, say, your comment text no longer turning green, you'll know that you messed up on a syntax somewhere before it. It's helped me a lot.
There is no real textbook/tutorial, I agree. Sometimes simple things, like trying to check for class throw me back in desperately searching NPC mods/the regular dialog files to find an instance of it, because no one's just made a tutorial that fully explains how to race check, class check, alignment check, gender check, race check all in one place. And then there's the whole CHAIN/APPEND. If Branwen NPC hadn't explained it so well in her first dialog file, I'd probably still be lost with that.
Between this and Branwen my NPC might have a chance.
MM