Welcome Guest ( Log In | Register )

[ Big| Medium| Small] -



Post new topic Reply to topic  [ 148 posts ]  Go to page Previous  1, 2, 3, 4, 5
    rey meustrus
  Mon Jul 12, 2010 4:51 am
Master of Dark Magic
User avatar
Sponsor

Party Mascot
SephirothSpawn wrote:
I came up with some pretty cool method modifications for the Hash class that allows you to read and set multi-dimensioned hashes without the work it had before. It also allows you to use classes with [] and []= methods.

...


Couldn't this be done simply with default values? Like so:

Expand to see the code.


Haven't tested it, and it could be tricky since MULTI_HASH is recursive. It might be better done as a class with a recursive initializer (again, not tested):

Expand to see the code.

_________________
Image


Top Top
Profile      
 

    Zeriab
  Fri Jul 30, 2010 5:54 pm
Hugging Lion
User avatar
Sponsor

I have created a snippet which reads the the configurations from the F1 menu and removes game pad support: (Keep going left/right? If this fixes the problem then garbage from a (non-existing?) game pad is the cause)

http://paste-bin.com/view/a84fb1d3 (XP)
http://paste-bin.com/view/5fa9f97f (VX)

Changes in the F1 menu are first added to the registry when the game is closed, so you cannot use the method for checking changes at runtime.

I hope that scripters of input modules will use this information to make their scripts even more awesome :3

*huggles*

_________________
Image
Image
Image
Image
Image


Top Top
Profile      
 

    kyonides
  Sat Jul 31, 2010 12:47 am
Member

Just remember that you can't automatically save Procs with Marshal.dump. (You'll need to write your own _dump method to include such feature.)


Top Top
Profile      
 

    Zeriab
  Sun Sep 05, 2010 9:41 am
Hugging Lion
User avatar
Sponsor

Here is a little script which you can use to check for transfer inconsistencies in your project: http://paste-bin.com/view/e5d0d0e3
Yes, I know it is ugly, but I am too lazy to make it pretty.

*hugs*

_________________
Image
Image
Image
Image
Image


Top Top
Profile      
 

    Zeriab
  Sat Sep 11, 2010 2:54 pm
Hugging Lion
User avatar
Sponsor

I made a new F12 reset script which keeps debug mode if on: http://paste-bin.com/view/0e59aa30

_________________
Image
Image
Image
Image
Image


Top Top
Profile      
 

    kyonides
  Sat Sep 11, 2010 10:09 pm
Member

What about this?

# XP or VX
exec = game_exe + ($DEBUG ? ' debug' : ' test')


Top Top
Profile      
 

    Zeriab
  Sun Sep 12, 2010 6:14 am
Hugging Lion
User avatar
Sponsor

Bad idea since it would cause debug mode to be enabled in VX whenever you press F12. (Maybe it won't be a problem for encrypted games RMVX games)
You are also forgetting a space.

Btw. notice that exec is a Kernel method just like system, but that I can make a local variable using the same name.

*hugs*

_________________
Image
Image
Image
Image
Image


Top Top
Profile      
 

    kyonides
  Sun Sep 12, 2010 8:33 pm
Member

# XP or VX
exec = game_exe + ($DEBUG ? ' debug' : $TEST ? ' test' : '')

What space did I forget in any of these proposals?


Top Top
Profile      
 

    regi
  Sun Sep 12, 2010 8:38 pm
raptor king
User avatar
Sponsor

Generally there's nothing wrong in trying to simplify code, but too many conditionals in one line can clutter code or make it hard to understand. Nonetheless both methods work.


Top Top
Profile      
 

    Zeriab
  Sun Sep 12, 2010 10:09 pm
Hugging Lion
User avatar
Sponsor

My mistake about the spaces >_>

It looks like it will work just fine (I haven't checked)
It will complicate the snippet unnecessarily, but it is nice that you are trying to experiment with different structures :cute:

*hugs*

_________________
Image
Image
Image
Image
Image


Top Top
Profile      
 

    trebor777
  Mon Sep 27, 2010 4:16 pm
Member

Hey guys: Here is a Tool Set script i finally made since i'm using it quite a lot, easier to have in one place !

Originally Made when I started Castlevania 3 years ago; I today compiled all in one place and improved the code I used a tiny bit.

Everything is explained in the Comments, I think you'll like it a lot !

Expand to see the code.



With this :) you can edit your code while testing the demo at the same time... :) if you use load_scripts, the edited scripts will be reloaded with F12 without problems, avoid losing time in closing demo, editing, saving, launch demo

