07-31-2011, 12:04 PM
I wasn't sure if I should make a new thread about it or not. I was lying in bed as I thought this up, and I was thinking: "Man, it would be so cool if I could change certain settings of my event systems while playtesting the project."
So I thought to myself, maybe I should turn my event system settings into variables. Alright, here's where I'm going with it.
Right now, all of my event system settings are stored in a hash (PK8_SYS = {}) and I think it's really working out for me. I'm thinking about taking this to the next level, where my event systems would have a setting which would make (yeah, I wish I could make it NOT mandatory but this is awesome should the creator ever want to change a setting mid-way) you specify a particular Game Variable ID all of those settings would be housed into. (then it becomes $game_variables[id] = PK8_SYS)
Now that the settings are all housed in a variable, they could then be changed during the game through script calls. Either $game_variables[id]['setting'] = value or $game_variables[PK8_SYS['var_setting']]['setting'] = value would do.
I haven't tested any of this out yet, but I think it should work. If it does, then man... I'm a freaking genius!
Edit: Mock Example Event Code
Edit 2: My mind went "boom" as soon as I finished typing all of that down. Right now I'm testing this on my Change Leader system.
Edit 3 (7:59am): Success! I even tested whether settings can be changed during the game, and it worked. I am loving this! Now to test this with transfers...
Edit 4 (8:01am): Too bad this ($game_variables[PK8_CL['sys_variable_id']]['lead_old_button'] = "X" )
is going to be a long script call, unless I create my own methods just for the system, but I'm not so sure what calls to make.
Edit 5 (8:04am): Ahh, this handled tran (sfers well. I think I'm stumbling onto something good here!
Edit 6 (8:08am): Alright, time to check Saves.
Edit 7 (8:11am): Saves are fine. I'm ecstatic!
Edit 8 (8:17am): Yeah, these regular variable based calls are way too long for people to be able to memorize it. Looks like I'm going to have to abbreviate the variable setting. ("sys_variable_id" -> "sys_var_id")
Edit 9 (10:45am): I haven't done much of anything with this new approach to my systems, but I do love how I can finally give my systems some script calls which can manipulate the settings.
So I thought to myself, maybe I should turn my event system settings into variables. Alright, here's where I'm going with it.
Right now, all of my event system settings are stored in a hash (PK8_SYS = {}) and I think it's really working out for me. I'm thinking about taking this to the next level, where my event systems would have a setting which would make (yeah, I wish I could make it NOT mandatory but this is awesome should the creator ever want to change a setting mid-way) you specify a particular Game Variable ID all of those settings would be housed into. (then it becomes $game_variables[id] = PK8_SYS)
Now that the settings are all housed in a variable, they could then be changed during the game through script calls. Either $game_variables[id]['setting'] = value or $game_variables[PK8_SYS['var_setting']]['setting'] = value would do.
I haven't tested any of this out yet, but I think it should work. If it does, then man... I'm a freaking genius!
Edit: Mock Example Event Code
Code:
@> call script: # Do not modify this.
PK8_SYS = {}
@> call script: PK8_SYS['setting_a'] = 20
PK8_SYS['setting_b'] = false
PK8_SYS['setting_c'] = "What?"
PK8_SYS['button'] = "L"
PK8_SYS['sys_switch_id'] = 20
PK8_SYS['sys_variable_id'] = 1
@> Conditional Branch: $game_variables[PK8_SYS['sys_variable_id']].is_a?(Hash)
@@> Comment: (Do stuff here with $game_variables[PK8_SYS['sys_variable_id']] )
@@> else
@@> Call script: PK8_SYS['sys_variable_id'] = PK8_SYS
@> end
Edit 2: My mind went "boom" as soon as I finished typing all of that down. Right now I'm testing this on my Change Leader system.
Edit 3 (7:59am): Success! I even tested whether settings can be changed during the game, and it worked. I am loving this! Now to test this with transfers...
Edit 4 (8:01am): Too bad this ($game_variables[PK8_CL['sys_variable_id']]['lead_old_button'] = "X" )
is going to be a long script call, unless I create my own methods just for the system, but I'm not so sure what calls to make.
Edit 5 (8:04am): Ahh, this handled tran (sfers well. I think I'm stumbling onto something good here!
Edit 6 (8:08am): Alright, time to check Saves.
Edit 7 (8:11am): Saves are fine. I'm ecstatic!
Edit 8 (8:17am): Yeah, these regular variable based calls are way too long for people to be able to memorize it. Looks like I'm going to have to abbreviate the variable setting. ("sys_variable_id" -> "sys_var_id")
Edit 9 (10:45am): I haven't done much of anything with this new approach to my systems, but I do love how I can finally give my systems some script calls which can manipulate the settings.