Mattsuharu

Veteran
Veteran
Joined
Apr 15, 2022
Messages
104
Reaction score
39
First Language
English
Primarily Uses
RMVXA
The other day I made a question about the card game script where I asked if I could search for values between 2 values.
And a very skilled user managed to create an addon for the script to achiev that. Now I'm wondering, in that same script, is it possible to use an "exception"? As far as I know, in ruby if you use "!" you're telling the code that it has to except that value, but looks like this script can't handle that, so I think I could create a line in the addon given to make the exception avalible too.

For this example, I have a card that can shuffle ANY 5 cards in the Graveyard back to the deck except ITSELF.
So I used this impact method:

"jaravarice" => [:take, 0, :grave, :grave, [0,0,0,0,0,0,0,0,0,0,!4], :deck, 5],

If the card is marked with the tag "special: 4" it will be the only valid target to shuffle if it doesn't have the "!", so I want to make the opposite, and make ANY card valid to target EXCEPT the one with that special tag 4.
 

kyonides

Reforged is laughable
Veteran
Joined
Nov 17, 2019
Messages
508
Reaction score
215
First Language
English
Primarily Uses
RMXP
Or pick those 5 cards BEFORE you send the special card to the graveyard.
 

Mattsuharu

Veteran
Veteran
Joined
Apr 15, 2022
Messages
104
Reaction score
39
First Language
English
Primarily Uses
RMVXA
Or pick those 5 cards BEFORE you send the special card to the graveyard.
The script already do this. The card is not sent to the graveyard until the skill sucefully resolve. The problem is if I ALREADY have another copy of this card in the graveyard. Basically if I have 2 copies of this card, I can loop them to never deckout.
 

Heirukichi

Veteran
Veteran
Joined
Sep 24, 2015
Messages
1,470
Reaction score
629
First Language
Italian
Primarily Uses
RMVXA
You could create a new array that is a copy of the previous one, but without the element you want.

Example
Ruby:
starting_array = [whatever, card_you_want_to_remove]
array_without_card = starting_array.reject { |card| card.param == your_value }

The example above contains a lot of placeholders, and is not exactly a complete code, it is more or less a pseudo-code. However, according to your post, you wanna check if the item has a value of "special" that is 4.

The solution could be like this, assuming that starting_array is your array of cards (feel free to use the real variable name in its stead).

Ruby:
filtered_array = starting_array.reject { |card| card.special == 4 }
# here 'filtered_array' already has all the cards you need
# which means all those in the starting array except those whose special is 4

I hope this helps you.

EDIT
If you want to take a deeper look at this, you can check the documentation here. The ruby version for that documentation is the very same you have in VXAce, so there are no modern things that are not yet present in VXAce.
 

kyonides

Reforged is laughable
Veteran
Joined
Nov 17, 2019
Messages
508
Reaction score
215
First Language
English
Primarily Uses
RMXP
Well, perhaps it'd be convenient to define a new method there.

Ruby:
module SomeModule
  REMAIN_IN_GRAVEYARD = [1, 2, 5]
end

def reusable_cards
  graveyard_cards = SomeModule::REMAIN_IN_GRAVEYARD
  @cards.reject{|card| graveyard_cards.include?(card.param) }
end

# Somewhere in the Scene Script
array_without_card = reusable_cards

As the other forumer said, it's just some pseudo code that might give you an idea on what to do just in case you need to keep more than one type of card off of the table.
 

Mattsuharu

Veteran
Veteran
Joined
Apr 15, 2022
Messages
104
Reaction score
39
First Language
English
Primarily Uses
RMVXA
Thanks both of you for your patience and taking the time to explain to a dumbass like myself!
After some investigation in ruby (I'm not a coder, not even good with coding) I found there was an easier solution, and I will leave it in case someone need it in the future.
You can exclude something with the next method:
Let's say you want to exclude the value 4 in a value that goes from 0 to 99. You have to type it like this:
Ruby:
"jaravarice"  => [:take, 0, :grave, :grave,   [0,0,0,0,0,0,0,0,0,0,[*0..3, *5..99]], :deck, 5],

I hope this help someone cuz I was strugglin all day with this.

EDIT: Oh, of course, this method only work if you use the addon that Another Fen made for me in the other post.
 

Latest Profile Posts


Clarn Hold
(No storylines)
There was a tutorial on how to draw anime eyes. Just draw Among Us. So I tried.
Screenshot_107.jpg
DamageActor3_7.png added!
index.php

Making a "characters first appearance" drawing for my game. Now I just have to finish the sprite art animation for her grand entrance.​
ScreenShot_9_24_2022_7_56_24.png
New area being started today. It leads to one of the games 2 optional bosses.

Forum statistics

Threads
125,537
Messages
1,171,801
Members
164,608
Latest member
royeventcompany
Top