Help with Teleport script.

Hey there, Jaymonius here. Need a little assistance fixing this script.


It was last updated six years ago, but one individual mentioned already on that script that whenever you cancel when using the teleport system, the game crashes and brings up this error:

Script 'Easy Teleport' line 86: RangeError occured. bignum too big to convert into 'long'

If someone can help fix this, it would be great. I'm using the script as well, and want to get this little issue dealt with.
From what I'm understanding, the line "$game_message.choice_cancel_type = 999999999999" is the source of your problems, as that number is too large to be represented in the same way a regular integer could be (basically, it's just too absurdly large). I'm struggling to understand why the number is so immensely large in the first place, but I would suggest replacing both lines with a large number of 9 digits or less "$game_message.choice_cancel_type = 1000000" for example. I haven't used this script before, but that may be a push in the right direction. Hope that helps.
Now I get:
Script line 85: NoMethodError occurred.

undefined method'[]' for nil:NilClass
Now I get:
Script line 85: NoMethodError occurred.

undefined method'[]' for nil:NilClass
Is this with cancelling, or generally? I'm going to attempt to run the script on my end, and see what I get. Also, if possible, could you provide screenshots of exactly what you're doing?
Oh, it's specifically when I'm cancelling the teleportation list. That's about it. But I can still provide a screenshot. Just give me a moment.

Edit:
P6screenie4.png


The moment I'm at this selection, I try to cancel, and the error happens.
Apologies for the late reply, I think I've found a fix. (before you do anything please save your previous code somewhere, eg a text file, in case there's further errors with my fix. I've tested it a bit, but I'd rather be safe than sorry). Anyway here goes.

I only changed a few lines, specifically putting an if statement in the Proc.new statement, and adding an extra choice, so I do not wish to take any credit. But hopefully you'll be able to exit using this code.
(FULL CREDIT TO @Balrogic FOR THE ORIGINAL CODE.)
Replace the self.unsorted function.
Spoiler: unsort
def self.unsorted $game_self_switches[[:balrogic, :teleport, :override]] = true if $game_self_switches[[:balrogic, :teleport, :disabled]] $game_message.add(@disabled) if @disabled $game_self_switches[[:balrogic, :teleport, :override]] = nil else if $game_self_switches[[:balrogic, :teleport]] $game_message.choice_cancel_type = 1000000 $game_self_switches[[:balrogic, :teleport]].each{ |x| $game_message.choices << x[0] } num_choices = $game_message.choices.size $game_message.choices << "Back" $game_message.choice_proc = Proc.new { |x| if (x < num_choices) $game_player.reserve_transfer( $game_self_switches[[:balrogic, :teleport]][x][1], $game_self_switches[[:balrogic, :teleport]][x][2], $game_self_switches[[:balrogic, :teleport]][x][3], $game_self_switches[[:balrogic, :teleport]][x][4]) Balrogic::Teleport::configuration end } $game_message.add(@destination) if @destination else $game_message.add(@nodestination) if @nodestination $game_self_switches[[:balrogic, :teleport, :override]] = nil end end end

And here's the self.sorted code.

Spoiler: sort
def self.sorted $game_self_switches[[:balrogic, :teleport, :override]] = true if $game_self_switches[[:balrogic, :teleport, :disabled]] $game_message.add(@disabled) if @disabled $game_self_switches[[:balrogic, :teleport, :override]] = nil else if $game_self_switches[[:balrogic, :teleport_manual]] $game_message.choice_cancel_type = 1000000 @sorted_list = [] $game_self_switches[[:balrogic, :teleport_manual]].each{ |x| @sorted_list << x if x } @sorted_list.each{ |x| $game_message.choices << x[0] } num_choices = $game_message.choices.size $game_message.choices << "Back" $game_message.choice_proc = Proc.new { |x| if (x < num_choices) $game_player.reserve_transfer(@sorted_list[x][1], @sorted_list[x][2], @sorted_list[x][3], @sorted_list[x][4]) Balrogic::Teleport::configuration end } $game_message.add(@destination) if @destination else $game_message.add(@nodestination) if @nodestination $game_self_switches[[:balrogic, :teleport, :override]] = nil end end end
Alrighty! It works fine. HOWEVER, something unusual is going on though.
1614801889547.png
This thing occurs, and then goes back to the game as if nothing happened. Any idea what could be causing that?
Ah, my bad!
Give me a second! I'll edit my post to remove the msgbox_p I used for bug testing!
EDIT: Should be fixed now! Apologies for that! 😅
Alrighty! It works fine. HOWEVER, something unusual is going on though. View attachment 181582 This thing occurs, and then goes back to the game as if nothing happened. Any idea what could be causing that?
Remove the line in self.unsorted that begins with msgbox_p, and that should do it. I've updated the code in the extract to reflect this.
Perfect! Thank you sooooo much for your help! I really appreciate it! ^_^

Works perfectly fine now! Awesome!
Perfect! Thank you sooooo much for your help! I really appreciate it! ^_^

Works perfectly fine now! Awesome!
Glad I could help! Happy game making!!😉

Original thread: https://forums.rpgmakerweb.com/threads/help-with-teleport-script.134047/