Jump to content


Photo

Ruby/RGSS3 questions that don't deserve their own thread


  • Please log in to reply
1589 replies to this topic

#1581 Whale

Whale

    Advanced Member

  • Ace Member
  • 74 posts

Posted 08 December 2014 - 06:01 PM

Excuse me, does rand(x)

 

a) generate a random integer between 1 and x, (including 1 and x)

 

b ) a, but not including x

 

c) generate a random integer between 0 and x, (including 0 and x)

 

d) c, but not including x


Edited by Whale, 08 December 2014 - 06:01 PM.


#1582 Omegas7

Omegas7

    The One Who Is.

  • Ace Member
  • 50 posts
  • LocationCosta Rica
  • RM Skill - Coder

Posted 08 December 2014 - 06:13 PM

It generates a random integer between 0 and x, including 0 but excluding x. So it would be D.



#1583 Whale

Whale

    Advanced Member

  • Ace Member
  • 74 posts

Posted 08 December 2014 - 06:20 PM

Thanks, that's what I figured it'd be.



#1584 William C

William C

    Sanubian Menace

  • Ace Member
  • 914 posts
  • RM Skill - Jack of All Trades

Posted 10 December 2014 - 06:11 PM

Hmm, had a thought. Can an alias be overwritten, to effectively stop the alias from ever happening? For example, if two scripts have the same aliases on the same method, is the first alias overwritten and only the second alias executed, or do they both execute anyway?


My Completed Scripts: http://pastebin.com/u/WCouillard


#1585 KilloZapit

KilloZapit

    FAIRY DUST! FAIRY DUST FOR EVERYONE! WHEE!

  • Ace Member
  • 1,009 posts
  • LocationFairyland!
  • RM Skill - Coder

Posted 10 December 2014 - 06:41 PM

I think so... that's why people have such long alias names with their name and the name of the script in it isn't it? To prevent that from happening?



#1586 William C

William C

    Sanubian Menace

  • Ace Member
  • 914 posts
  • RM Skill - Jack of All Trades

Posted 10 December 2014 - 06:52 PM

I was always under the impression that aliasing something with the same name twice would cause a StackError. Good to know!


My Completed Scripts: http://pastebin.com/u/WCouillard


#1587 KilloZapit

KilloZapit

    FAIRY DUST! FAIRY DUST FOR EVERYONE! WHEE!

  • Ace Member
  • 1,009 posts
  • LocationFairyland!
  • RM Skill - Coder

Posted 10 December 2014 - 07:22 PM

Well, yeah, I think that's a result of that happening... I mean if you have two methods that you alias with the same name both which call the alias you end up with a method that calls a method that calls it's self.



#1588 William C

William C

    Sanubian Menace

  • Ace Member
  • 914 posts
  • RM Skill - Jack of All Trades

Posted 10 December 2014 - 09:30 PM

So how would one patch a script for compatibility if someone else's aliased method is breaking the script if you can't overwrite their aliases?


My Completed Scripts: http://pastebin.com/u/WCouillard


#1589 KilloZapit

KilloZapit

    FAIRY DUST! FAIRY DUST FOR EVERYONE! WHEE!

  • Ace Member
  • 1,009 posts
  • LocationFairyland!
  • RM Skill - Coder

Posted 10 December 2014 - 10:13 PM

You could try using their aliases, I have done that once or twice. Instead of aliasing a method and calling the alias just overwrite the method and call the alias that script already made. Just remember what an alias actually is. You are just making a copy of a method with a new name. People do it so they can overwrite the original name and call the copy.

 

You know actually given that aliases make copies of methods, you might be able to unalias something simply by calling the alias in reverse... Imagine a script uses something like "alias alias_method method" to make a copy of the original method... what if you just copied it back using "alias method alias_method"?


Edited by KilloZapit, 10 December 2014 - 10:23 PM.


#1590 William C

William C

    Sanubian Menace

  • Ace Member
  • 914 posts
  • RM Skill - Jack of All Trades

Posted 10 December 2014 - 11:24 PM

^ Now, there's an idea! I like it! Ha!


My Completed Scripts: http://pastebin.com/u/WCouillard





1 user(s) are reading this topic

1 members, 0 guests, 0 anonymous users