Author Topic: [XP] More Self-Switches  (Read 7350 times)

Offline G_G

  • Green Gmod Game_Guy AKA G4 AKA hyper-G AKA G-force
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 6585
  • LV: 407
  • Gender: Male
    • View Profile
[XP] More Self-Switches
« on: June 06, 2011, 08:19:50 AM »
More Self-Switches
Authors: game_guy
Version: 1.5
Type: Event Modification
Key Term: Environment Add-on

Introduction

Ever need more than 4 self switches? With this small script, you can now have as many self switches you want. You aren't just limited to letters either. You can have names for them.

Features

  • More Self Switches
  • Name them whatever
  • Access/toggle them from wherever

Screenshots

(click to show/hide)

Demo

N/A

Script

(click to show/hide)

VX Version Here

Instructions

In the script.
Place above main, below Scene_Debug, the normal.

Compatibility

Not tested with SDK.
Should work with anything.

Credits and Thanks

  • game_guy ~ For creating it.
  • Thanks to KK20 for a Bug Fix

Author's Notes

Enjoy! :)
« Last Edit: December 07, 2014, 04:47:04 AM by gameus »

Offline G_G

  • Green Gmod Game_Guy AKA G4 AKA hyper-G AKA G-force
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 6585
  • LV: 407
  • Gender: Male
    • View Profile
Re: [XP] More Self-Switches
« Reply #1 on: June 06, 2011, 09:38:22 AM »
Erm, sorry for the double post, updated the script, forgot a couple of things in the script. :S

Offline LiTTleDRAgo

  • Astral Trancist
  • *****
  • Posts: 841
  • LV: 514
  • Gender: Male
    • View Profile
    • ~
Re: [XP] More Self-Switches
« Reply #2 on: June 06, 2011, 02:48:24 PM »
... umm, I don't see how this will be useful, :???:
after all we can use self switches unlimitedly

Code: [Select]
$game_self_switches[[$game_map.map_id, @event_id, 'STRING']] = true
and it's not just 'A', 'B', 'C', 'D'

Offline G_G

  • Green Gmod Game_Guy AKA G4 AKA hyper-G AKA G-force
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 6585
  • LV: 407
  • Gender: Male
    • View Profile
Re: [XP] More Self-Switches
« Reply #3 on: June 06, 2011, 05:42:54 PM »
Yea but then people would have to go through the work of figuring out how to set the event's page to that switch. This makes it easier for those non scripters to create new self switches, set them on and off, and set an events page to that self switch.

EDIT:
While this is true:
Code: [Select]
$game_self_switches[[$game_map.map_id, @event_id, 'STRING']] = truePeople with little to no scripting knowledge would not know how to set an event's page to that custom switch they just turned on. This makes it easy because all you have to do is place a comment in the page.
Code: [Select]
Switch:custom_switchAnd bam, that event's page self switch is set to "custom_switch".
Then you just call this:
Code: [Select]
self_switch("custom_switch", true)To turn that self switch on.
« Last Edit: June 06, 2011, 08:59:15 PM by Captain Falcon »

Offline G_G

  • Green Gmod Game_Guy AKA G4 AKA hyper-G AKA G-force
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 6585
  • LV: 407
  • Gender: Male
    • View Profile
Re: [XP] More Self-Switches
« Reply #4 on: July 29, 2011, 10:49:47 AM »
Fixed a bug where event wouldn't go to correct page on map transfers.

Treebonesteak

  • Guest
Re: [XP] More Self-Switches
« Reply #5 on: July 24, 2012, 07:39:02 PM »
I need help D:

I used this script after I build a couple of maps.
The script works fine, but on only one Map it always gives me a error message:

Quote
Script 'More Self Switches' line 59: NoMethodError occurred.
undefined Method 'downcase' for nil:NilClass

Hope you can help me  :uhm:

(But all in all it works great :D)

Online KK20

  • Master Scripter Fixer
  • Global Moderator
  • Guardian of Chaos
  • ****
  • Posts: 3047
  • LV: 372
  • Gender: Male
  • Bringer of Salt
    • View Profile
