Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # the following Stellaris event (written in what I have dubbed "WTFLanguage") is used to find whichever star system is furthest from the galactic core (or at least one that's "close enough" due reasons you'll soon discover). One of the biggest "wait, what?" moments is when you realize that we can't assign "last_distance = distance_to_core", we actually need to guess at what the value of "distance_to_core" will be, and then assign that as a literal.
- # in a perfect world, using C++ syntax for comparison; we would write the following:
- # system* last = randomSystem();
- # for (const auto& s : every_rim_system) if (s.distance > last->distance) last = &s;
- # // and now, "last" points to the system with the highest distance from the galactic core.
- # But, in the nightmare that is Stellaris' WTFL:
- #****************************#
- # Find most outer-rim system #
- #****************************#
- country_event =
- {
- id = fgl_on_gamestart.101
- hide_window = yes
- is_triggered_only = yes
- immediate =
- {
- hidden_effect =
- {
- set_variable = { which = fgl_gm_lastDistance value = 0.0 }
- set_variable = { which = fgl_gm_currDistance value = 0.0 }
- every_rim_system =
- {
- limit={AND={ NOT={ exists = space_owner } distance_to_core_percent > 0.79 }}
- #log = "and we're looping"
- # Variables can't be assigned values from other variables...
- # Yes. You read that right. Welcome to WTFL
- # Because we can't just "assign y the value of x", instead
- # we need to ask "is x equal to 5? then assign y the value of 5"
- # and no, I'm not joking...
- if = { limit = { distance_to_core_percent > 0.79 } prev = { set_variable = { which = fgl_gm_currDistance value = 0.80 } } }
- if = { limit = { distance_to_core_percent > 0.80 } prev = { set_variable = { which = fgl_gm_currDistance value = 0.81 } } }
- if = { limit = { distance_to_core_percent > 0.81 } prev = { set_variable = { which = fgl_gm_currDistance value = 0.82 } } }
- if = { limit = { distance_to_core_percent > 0.82 } prev = { set_variable = { which = fgl_gm_currDistance value = 0.83 } } }
- if = { limit = { distance_to_core_percent > 0.83 } prev = { set_variable = { which = fgl_gm_currDistance value = 0.84 } } }
- if = { limit = { distance_to_core_percent > 0.84 } prev = { set_variable = { which = fgl_gm_currDistance value = 0.85 } } }
- if = { limit = { distance_to_core_percent > 0.85 } prev = { set_variable = { which = fgl_gm_currDistance value = 0.86 } } }
- if = { limit = { distance_to_core_percent > 0.86 } prev = { set_variable = { which = fgl_gm_currDistance value = 0.87 } } }
- if = { limit = { distance_to_core_percent > 0.87 } prev = { set_variable = { which = fgl_gm_currDistance value = 0.88 } } }
- if = { limit = { distance_to_core_percent > 0.88 } prev = { set_variable = { which = fgl_gm_currDistance value = 0.89 } } }
- if = { limit = { distance_to_core_percent > 0.89 } prev = { set_variable = { which = fgl_gm_currDistance value = 0.90 } } }
- if = { limit = { distance_to_core_percent > 0.90 } prev = { set_variable = { which = fgl_gm_currDistance value = 0.91 } } }
- if = { limit = { distance_to_core_percent > 0.91 } prev = { set_variable = { which = fgl_gm_currDistance value = 0.92 } } }
- if = { limit = { distance_to_core_percent > 0.92 } prev = { set_variable = { which = fgl_gm_currDistance value = 0.93 } } }
- if = { limit = { distance_to_core_percent > 0.93 } prev = { set_variable = { which = fgl_gm_currDistance value = 0.94 } } }
- if = { limit = { distance_to_core_percent > 0.94 } prev = { set_variable = { which = fgl_gm_currDistance value = 0.95 } } }
- if = { limit = { distance_to_core_percent > 0.95 } prev = { set_variable = { which = fgl_gm_currDistance value = 0.96 } } }
- if = { limit = { distance_to_core_percent > 0.96 } prev = { set_variable = { which = fgl_gm_currDistance value = 0.97 } } }
- if = { limit = { distance_to_core_percent > 0.97 } prev = { set_variable = { which = fgl_gm_currDistance value = 0.98 } } }
- if = { limit = { distance_to_core_percent > 0.98 } prev = { set_variable = { which = fgl_gm_currDistance value = 0.99 } } }
- if = { limit = { distance_to_core_percent > 0.99 } prev = { set_variable = { which = fgl_gm_currDistance value = 1.00 } } }
- # yep, that's correct... Our decimal place resolution is determined by how many IFs we write.
- # God help us if the largest is < 80%... just break I guess?
- # now we check to see if currDistance is greater than lastDistance
- # if so, we want to change fgl_best_system and update lastDistance
- if = { limit = { prev = { check_variable = { which = fgl_gm_currDistance value > fgl_gm_lastDistance } } }
- save_event_target_as = fgl_best_system
- #log = "fgl_best_system updated"
- prev =
- {
- set_variable = { which = fgl_gm_lastDistance value = 0.79 }
- while ={limit = { check_variable = { which = fgl_gm_lastDistance value < fgl_gm_currDistance } }
- change_variable = { which = fgl_gm_lastDistance value = 0.01 }
- }
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement