Author Topic: [XP] Script Helper  (Read 4398 times)

Offline nathmatt

  • Chaos User
  • ******
  • Posts: 1289
  • LV: 114
  • Gender: Male
  • The Add_on King
    • View Profile
    • Nathmatt Productions
[XP] Script Helper
« on: August 24, 2010, 05:05:38 AM »
Script Helper
Authors: Nathmatt
Version: 1.5
Type: quick commands
Key Term: Scripting tool

Introduction

useful command calls

Features

  • wait
  • delay
  • map name
  • save
  • load
  • facing terrain tag

Screenshots

no screen shot needed

Demo

no demo

Script

(click to show/hide)


Instructions

place above any script calling these commands
in script

Compatibility

no compatibility issues

Credits and Thanks

  • Nathmatt

Author's Notes

post here with any suggestions or feed back
« Last Edit: August 24, 2010, 12:06:15 PM by nathmatt »
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script
(click to show/hide)

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 20005
  • LV: 651
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: [XP] Wait/Delay
« Reply #1 on: August 24, 2010, 08:16:40 AM »
I think this is kind of pointless. Both the map and the battle scene have waiting time already implemented and you don't really need it anywhere else. :/
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 SBR*

  • Chaos User
  • ******
  • Posts: 1195
  • LV: -7
  • Gender: Male
    • View Profile
Re: [XP] Wait/Delay
« Reply #2 on: August 24, 2010, 09:31:52 AM »
I think this is kind of pointless. Both the map and the battle scene have waiting time already implemented and you don't really need it anywhere else. :/

Plus this is really easy to make yourself. And more as a tip, this is even better:

Code: [Select]
def delay(frames, *args)
  frames.times {
  Graphics.update
  Input.update
  args.each {|i| i.update}
  }
end

I even added an *args, so other things can be updated during the delay.

Oh, and doesn't your

Code: [Select]
def wait(frames)
  Graphics.frame_count % frames == frames - 1
end

just return a boolean? Shouldn't it be something like this:

Code: [Select]
def wait(frames)
  frames.times {Graphics.update}
end

The Graphics.update is necessary to keep the delay.

And the methods delay and wait can be one method; just keep *args empty when you want wait.

Offline Zeriab

  • Ethereal Devastator
  • ****
  • Posts: 350
  • LV: 65
  • Mighty Scripter
    • View Profile
    • Zeriab's Junk
Re: [XP] Wait/Delay
« Reply #3 on: August 24, 2010, 10:43:06 AM »
Eek.

I am not sure I like adding a method to all objects which makes the game freeze for x number of frames.
What was the purpose of the wait method? I don't see the purpose as it is now  :???:

Since it doesn't use an information about the object you could just as well put it into a module:
Code: [Select]
module UselessUtil
  module_function
  def wait(frames)
    frames.times {
       Graphics.update
       Input.update
    }
  end
end

*hugs*

Offline ForeverZer0

  • CP's Pedophile
  • Global Moderator
  • Guardian of Chaos
  • ****
  • Posts: 3255
  • LV: 298
  • Gender: Male
  • Remember you are unique, just like everyone else.
    • View Profile
Re: [XP] Wait/Delay
« Reply #4 on: August 24, 2010, 06:22:46 PM »
In the CBS I'm creating I made a delay method someting like this...
Code: [Select]
def delay(frames)
    frames.times {
        Graphics.update
        Input.update
        $scene.update (because it is being called from another class)
    }
end

This basically will just keep it from executing anything below this line in the method until the frame count is up, without freezing the game or anything.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.