The RPG Maker Resource Kit

RMRK RPG Maker Creation => Requests => Script Request => Topic started by: 104251 on January 16, 2011, 05:19:18 PM

Title: [RESOLVED] batch control self switches
Post by: 104251 on January 16, 2011, 05:19:18 PM
Hello. Its good to see all of you, great people of rmrk!)

Basically, i need a script similiar to this one:
http://rmrk.net/index.php?topic=32084.0 (http://rmrk.net/index.php?topic=32084.0)
it allows to change self switches even if you're doing it from another event or location
What it cannot do, is set, for example, switches A, B, C, and D to false in events from 14 to 91 on map 3
I think its possible...
Title: Re: [REQUEST] batch control self switches
Post by: modern algebra on January 16, 2011, 06:21:44 PM
Code: [Select]
for i in 14...91
  control_self_switch (3, i, 'A', false)
  control_self_switch (3, i, 'B', false)
  control_self_switch (3, i, 'C', false)
  control_self_switch (3, i, 'D', false)
end

Put that in a call script. You can adapt it for whatever purposes you need to
Title: Re: [REQUEST] batch control self switches
Post by: Jaffer on January 16, 2011, 06:25:38 PM
Code: [Select]
for i in 14...91
  control_self_switch (3, i, 'A', false)
  control_self_switch (3, i, 'B', false)
  control_self_switch (3, i, 'C', false)
  control_self_switch (3, i, 'D', false)
end

Put that in a call script. You can adapt it for whatever purposes you need to
When you're doing this, make sure to set the range correctly
14...91 is from 14 to 91, but not 91
14..91 is from 14 to 91, including 91.
Title: Re: [REQUEST] batch control self switches
Post by: 104251 on January 17, 2011, 07:43:20 AM
Yes! Thank you! I'll try that immediatly after i finish up my work!

----EDIT----

am i doing it right?

here goes the first one by TDS
Code: [Select]
def alter_self_switch(map_id, event_id, self_switch, value)
key = [map_id, event_id, self_switch]
$game_self_switches[key] = value
$game_map.refresh
  end
and then
Code: [Select]
def reset_shaft
for i in [4,10,12..17,20,21,23..92]
 alter_self_switch (47, i, 'A', false)
 alter_self_switch (47, i, 'B', false)
 alter_self_switch (47, i, 'C', false) 
 alter_self_switch (47, i, 'D', false)
 alter_self_switch (47, i, 'E', false) 
 alter_self_switch (47, i, 'F', false)
 alter_self_switch (47, i, 'G', false)
 alter_self_switch (47, i, 'H', false)
 alter_self_switch (47, i, 'I', false) 
 alter_self_switch (47, i, 'O', false)
 alter_self_switch (47, i, 'P', false) 
 alter_self_switch (47, i, 'Q', false) 
end
end

(about those E, F, G etc. - i've used the 'extra control switches' script by mr. MA)

---edit---
please? help?
Title: Re: [REQUEST] batch control self switches (updated)
Post by: Jaffer on January 23, 2011, 05:33:27 PM
I don't see why it wouldn't work.
Title: Re: [REQUEST] batch control self switches (updated)
Post by: 104251 on January 23, 2011, 10:35:35 PM
Thank you Jaffer!
it is [RESOLVED]