Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Syntax questions...

I have a few questions about special syntax in RGSS.

First, what is '<<'? I've seen it as 'class << self' many times, and I've even looked in the help file, but I haven't found anything out so far...

Next, how do you use 'Win32API'? I have no idea which methods I can call with it, other than the ones needed for my Mouse Module.

And how do symbols work? Like, I get 'method_defined?:)method)', but why does it need to be a symbol???

And (not really syntax, but...) how do I print constants, local variables, etc. from hidden classes? Ex: 'p File.<whatever>'.

Thanks for any answers.
 
for an array, it's a kinda push:
Code:
a=[1,2]<<3
idem for a string.
For files, you can write with it:

Code:
@myfile << 'data'

and for classes:

Code:
module Test

  class << self

  end

end

push the module into a class:

Code:
module Test

  def Test.method

  end

end

is the same as:
Code:
module Test

  class << self

     def method

     end

  end

end

regards,
berka
 
Near":25eafo1h said:
Cool beans.

What about Win32APIs?

Much too advanced for most of us. They can cause serious issues if you make a mistake. (For example, I once accidentally changed my monitor resolution to 320x240 accidentally. That was a pain to fix)

And before you ask why I didn't give you the syntax, I'll tell you. I don't really know it. Ruby syntax for Win32API is more than a little tedious, and I never really learned it.
 
Cool, but I know what Win32API does. I want to know what functions there are and what arguments, and some info on which ones need to be unpacked.

Also, I have one more question.

What does it mean when you do this:

str = " " * 8
# like that

And then, with the APIs:

wapi.call(str)
str.unpack("LL")
# How do you figure out what you need for a string and how many times?
 
Go here if you want to see the complete documentation on Win32API. It's the official library by microsoft. Incidenatlly, some functions have rather interesting descriptions. I remember one that supposedly tells you if your computer is slow. (To quote, it returns "non-zero if your computer is slow")
 

Zeriab

Sponsor

Like I said, it depends on the functions in the DLL files.
You need to look up the documentation of the functions you want to use. For functions provided by Microsoft I would suggest looking at: http://msdn.microsoft.com/en-us/library
There is a lot of information there and it may be difficult to extract the relevant information.
This will only give you a subset of the possible arguments.

Consider for a moment this class
[rgss]class Wrapper
  def initialize(klass, *args)
    @object = klass.new(*args)
  end
 
  def call(method, *args)
    @object.send(method, *args)
  end
end
[/rgss]
It can for example be used like this:
[rgss]w = Wrapper.new(Array, 5)
p w
w.call:)<<, "boha")
p w
w.call:)[]=, 2, 14)
p w
print w.call:)inspect)
[/rgss]
Notice that the Wrapper creates an object of the passed class with the given arguments.
The call method sends the method along with arguments for the method onto the object.

What you are asking for is roughly the same as asking for the complete syntax list for my Wrapper class.
You are asking for listing all the possible exported function in all the available DLLs and what they do.

As for what " " * 8 does you can find the answer here: http://www.ruby-doc.org/docs/Programmin ... String._st
Same with the .unpack("LL")

The wapi.call depends on the arguments used when creating the Win32API object. (Just like with my Wrapper class)

*hugs*
- Zeriab
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top