Having a console to display your message, in a non blocking way(no dialogs freezing the game), helps a lot too ^^

HAve fun :thumb:


Top Top
Profile      
 

    kaB00M
  Mon Sep 27, 2010 9:55 pm
um...
User avatar
Member

Well thanks a lot trebor. The p method override is a charm. But I don't understad how to edit the code live. can you be a little more especific.
Thanks in advance.


Top Top
Profile      
 

    trebor777
  Mon Sep 27, 2010 10:16 pm
Member

Well if you extract the scripts you want,
and then load them with the methods provided,

While you change your code on the extracted file, you can have the demo runnning :), and just F12 after you save the code, that reset the demo, and reload the extracted files :)


Top Top
Profile      
 

    Draycos Goldaryn
  Wed May 04, 2011 4:52 am
The Goldyn Scaly One
User avatar
Member


Location: My own Phantasy Realm
defining/redefining methods on a per object basis....???

Was sleeping and dreamed of rgss coding.... Any-who, in the dream I had an idea to create an "on_Mouse_Over event like thing for some buttons in my windows.

Warning: This spoiler contains dream code which is not to be actually used in an actual project


I may not have explained that very well, but I am still sort of half asleep... Weird how I come up with my best ideas in my sleep and they actually translate successfully to real life.

Another one you can actually insert into a project to test out. Real Code just insert it above main:

Expand to see the code.


This opens up a whole new world of possibilities....

Did anyone else know this was possible?

*runs off to get more ideas while sleeping*

_________________
Scripts that I made

And now for some fun:
Popular Quotes with a Goldaryn Twist! (Updated 2011-08-25)


Top Top
Profile      
 

    Gust
  Wed May 04, 2011 5:34 pm
User avatar
Member


Location: Brazil
Pretty cool, I didn't know that was possible. Usually I would do that by storing Proc objects, which are code blocks.

Expand to see the code.


Top Top
Profile      
 

    rey meustrus
  Fri May 06, 2011 7:58 pm
Master of Dark Magic
User avatar
Sponsor

Party Mascot
What you have discovered is Ruby's singleton classes. What you have done with those few lines of code is to implicitly define a singleton class on the @button object and define a method on that class. Singleton classes are awesome, but you have to be careful with them. The only thing I can think of right now is that they can't be Marshal'ed, so you shouldn't use singleton classes in the game objects.

Did you know that you can initialize an object with a block? You could do something like this:

Expand to see the code.


When you prefix the last argument with &, that variable is a Proc object containing the passed block. This isn't the only way to use the block, of course, but it is the best way to store the block for later use.

One excellent thing you could do with this is have the button's event modify things in the scene, like so:

Expand to see the code.

_________________
Image


Top Top
Profile      
 

    Draycos Goldaryn
  Fri May 06, 2011 10:19 pm
The Goldyn Scaly One
User avatar
Member


Location: My own Phantasy Realm
Rey, That is awesome. Thank you for explaining all of that. It makes much more sense now, really. And I will definitely be putting something like that to use. You see, I'm redoing the window class and rearranging the window-skin to use scroll bars instead of just displaying an arrow when the window can scroll, among other things. what you have shown me, i think will make some things a little easier on me.

Again, Thank you.

_________________
Scripts that I made

