BIG MAPS and Anti-Lag
#6
Something people usually forget is that operators in Ruby are a bit weird.

and follows the logical order, i.e. if check1 and check2

&& does it in the reverse order, e.g. if check2 && check1

There operator precedence DOES matter! && has a higher precedence than and.

So print name and pattern to verify which one isn't a string and when one of them is a regular expression or Regexp instead. Why? That's because the scripter forgot that passing a single string, whether it's the first or second parameter, to a match operator will always throw a TypeError in Ruby. That should NOT happen at all. This happens when you include strings and regular expressions. Laughing In my humble opinion he should have picked just one of them to reduce the number of tests needed to run the method.

Solution? I guess it could be something like...

Code:
if (pattern.is_a?(String) and name.include?(pattern)) ||
        (pattern.is_a?(Regexp) and !(pattern =~ name).nil?)

I don't think name should ever be a Regexp. Not even a mad scientist like Mad Scientist would ever dare to make it a regular expression.
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9

Maranatha!

The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.

[Image: SP1-Scripter.png]
[Image: SP1-Writer.png]
[Image: SP1-Poet.png]
[Image: SP1-PixelArtist.png]
[Image: SP1-Reporter.png]

My Original Stories (available in English and Spanish)

List of Compiled Binary Executables I have published...
HiddenChest & Roole

Give me a free copy of your completed game if you include at least 3 of my scripts! Laughing + Tongue sticking out

Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
Reply }


Messages In This Thread
BIG MAPS and Anti-Lag - by Mel - 06-04-2020, 02:05 PM
RE: BIG MAPS and Anti-Lag - by DerVVulfman - 06-05-2020, 05:57 AM
RE: BIG MAPS and Anti-Lag - by Mel - 06-06-2020, 09:36 AM
RE: BIG MAPS and Anti-Lag - by kyonides - 06-06-2020, 09:29 PM
RE: BIG MAPS and Anti-Lag - by DerVVulfman - 06-07-2020, 04:10 AM
RE: BIG MAPS and Anti-Lag - by Mel - 06-07-2020, 09:30 AM
RE: BIG MAPS and Anti-Lag - by DerVVulfman - 06-09-2020, 03:14 AM
RE: BIG MAPS - by DerVVulfman - 06-04-2020, 05:13 PM
RE: BIG MAPS - by Mel - 06-04-2020, 06:22 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
   Making Forest Maps with the Random Map Generator ShadowIce 16 21,990 02-02-2014, 08:18 PM
Last Post: ShadowIce
   XP maps saved in RB files kyonides 1 6,027 05-02-2010, 04:43 AM
Last Post: vgvgf
   Help Making Random Maps ShadowIce 0 3,262 02-02-2010, 03:28 PM
Last Post: ShadowIce
   Using animations in a scene (unrelated to battles and maps) PK8 4 9,024 11-17-2009, 10:54 AM
Last Post: PK8



Users browsing this thread: 1 Guest(s)