Re: [XP] More Self-Switches
« Reply #6 on: July 24, 2012, 11:05:35 PM »
The reason for the error is that you have a line break in one of your comments. Example is
Code: [Select]
This is my comment.

I just made a line break.
Here's a fix for that:
(click to show/hide)

To G_G (who just recently changed his name?  :???:) the fix is in 'def check_custom_switch'. I added a 'return if a[0].nil?'.



Other Projects
RPG Maker XP AceUpgrade RMXP to RMVXA performance!
XPA TilemapTilemap rewrite with many features, including custom resolution!


NNID: KK20-CP
Discord: KK20 Tyler#8901
Join the CP Discord Server

Treebonesteak

  • Guest
Re: [XP] More Self-Switches
« Reply #7 on: July 25, 2012, 05:58:20 PM »
Thanks! It works :D

Offline G_G

  • Green Gmod Game_Guy AKA G4 AKA hyper-G AKA G-force
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 6585
  • LV: 407
  • Gender: Male
    • View Profile
Re: [XP] More Self-Switches
« Reply #8 on: July 25, 2012, 09:53:56 PM »
Thanks KK20 for fixing that.

Offline G_G

  • Green Gmod Game_Guy AKA G4 AKA hyper-G AKA G-force
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 6585
  • LV: 407
  • Gender: Male
    • View Profile
Re: [XP] More Self-Switches
« Reply #9 on: September 21, 2013, 10:05:38 PM »
As requested by Heretic, you can now change the switches and get the switches current state from anywhere. e.g. In event id 5, you can check for event id 6's self switches now.

Offline LiTTleDRAgo

  • Astral Trancist
  • *****
  • Posts: 841
  • LV: 514
  • Gender: Male
    • View Profile
    • ~
Re: [XP] More Self-Switches
« Reply #10 on: September 22, 2013, 01:54:25 AM »
there is a mistake in your code

(click to show/hide)

I believe you want it to be like this

(click to show/hide)

Offline G_G

  • Green Gmod Game_Guy AKA G4 AKA hyper-G AKA G-force
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 6585
  • LV: 407
  • Gender: Male
    • View Profile
Re: [XP] More Self-Switches
« Reply #11 on: September 22, 2013, 02:13:09 AM »
Yeah, forgot that works. Sorry, been working with C#, and before .NET 4.0, you can't have default arguments. Still, the code works lol.

EDIT: Nonetheless, fixed.
« Last Edit: September 22, 2013, 02:14:29 AM by gameus »

Offline ForeverZer0

  • CP's Pedophile
  • Global Moderator
  • Guardian of Chaos
  • ****
  • Posts: 3247
  • LV: 294
  • Gender: Male
  • Remember you are unique, just like everyone else.
    • View Profile
Re: [XP] More Self-Switches
« Reply #12 on: September 23, 2013, 01:18:34 PM »
...been working with C#, and before .NET 4.0, you can't have default arguments...

Not true, works in .NET 2.0.  I haven't used any version lower than that, but it's been around for a while.

I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Offline G_G

  • Green Gmod Game_Guy AKA G4 AKA hyper-G AKA G-force
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 6585
  • LV: 407
  • Gender: Male
    • View Profile
Re: [XP] More Self-Switches
« Reply #13 on: September 23, 2013, 04:46:22 PM »
Oh really?
...been working with C#, and before .NET 4.0, you can't have default arguments...

Not true, works in .NET 2.0.  I haven't used any version lower than that, but it's been around for a while.



I'll rephrase it then. Anything before Visual Studio 2010 e.g. before the existence of C# 4.0, you could not do it. I don't care for Visual Studio 2010, and I have difficulties getting XNA to work properly in 2012, so I tend to work with 2008 when I'm working with XNA.

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 19931
  • LV: 642
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: [XP] More Self-Switches
« Reply #14 on: September 23, 2013, 08:53:16 PM »
You are making the mistake that C# are .NET version are not the same. gameus is right, C# is v4.0 in VS 2010 and since then they have added default arguments, regardless of whether you use .NET v2.0 or v4.0.
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.