- 428
- Posts
- 5
- Years
- Zekko
- Seen Nov 21, 2023
Why is my "Pocket Sand" script causing crashes at startup, and why is the error reporter stuck in a loop of "Swap } and ). And again. And again."?
Every error message I get tells me the engine doesn't like the placement of } or ), but switching them around and adding extra )s and }s does nothing to make the engine happy with my code. I just get an unhelpful error message that tells me nothing about what's actually wrong with code that seems fine.
When a Pokemon is switched in while holding this item, it should cause a Sandstorm.
My "Caltrops" held item works just fine. Switch in a Pokemon holding Caltrops, and he scatters a layer of Spikes onto the foe's side of the field.
You can have this working code and do whatever you want with it.
Every error message I get tells me the engine doesn't like the placement of } or ), but switching them around and adding extra )s and }s does nothing to make the engine happy with my code. I just get an unhelpful error message that tells me nothing about what's actually wrong with code that seems fine.
Code:
Battle::ItemEffects::OnSwitchIn.add(:POCKETSAND,
proc { |item, battler, battle|
battle.pbDisplay(_INTL("{1} threw Pocket Sand!",
battle.pbStartWeatherAbility(:Sandstorm, battler)
}
)
When a Pokemon is switched in while holding this item, it should cause a Sandstorm.
My "Caltrops" held item works just fine. Switch in a Pokemon holding Caltrops, and he scatters a layer of Spikes onto the foe's side of the field.
You can have this working code and do whatever you want with it.
Code:
Battle::ItemEffects::OnSwitchIn.add(:CALTROPS,
proc { |item, battler, battle|
next if user.pbOpposingSide.effects[PBEffects::Spikes] >= 3
user.pbOpposingSide.effects[PBEffects::Spikes] += 1
battle.pbDisplay(_INTL("{1} scatters Caltrops on the foe's side of the field!",
battler.pbThis, battler.itemName))
}
)