Author Topic: [XP][VX] ATB Engine [Meant for Scripters]  (Read 13115 times)

Offline fugibo

  • World Conqueror
  • Chaos User
  • ******
  • Posts: 1966
  • LV: 44
    • View Profile
[XP][VX] ATB Engine [Meant for Scripters]
« on: October 17, 2008, 05:10:39 AM »
ATB Engine Script
Authors: Longfellow
Version: 1.00
Type: Battle System Component
Key Term: Scripting Tool

Introduction

This is a script utility to simplify the construction of ATB battle systems. Use it if you want.

Features

  • Simple API, very easy to use
  • Powerful, makes full use of the Object-Oriented paradigm
  • Completely stand-alone, other than the fact that it does nothing on its own

Screenshots
n/a

Script

This script is for scripters only, and thus I needn't tell you where it should go:
(click to show/hide)

Instructions

(click to show/hide)

Compatibility

Unless you declared an ATB constant somewhere, it'll be fine.

Credits and Thanks

  • Blizzard, for being Blizzard
  • Willy Wonka, for his amazing taffy

Author's Notes

n/a
« Last Edit: October 15, 2009, 04:14:45 AM by Longfellow »

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 20016
  • LV: 651
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: [XP][VX] ATB Engine [Meant for Scripters]
« Reply #1 on: October 17, 2008, 10:05:57 AM »
HOLY SHIT, 90 LINES! I LOVE YOU! :cclove:
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline fugibo

  • World Conqueror
  • Chaos User
  • ******
  • Posts: 1966
  • LV: 44
    • View Profile
Re: [XP][VX] ATB Engine [Meant for Scripters]
« Reply #2 on: October 17, 2008, 01:30:47 PM »
...you know it's only for the ATB engine, no actual Battle System code, right?

but I do like this part:
Code: [Select]
(@count = 0 ; @progress += 1) if @count >= @rate.round

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 20016
  • LV: 651
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: [XP][VX] ATB Engine [Meant for Scripters]
« Reply #3 on: October 17, 2008, 02:52:36 PM »
... -_- I just noticed. I thought this would be enough to add into the editor plus a few lines of code and voila, there goes a new ATB.
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline fugibo

  • World Conqueror
  • Chaos User
  • ******
  • Posts: 1966
  • LV: 44
    • View Profile
Re: [XP][VX] ATB Engine [Meant for Scripters]
« Reply #4 on: October 17, 2008, 05:10:37 PM »
This can still reduce the code for one quite a bit.

Sorry I'm a dissappointment, Blizz :(

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 20016
  • LV: 651
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: [XP][VX] ATB Engine [Meant for Scripters]
« Reply #5 on: October 17, 2008, 05:45:23 PM »
No, not at all. You created an engine, this isn't "nothing". That means you had to consider and plan in advance. You had to analyze the system and how it works in order to create a versatile piece of code that is supposed to work with "anything". Show me another scripter who has done the same and you'll know that you found an equal. You will find out that only the "better" scripters have done or are able to do something like this.
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline fugibo

  • World Conqueror
  • Chaos User
  • ******
  • Posts: 1966
  • LV: 44
    • View Profile
Re: [XP][VX] ATB Engine [Meant for Scripters]
« Reply #6 on: October 17, 2008, 05:48:45 PM »
That's what happens to you after two years of constantly modding Ubuntutu.

Offline Sally

  • Sallygirl :P
  • Chaos User
  • ******
  • Posts: 1283
  • LV: 12
  • Gender: Female
    • View Profile
Re: [XP][VX] ATB Engine [Meant for Scripters]
« Reply #7 on: October 18, 2008, 03:46:29 AM »
whats atb?

Offline Juan

  • Ethereal Devastator
  • ****
  • Posts: 409
  • LV: 48
  • Gender: Male
  • Evil Twin
    • View Profile
Re: [XP][VX] ATB Engine [Meant for Scripters]
« Reply #8 on: October 18, 2008, 05:01:16 AM »
active time battle system.
Dropbox Who need luck when you can make your own.
(click to show/hide)

Offline KRoP

  • Awakened Visionist
  • **
  • Posts: 89
  • LV: 0
    • View Profile
    • I have none >_>