And now for some fun:
Popular Quotes with a Goldaryn Twist! (Updated 2011-08-25)


Top Top
Profile      
 

    rey meustrus
  Mon May 09, 2011 12:03 am
Master of Dark Magic
User avatar
Sponsor

Party Mascot
I don't think you can efficiently remove the arrows from the window class, but you can add a scroll bar. Scrolling is based on window.ox and window.oy . The arrows appear when the bitmap is larger than the window (minus the margin), so to remove them you'd either have to rewrite the Window class without arrows or intercept #contents so that the "real" contents are never too big and the pretend contents are written to the window. The first solution is pretty hard (though I have such a rewrite if you're interested), and the second solution would end up being really inefficient.

_________________
Image


Top Top
Profile      
 

    Draycos Goldaryn
  Tue May 10, 2011 8:03 am
The Goldyn Scaly One
User avatar
Member


Location: My own Phantasy Realm
I'm already using Selwyn's rewrite and modifying it to work. so far so good, though I did have to make a few corrections as he made a few errors when he cut up the windowskin. I already got it to work, almost, just have to add actual mouse scrolling and a few other features to the windowskin similar to rmvx.

_________________
Scripts that I made

And now for some fun:
Popular Quotes with a Goldaryn Twist! (Updated 2011-08-25)


Top Top
Profile      
 

    trebor777
  Sat Aug 06, 2011 3:17 pm
Member

Here is something I've noticed more and more in the ruby world :) and it's really helpful and very flexible for coders and makes code easier to read as well!
Maybe some people already figured it:

So instead of using the classical way of using arguments.
Expand to see the code.


here is a more flexible one, using hashes! Although it's mostly useful for the initialize method.

Expand to see the code.

Hope it helps ! :biggrin:


Top Top
Profile      
 

    BlueScope
  Sun Aug 07, 2011 12:54 am
The Third Man
User avatar



Location: Germany
Yeah, definately will be helpful... reminds me of the way of using arrays to decide between multiple arguments, while obviously the purpose is different (still, the array will save you the few milliseconds of processing that hashes eat up... while it's probably not the best coding style).
Expand to see the code.

Just for completeness' sake ;)

_________________
Image

If you have a slightly positive memory of my Power Shift contest game,
you might be interested in this development screenshot...
More info about that soon!


Top Top
Profile      
 

    rey meustrus
  Wed Aug 10, 2011 2:28 pm
Master of Dark Magic
User avatar
Sponsor

Party Mascot
Actually, I've heard that hashes are faster than arrays in Ruby. It sort of makes sense when you think of all the different access styles from the array[] method, and how arrays might have to recreate the entire array at O(n) to resize whenever a value is added, while a hash only needs to compute the hash at O(1).

_________________
Image


Top Top
Profile      
 

    BlueScope
  Sun Aug 14, 2011 1:36 pm
The Third Man
User avatar



Location: Germany
Hm... well, can't say I tested it myself or anything, so I can't really say anything... might do some testing later (if I remember it :blank: )

_________________
Image

If you have a slightly positive memory of my Power Shift contest game,
you might be interested in this development screenshot...
More info about that soon!


Top Top
Profile      
 

    BlueScope
  Sun Aug 14, 2011 6:48 pm
The Third Man
User avatar



Location: Germany
More or less completely unrelated, I put a fancy little snippet together that allows to round any Float to the nearest number on a base you can choose yourself. For example, let's say you want to round to the half numbers, choose a base of 0.5 - for example, 4.345674.round_to_nearest(0.5) will return 4.5.
The other two methods are for rounding up or down, respective to the .ceil and .floor methods.

Expand to see the code.

If you don't set a parameter, they will give you a equivalent to Float.round (or .ceil or .floor), however without the option to round to certain floating point digits. It should therefore be a tad faster than the original .round, however I wouldn't suggest using it as a replacement for the default for compatibility and readability reasons.

Hope this will be useful to someone.

_________________
Image

If you have a slightly positive memory of my Power Shift contest game,
you might be interested in this development screenshot...
More info about that soon!


Top Top
Profile      
 

    BlueScope
  Sun Oct 30, 2011 3:43 am
The Third Man
User avatar



Location: Germany
I wonder if anyone besides me ever does the little things anymore... but hey, at least someone does ;o

This time I got a custom z-level script for events, originating on a request from Peri that vanished by the time I'm writing this. Well, here you go:
Initial version - use the one in ForeverZer0's next post instead


By putting for example z50 in the event name, you will set a custom z-level of 50 for the event, with the default being 200. You can actually do al kind of weird combinations for the event name, for example "lshgishgpz567holjsdn", which will set the z-level to 567. This might be good or not, but it's the easiest and leat limiting way.

Another thing I should mention is that the 'Always on Top' flag will overwrite the custom z-level setting and set the event to the default 999. If you don't flag it, however, you can set values higher than that to make events appear even over events flagged as 'Always on Top'. That might not seem logical, and is only intended for special appliances - you should stick to values from 0 to 998 normally.

_________________
Image

If you have a slightly positive memory of my Power Shift contest game,
you might be interested in this development screenshot...
More info about that soon!


Last edited by BlueScope on Sun Oct 30, 2011 1:55 pm, edited 1 time in total.

Top Top
Profile      
 

    ForeverZer0
  Sun Oct 30, 2011 7:27 am
ARC Developer
User avatar
Sponsor


Location: United tates
That's way more complicated than it need to be. You don't need to create an attr_reader in Game_Event, then have the actual code in Game_Character, and then use an "if" to make sure its a Game_Event again. You should just keep the whole thing in Game_Event. After that, your doing the same RegEx, which are hard on performance, twice in a row, and it is overly complicated. And on top of all of that, the "height=0" in the alias call is not going to work. The code should look something like this:

Expand to see the code.

_________________
Use DropBox to upload your files. Much simpler than other upload sites, you can simply place a folder on your desktop that will sync with your DropBox account. ;)

