Something wrong with my code....

Joined
Mar 23, 2006
Messages
800
Location
Adelaide, Australia
Okay so this is the code

Code:
<GameInfo>
    <Resource_ValidTerrains>
        <Update>
            <Where ResourceType="RESOURCE_ALUMINUM" TerrainType="TERRAIN_DESERT"></Where>
            <Set TerrainType="TERRAIN_GRASS_HILLS"></Set>
        </Update>
    </Resource_ValidTerrains>
</GameInfo>

This is the log file

Code:
[608695.199] [Localization]: Validating Foreign Key Constraints...
[608695.200] [Localization]: Passed Validation.
[608695.214] [Configuration]: Validating Foreign Key Constraints...
[608695.214] [Configuration]: Passed Validation.
[608707.085] [FullTextSearch]: Initializing FullTextSearch
[608708.108] [Gameplay]: Validating Foreign Key Constraints...
[608708.133] [Gameplay]: Passed Validation.
[608709.304] [Configuration]: Validating Foreign Key Constraints...
[608709.305] [Configuration]: Passed Validation.
[608760.069] [Configuration]: Validating Foreign Key Constraints...
[608760.069] [Configuration]: Passed Validation.
[608761.560] [Configuration]: Validating Foreign Key Constraints...
[608761.560] [Configuration]: Passed Validation.
[608768.651] [Gameplay] ERROR: near "Resource": syntax error
[608768.652] [Gameplay] ERROR: near "Resource": syntax error
[608768.652] [Gameplay]: Validating Foreign Key Constraints...
[608768.677] [Gameplay]: Passed Validation.
[608768.677] [Gameplay] ERROR: near "Resource": syntax error
[608768.677] [Gameplay] ERROR: near "Resource": syntax error
[608768.716] [Gameplay]: Validating Foreign Key Constraints...
[608768.737] [Gameplay]: Passed Validation.
[608772.651] [Configuration]: Validating Foreign Key Constraints...
[608772.652] [Configuration]: Passed Validation.

I don't understand why this doesn't work.........
 
Going by that log says to me that you have other code included in your mod?
Also, check your modding.log. It tells you what file failed to load correctly.
 
Going by that log says to me that you have other code included in your mod?
Also, check your modding.log. It tells you what file failed to load correctly.

That is literally the entire mod.

Code:
[608768.272] Status:  * Dags Resource Placement
[608768.272] Status: Game content needs to change to match target config.
[608768.272] Status: Performing pre configure processing.
[608768.284] Status: Unloading Gameplay DLL.
[608768.294] Status: Reloading Gameplay DLL.
[608768.302] Status: Localization database unchanged, no rollback needed.
[608768.302] Status: Rebuilding gameplay database.
[608768.302] Status: Gameplay database unchanged, no rollback needed.
[608768.302] Status: Applying mod components.
[608768.302] Status: Modding Framework - Applying Components
[608768.651] Status: Applying Component - Dags Resource Placement
[608768.651] ERROR: Failed to create database save point.
[608768.651] Status: UpdateDatabase - Loading ResourcePlacement.xml
[608768.652] ERROR: Failed to release save point.
[608768.677] Warning: Error when calling IComponentHandler::ApplyComponent.
[608768.716] Status: Modding Framework - Finished Apply Components
[608768.716] ERROR: Failed to apply enabled components.
[608768.821] Status: Initializing Gameplay DLL.
[608768.974] Status: Reloading Tuner states.
[608768.975] Status: Saving a debug version of the gameplay database.
[608770.872] Status: Performing post configure processing.
[608772.035] Warning: There were issues reconfiguring the game.
[608772.650] Status: Configuring game content
[608772.651] Status: Current Configuration:
[608772.651] Status: Mods:
[608772.651] Status: a0faa438-d785-47cd-a630-6b7911a0bb6d
[608772.651] Status: Target Configuration:
[608772.651] Status: Mods:
[608772.651] Status: a0faa438-d785-47cd-a630-6b7911a0bb6d
[608772.651] Status: Game configuration needs to change to match target config.
[608772.651] Status: Performing pre-configure processing.
[608772.651] Status: Rebuilding configuration database.
[608772.651] Status: Localization database unchanged, no rollback needed.
[608772.651] Status: Configuration database unchanged, no rollback needed.
[608772.651] Status: Applying settings.
[608772.651] Status: Modding Framework - Apply Settings
[608772.651] Status: Modding Framework - Finished Apply Settings
[608773.038] Status: Successfully reconfigured game.
[608870.849] Status: Modding Framework - Shutting down framework.

Extract from modding log file.....
 
It's not working because what you're doing does not make sense.

If you want to add Plains_Hills as a valid terrain, do this:

<Row ResourceType="RESOURCE_ALUMINUM" TerrainType="TERRAIN_GRASS_HILLS"/>

If you want to delete aluminum appearing on desert, do this:

<Delete ResourceType="RESOURCE_ALUMINUM" TerrainType="TERRAIN_DESERT"/>

The thing you told it to do specifies two parameters in a where command, then tries to alter one of the conditions of that command. It's like saying, "Where color=red and shape=circle, set color=blue". You can't do that, because it conflicts with the condition of the command.

The command you're trying would only work if there was a third parameter specific to the two conditions. Ie, "Where color=red and shape=circle, set size=10" Then your command structure would be valid.
 
Last edited:
There is in fact nothing wrong with the OP's code. It is not the root of the error shown in the Database log.

This is an error-message syntax for an SQL file
Code:
[608768.651] [Gameplay] ERROR: near "Resource": syntax error

I copied the OP code into one of my mods and ran it. Not only do I not get any errors but the code succeeds in altering the database as shown when I examine the table using SQLiteSpy database viewer program I have.

@anansethespider the format of the update does in fact work, and you can in fact do exactly as the OP is doing.

-----------------------------------------------

Whether the game's Map Generation lua files make use of the change is another question. Civ5 was famous (infamous) for having stuff in the game's database that was not actually used in the map generation lua files.

--------------------------------------------------

Without a zip of the actual mod itself we cannot really diagnose further what OP is doing wrong to be getting such an error.
 
There is in fact nothing wrong with the OP's code. It is not the root of the error shown in the Database log.

This is an error-message syntax for an SQL file
Code:
[608768.651] [Gameplay] ERROR: near "Resource": syntax error

I copied the OP code into one of my mods and ran it. Not only do I not get any errors but the code succeeds in altering the database as shown when I examine the table using SQLiteSpy database viewer program I have.

@anansethespider the format of the update does in fact work, and you can in fact do exactly as the OP is doing.

-----------------------------------------------

Whether the game's Map Generation lua files make use of the change is another question. Civ5 was famous (infamous) for having stuff in the game's database that was not actually used in the map generation lua files.

--------------------------------------------------

Without a zip of the actual mod itself we cannot really diagnose further what OP is doing wrong to be getting such an error.


Huh, ty, learned something new
 
Top Bottom