When not problem

Alright, my second problem here. After I have generated random post-apocalyptic vehicles, I want to generate societies. The main bit of the generator that is relevant for the question looks like this at the moment:

Table: Apocalyptic society
10:Nobody here... (deserted)
5:No one alive, {1d20} bodies strewn about.
40:You find: [@Culture] ruled as [@Leadership]\nTheir Place consists of {4d3} buildings and {5d6} people live there.\nTheir cultural focus is: [!{1d2} CulturalFocus >> implode] and their appearance is characterized by [!{1d3} AppearanceQuirks >> implode]\nTheir special resource is: [!{1d3} SpecialResource >> implode]\nTheir Equipment has the quality level of: [@EquipmentQuality]\nThey have the special laws: [!{1d11} SpecialLaws >> implode]\nTheir vehicles consist mainly of [@VehicleType] [when not] [@VehicleType] = None [do] and have the special focus of: [@VehicleSpecialitiesYN]. Their Flagship vehicle is: [@FlagshipVehicle] [end]

Table: VehicleType
10:Custom Vehicles
15:Fast Vehicles
2:Armored Vehicles
10:a single giant Vehicle
40:Individual "normal" vehicles
20:Construction Vehicles

What I want to do now is tell the generator that it should only generate a special focus for the vehicles and a flagship vehicle that the society owns if they actually have any - so when the table "VehicleType" returns something other than "None". But at the moment the program seems to randomly decide whether it continues after the VehicleType table or not. What am I doing wrong?


  • Ok, so the important part is really just this:

    [@VehicleType] [when not] [@VehicleType] = None [do] and have the special focus of...[end]

    The issue here is that when you ask whether @VehicleType = None, it's not using the first value of @VehicleType. Instead, it's going back to that table and coming up with a new random value.

    What you need to do instead is save that value to a variable, and then check the variable. It looks like this:

    [VT=[@VehicleType]] [when not] {$VT} = None [do] and have the special focus of...[end]

    Note that, when you assign a value to a variable with single = sign, the value is displayed. If you use two == the value will not be shown.

Leave a Comment