Looking for a more powerful RMXP? Check out Image

My complete script list on Pastebin


Top Top
Profile      
 

    BlueScope
  Sun Oct 30, 2011 1:54 pm
The Third Man
User avatar



Location: Germany
Yeah, that's indeed a lot simpler... the height thing I totally overlooked (and I don't think it gave me an error in the past... well, don't really have anything to test it at all, so... :/ ), and to be honest, I totally confused the order of the classes and thought Game_Event was the superclass of Game_Character... >> Well, it was late, I suppose... >>"

Thanks for those hints there.

_________________
Image

If you have a slightly positive memory of my Power Shift contest game,
you might be interested in this development screenshot...
More info about that soon!


Top Top
Profile      
 

    aphadeon
  Fri Aug 01, 2014 4:31 am
1987-2023
User avatar
Staff

Generic Townsperson
It's been awhile since I posted a script. So have a quickie.

Expand to see the code.


I get tired of juggling/managing aliases. I have my own alternatives in larger projects, but for tinkering in a clean sandbox, I always end up reimplementing it. This reduces alias tacking to 1 line.
Usage example:

Expand to see the code.



If you don't get what this does, the miniscript allows the example to do exactly the same thing as this:

Expand to see the code.


Not the biggest change in the world. But if your code tends to squirm and tendril its way across all the various classes requiring a few dozen or more hooks, this will trim the code size significantly. And its faster.

_________________
Image ImageImage


Top Top
Profile      
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 148 posts ]  Go to page Previous  1, 2, 3, 4, 5


Who is online

Users browsing this forum: No users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

We are an independent, not-for-profit game making community.
Homepage
Board Index
About Us
Downloadable Games
Free Browser Games
Games in Development
RPG Maker Support
Game Maker Support
Construct 2 Support
HBGames the eZine
Advanced RPG Maker
Site Announcements
Powered by phpBB © phpBB Group