left right right
left_navi_top

Scheduler V1 Englisch Braucht keine Sprache RPG Maker XP RPG Maker VX Läuft manchmal Benötigt kein SDK Benötigt kein APD Kein Mex-Code

Autor Autor Zeriab
Läuft Läuft Läuft manchmal
0
Noch keine Bewertungen
Your rating: Keines

Inhaltsverzeichnis Inhaltsverzeichnis1. Einleitung
2. Instructions
3. Credits and Thanks
4. Author's Notes

1. Einleitung

How many of you tried creating a parallel process where you put in an amount of frames and then a script call or something else afterwards? Basically a simply way of doing something after an amount of frames.

This is the principle behind the script. To schedule pieces of code to be executed after an arbitrary amount of frames. No making decrementing counters. The scheduler takes care of all that or well most of it. It is still not as simple as using the wait event command.

2. Instructions

You can schedule in two ways.
You can do a one-time schedule which works like this: (Using the class method)

  1. Scheduler.schedule(frames, callable, *arguments)
  2. # Here's an example
  3. Scheduler.schedule(65, Proc.new {|x,y| p x,y}, "A string", 42)

The 65 means that the proc will be called after 65 frames. (Or 65 ticks to be more precise. 1 update = 1 tick usually)
After 65 ticks the proc {|x,y| p x,y} will be called with the arguments x = "A string" and y = 42. (The *arguments means any number of arguments. This can also be no arguments at all)
The Scheduler uses duck typing and assumes that anything which has the .call method works properly in the context. I imagine procs and methods to be the most commonly used.

The next is that you can schedule a recurring call which works like this: (Using the class method)

  1. Scheduler.schedule_recurring(frames, frames_to_wait, callable, *arguments)
  2. # Here's an example
  3. Scheduler.schedule_recurring(65, 30, Proc.new {|x,y| p x,y}, "A string", 42)

The arguments is the same as for the one-time with the addition of the frames_to_wait argument.
This specifies that after the first 65 ticks each recurring call will happen after 30 ticks.
This will continue until the callable returns FalseClass. (Mind you it's false.class and not false)

Now you have to update the schedule every frame or it won't schedule properly.

Note that the class methods only work for one scheduler. I believe this should be the generally working Scheduler.
Compatibility

The Scheduler alone use only Ruby and could easily be placed in a Ruby if one wanted that.
It is highly unlikely that you will encounter any compatibility issues with the backbone alone since it is independent from RGSS/2 library.

On the other side there could potentially be problems with the bindings which makes use of the scheduler so it actually does something in game.
Currently there is only the Graphics.update binding which makes compatibility issues very unlikely.
Future Work

  • Explicitly exit/stop a scheduler. The scheduled items can then be discard, executed or maybe something else.
  • Error handling. (This may be an external. I.e. not embedded in the core)
  • Documentation

3. Credits and Thanks

Credits goes to Zeriab for creating the system

I would like to thank everyone using their time to try and use my system.
I would like to thank everyone reading this topic.

Thanks.

4. Author's Notes

I would be delighted if you report any bug, errors or issues you find.
In fact I would be delighted if you took the time and replied even if you have nothing to report.
Suggestions are more than welcome.

Note that I will release a demo which shows a couple of ways of using this script.
Note also that I will always make a post when I have an update. (Small stuff like typos excluded)

And finally: ENJOY!

- Zeriab

Inhaltsverzeichnis Inhaltsverzeichnis1. Allgemein Allgemein
2. Compatibility Notes Compatibility Notes3. statistics statistics
4. Hilfe Hilfe

1. Allgemein Allgemein

Sprache Sprache Englisch, Braucht keine Sprache
Maker Maker RPG Maker XP, RPG Maker VX
SDK SDK Benötigt kein SDK
APD APD Benötigt kein APD
Mex Mex Kein Mex-Code
RDoc Documentation RDoc Documentation

2. Compatibility Notes Compatibility Notes

2.1. Used Classes Used Classes

  • Mapping
  • Order
  • RecurringOrder
  • Scheduler
  • allows
  • self
  • with

2.2. Used Modules Used Modules

  • Graphics

2.3. Aliasses Aliasses

  • alias :scheduler_update :update

3. statistics statistics

Files Files 2
Classes Classes 4
Modules Modules 1
Methods Methods 15
Elapsed Elapsed 0.7s
Erstellt Erstellt 01.11.2009
Counter Counter

4. Hilfe Hilfe

Was ist ein Maker? Was ist ein Maker?
Was ist RGSS? Was ist RGSS?
Inhaltsverzeichnis Inhaltsverzeichnis1. Installation Installation
2. Quellcode Quellcode

1. Installation Installation

  1. Öffne dein Projekt mit dem Maker. Danach öffne mit F11 den RGSS Editor, scrolle links die Liste bis zum Schluss. Klicke dann rechts auf 'Main' und dann 'Insert'. Nenne das neue Skript Scheduler V1 und füge auf der rechten Seite ein: Quellcode Weiterlesen Weiterlesen
Probleme? Frag doch im Forum nach! Probleme? Frag doch im Forum nach!

2. Quellcode Quellcode

Anzeigen Anzeigen
Scheduler.rb Scheduler.rb (5.9 KB)
Monsters Script Explorer Monsters Script Explorer
Permalink Permalink
XML XML
Forumlink Forumlink
HTMLlink HTMLlink
Forumthema Forumthema


bottom bottom bottom