Re: [XP][VX] ATB Engine [Meant for Scripters]
« Reply #9 on: October 24, 2008, 02:10:02 AM »
Neat.  I'm certain someone will find good use for it.

Offline Aqua

  • Lexima Warrior
  • *******
  • Posts: 2554
  • LV: 118
  • Gender: Female
  • Quack!
    • View Profile
Re: [XP][VX] ATB Engine [Meant for Scripters]
« Reply #10 on: October 15, 2009, 12:46:24 AM »
I wish I understood this more to make my own ATB... ;_____;

Offline fugibo

  • World Conqueror
  • Chaos User
  • ******
  • Posts: 1966
  • LV: 44
    • View Profile
Re: [XP][VX] ATB Engine [Meant for Scripters]
« Reply #11 on: October 15, 2009, 02:53:22 AM »
I wish I understood this more to make my own ATB... ;_____;

To be honest, I'm not even sure this works... Lemme write up something new to replace this, 'kay? :P

And here it is...
(click to show/hide)

To use it, you create an ATB handler with ATB.new, then populate it with however many groups you need (at least one). Each group is just a way to handle clients conveniently; you can start or stop all members of a group by setting that group's modifier to 0.0. Then, you populate each group with whatever clients by creating them like so:
Code: [Select]
# You give .new an argument of the client's "rate," or what percentage of their bar should fill each update.
# You can also preset the "modifier" setting here; it is a multiplier used on the rate each frame.
c = ATB::Client.new(3) do |atb_client|
  print "Hello, world!\n"
end
# You also give it a callback, which is called, obviously enough, back by the ATB engine when the bar is filled.
# The block is passed with the client as an argument, allowing
# you to reconfigure the client is need at the end of an action (say,
# setting their modified to 0 so they won't move until you want them to)

Simple enough, don't you think?

EDIT: Blah, ATB::Group should be a subclass of Array. Here you go:
Code: [Select]
class ATB < Array
class Group < Array
attr_accessor :modifier

def initialize(mod = 1.0)
super()
@modifier = mod
end

def update(mod = 1.0)
self.each do |c|
c.update @modifier * mod
end
end
end

class Client
attr_accessor :modifier, :callback, :rate

def initialize(rate, mod = 1.0)
@rate = rate
@modifier = mod
@callback = Proc.new
@count = 0
end

def update(mod = 1.0)
@count += rate * mod
if @count >= 100
@callback.call(self)
@count = 0
end
end
end

def initialize
@groups = []
end

def add_group g
@groups.push g
end

def remove_group g
@groups.delete g
end

def empty
@groups = 0
end

def update
@groups.each do |g|
g.upate
end
end
end
« Last Edit: October 15, 2009, 03:04:14 AM by Longfellow »

Offline Aqua

  • Lexima Warrior
  • *******
  • Posts: 2554
  • LV: 118
  • Gender: Female
  • Quack!
    • View Profile
Re: [XP][VX] ATB Engine [Meant for Scripters]
« Reply #12 on: October 15, 2009, 03:41:41 AM »
I appreciate you doing this :)

Just to be sure...
This only handles the actual time counting of the ATB, right?

Offline fugibo

  • World Conqueror
  • Chaos User
  • ******
  • Posts: 1966
  • LV: 44
    • View Profile
Re: [XP][VX] ATB Engine [Meant for Scripters]
« Reply #13 on: October 15, 2009, 03:50:15 AM »
I appreciate you doing this :)

Just to be sure...
This only handles the actual time counting of the ATB, right?

Yep, but it standardizes it and gives you a clean API for it. This makes it much easier to create ATB-centric effects; the version I'm about to release emphasizes that.

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 20016
  • LV: 651
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: [XP][VX] ATB Engine [Meant for Scripters]
« Reply #14 on: October 15, 2009, 10:39:47 AM »
ATB doesn't have to be a subclass of Array. Also, I think you're kinda overcomplicating this.
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline fugibo

  • World Conqueror
  • Chaos User
  • ******
  • Posts: 1966
  • LV: 44
    • View Profile
Re: [XP][VX] ATB Engine [Meant for Scripters]
« Reply #15 on: October 15, 2009, 01:06:09 PM »
ATB doesn't have to be a subclass of Array. Also, I think you're kinda overcomplicating this.

That version is outdated :/