[RGSS3] Method Calling Question

Started by blackhat91, July 12, 2014, 02:19:16 pm

Previous topic - Next topic

blackhat91

Thank you for taking the time to view my question.

I am trying to dabble in scripting in RGSS3, having used RGSS to a fair extent. However, I can't get basic method calls to work. I have a class, test, and the method, def method_test, but calling $test.method_test doesn't execute the print function in the method. It just throws a nil error referencing the eval(script) line of game_interpreter and crashes the project. I tried calling it in a script rather than an event, and it throws the same error, citing the line of the $test call. Its probably something stupid easy I'm missing, but I've tried everything I can think of and uncle Google hasn't been of much help. Anyone know what the issue is?

Zexion

Post the code pls.
It should work as normal o.o

blackhat91

That's what I thought... Here's the code:

class Testerino
  def create_wep
    p "why the *** won't you work?"
  end
end


$testerino.create_wep does not work as a call. Obviously got frustrated, cleared the method and put that print while I was troubleshooting, it case it looks off :). I have no idea why that doesn't work, but I change it to a module it works fine with self.create_wep. I can work with that for now, but I really would like to know why that isn't working... Its also the only non-rtp script I have in the project, and the only edit to RTP I've made was adding the call to test it in scene_title, before which it still gave me the error.

KK20

Just like to point out that print/p don't work like they do in RGSS3 as they did in RGSS. You have to use msgbox or msgbox_p instead.
You can change that by adding this anywhere in your script collection:

def print(*args)
  msgbox(*args)
end

def p(*args)
  msgbox_p(*args)
end

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

blackhat91

Quote from: KK20 on July 12, 2014, 03:11:55 pm
Just like to point out that print/p don't work like they do in RGSS3 as they did in RGSS. You have to use msgbox or msgbox_p instead.
You can change that by adding this anywhere in your script collection:

def print(*args)
  msgbox(*args)
end

def p(*args)
  msgbox_p(*args)
end



Aside from not popping up a box and just bring the print up in console, is there a big difference in 3? Or does that code just bring the box from 1 back? 'Cause the p command works fine for me, I can see what I wanted printed.

KK20

Brings back the MessageBox that print/p would do in RGSS. p doesn't do that for me in RGSS3.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!