Jump to content

GoTo For Non-Dialogue Weidu


Bill Bisco

Recommended Posts

I have the following Code:

 

ACTION_IF (FILE_EXISTS_IN_GAME ~erevain.cre~) BEGIN
  COPY_EXISTING ~Erevain.cre~ ~override~  //Erevain CRE exists
END
ELSE BEGIN
  COPY ~Erevain/Characters/Erevain.cre~ ~override~ 
END
SAY NAME1 ~Erevain~
SAY NAME2 ~Erevain~
SAY MORALE ~I must hide! Now!~

The above Says will give an error because they are Preceded by an END in either case of Erevain.Cre already existing in the game or not.

 

I would like to patch Erevain.Cre with the same commands (Name1, Name2, Morale, etc.) and not needlessly repeat them in code.. I think I need a GoTo Statement of some kind. Would the below work?

ACTION_IF (FILE_EXISTS_IN_GAME ~erevain.cre~) BEGIN
  COPY_EXISTING ~Erevain.cre~ ~override~  //Erevain CRE exists
  GOTO Patch_Erevain_Cre
END
ELSE BEGIN
  COPY ~Erevain/Characters/Erevain.cre~ ~override~
  GOTO Patch_Erevain_Cre
END
Patch_Erevain_Cre
SAY NAME1 ~Erevain~
SAY NAME2 ~Erevain~
SAY MORALE ~I must hide! Now!~
Link to comment

As far as I know, GOTO is not available outside of the dialogue scope.

 

Anyhow, using GOTO isn't generally considered a good approach to design. What exactly are you trying to achieve? Having different sets of patch commands depending on whether the creature exists in game or not?

 

There isn't much sense in patching a file via WeiDU if you hard-copy it from your mod's contents. However, if you want to copy the file into override and do SAY NAME1, etc. at the same time, there is nothing stopping you from doing that.

 

If I understood you correctly, you need:

COPY ~Erevain/Characters/Erevain.cre~ ~override~ 
  SAY NAME1 ~Erevain~
  SAY NAME2 ~Erevain~

  SAY MORALE ~I must hide! Now!~
Link to comment

I am leaving the door open for other mods to mod the CRE file beforehand. I would prefer not to overwrite everything if I don't have to. In order to have that flexibility I have to patch both scenarios. I would rather not double the lines of code to do so if possible.

Link to comment

 

I have the following Code:

 

ACTION_IF (FILE_EXISTS_IN_GAME ~erevain.cre~) BEGIN
  COPY_EXISTING ~Erevain.cre~ ~override~  //Erevain CRE exists
END
ELSE BEGIN
  COPY ~Erevain/Characters/Erevain.cre~ ~override~ 
END
SAY NAME1 ~Erevain~
SAY NAME2 ~Erevain~
SAY MORALE ~I must hide! Now!~

The above Says will give an error because they are Preceded by an END in either case of Erevain.Cre already existing in the game or not.

 

I would like to patch Erevain.Cre with the same commands (Name1, Name2, Morale, etc.) and not needlessly repeat them in code.. I think I need a GoTo Statement of some kind. Would the below work?

ACTION_IF (FILE_EXISTS_IN_GAME ~erevain.cre~) BEGIN
  COPY_EXISTING ~Erevain.cre~ ~override~  //Erevain CRE exists
  GOTO Patch_Erevain_Cre
END
ELSE BEGIN
  COPY ~Erevain/Characters/Erevain.cre~ ~override~
  GOTO Patch_Erevain_Cre
END
Patch_Erevain_Cre
SAY NAME1 ~Erevain~
SAY NAME2 ~Erevain~
SAY MORALE ~I must hide! Now!~

You're basically mixing action and patch coding (SAY et al). The patching needs to follow the COPY command, which is why WeiDU is objecting. The simplest way to do what you want would be

ACTION_IF !FILE_EXISTS_IN_GAME ~erevain.cre~ BEGIN
  COPY ~Erevain/Characters/Erevain.cre~ ~override~
END

COPY_EXISTING ~erevain.cre~ ~override~
  SAY NAME1 ~Erevain~
  SAY NAME2 ~Erevain~
  SAY MORALE ~I must hide! Now!~

If erevain.cre exists, the first block is skipped and it goes straight to the patching. If he doesn't, WeiDU adds him and then starts the same patching.

Link to comment

 

I have the following Code:

 

ACTION_IF (FILE_EXISTS_IN_GAME ~erevain.cre~) BEGIN
  COPY_EXISTING ~Erevain.cre~ ~override~  //Erevain CRE exists
END
ELSE BEGIN
  COPY ~Erevain/Characters/Erevain.cre~ ~override~ 
END
SAY NAME1 ~Erevain~
SAY NAME2 ~Erevain~
SAY MORALE ~I must hide! Now!~

The above Says will give an error because they are Preceded by an END in either case of Erevain.Cre already existing in the game or not.

 

I would like to patch Erevain.Cre with the same commands (Name1, Name2, Morale, etc.) and not needlessly repeat them in code.. I think I need a GoTo Statement of some kind. Would the below work?

ACTION_IF (FILE_EXISTS_IN_GAME ~erevain.cre~) BEGIN
  COPY_EXISTING ~Erevain.cre~ ~override~  //Erevain CRE exists
  GOTO Patch_Erevain_Cre
END
ELSE BEGIN
  COPY ~Erevain/Characters/Erevain.cre~ ~override~
  GOTO Patch_Erevain_Cre
END
Patch_Erevain_Cre
SAY NAME1 ~Erevain~
SAY NAME2 ~Erevain~
SAY MORALE ~I must hide! Now!~

ACTION_IF NOT FILE_EXISTS_IN_GAME ~erevain.cre~ BEGIN

COPY ~Erevain/Characters/Erevain.cre~ ~override~

END

 

This step puts your Erevain cre to the game if it does not exist >> The second step is now generic for the cre that is assured to be there

The second step than modifies whatever Erevain is now in the game (old if step 1 was skipped or your own if there was none before)

 

COPY_EXISTING ~Erevain.cre~ ~override~

SAY NAME1 ~Erevain~

SAY NAME2 ~Erevain~

SAY MORALE ~I must hide! Now!~

and so on

Link to comment

ACTION_IF NOT (FILE_EXISTS_IN_GAME ~erevain.cre~) BEGIN

You did notice that in the above post, CamDawn put the exclamation mark without the extra space, which does the same thing as the "NOT "... so.

 

Yeah, the weidu.exe is not a C+, so you can't use the commands. :p

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...