Event equivalents in Lua?

This is the place for discussion and support for LunaLua and related modifications and libraries.

Moderator: Userbase Moderators

Forum rules
Before you make a topic/post, consider the following:
-Is there a topic for this already?
-Is your post on topic/appropriate?
-Are you posting in the right forum/following the forum rules?
darkhog
Buster Beetle
Buster Beetle
Posts: 87
Joined: Sat Dec 10, 2016 11:17 pm

Event equivalents in Lua?

Postby darkhog » Sun Dec 11, 2016 9:37 am

Does anyone have an example that shows Lua equivalents of events? Basically Lua code that does what each and every event does. Would help me greatly learning SMBX-specific stuff (no problem with learning Lua itself as I've used it previously, but need some examples and time to become accustomed with smbx-specific stuff)

PixelPest
Link
Link
Posts: 7111
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Contact:

Re: Event equivalents in Lua?

Postby PixelPest » Sun Dec 11, 2016 12:13 pm

I'd recommend taking a look at these:

http://wohlsoft.ru/pgewiki/Section_(class)
http://wohlsoft.ru/pgewiki/Layer_(class)
http://wohlsoft.ru/pgewiki/LunaLua_glob ... _functions

These classes can basically cover most of the event stuff.

And then there's also:

Code: Select all

triggerEvent(string eventname)

MECHDRAGON777
Pink Yoshi Egg
Pink Yoshi Egg
Posts: 6422
Joined: Fri Dec 20, 2013 6:40 pm
Flair: Nuclear Queen of Reversion.
Contact:

Re: Event equivalents in Lua?

Postby MECHDRAGON777 » Sun Dec 11, 2016 10:24 pm

PixelPest wrote:I'd recommend taking a look at these:

http://wohlsoft.ru/pgewiki/Section_(class)
http://wohlsoft.ru/pgewiki/Layer_(class)
http://wohlsoft.ru/pgewiki/LunaLua_glob ... _functions

These classes can basically cover most of the event stuff.

And then there's also:

Code: Select all

triggerEvent(string eventname)
In theory, could you construct a 22nd section with the constructure?

PixelPest
Link
Link
Posts: 7111
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Contact:

Re: Event equivalents in Lua?

Postby PixelPest » Sun Dec 11, 2016 10:26 pm

I don't think so. It's not really a "constructor", it's more acts as a lasso I guess you could say. It returns the object of something already existing

darkhog
Buster Beetle
Buster Beetle
Posts: 87
Joined: Sat Dec 10, 2016 11:17 pm

Re: Event equivalents in Lua?

Postby darkhog » Mon Dec 12, 2016 9:12 pm

I was more talking about Lua equivalents to actual event commands, e.g. showing text box in Lua or changing section settings/moving layers. So I can code in Lua nice cutscenes without the need to "chain" events just to show few text messages one after another, then move a layer (maybe it was an option in the old editor, but in the new one, you can only set one message per event, it seems).

PixelPest
Link
Link
Posts: 7111
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Contact:

Re: Event equivalents in Lua?

Postby PixelPest » Mon Dec 12, 2016 9:14 pm

Read what I said above. That's all there except for showing the message box which you can find in LunaLua Global Functions if you search PGE Wiki. I think it's Text.messageBox() but don't call me on it

Kevsoft
Ripper II
Ripper II
Posts: 375
Joined: Sun Jul 27, 2014 8:03 am

Re: Event equivalents in Lua?

Postby Kevsoft » Tue Dec 13, 2016 4:53 am

darkhog wrote:I was more talking about Lua equivalents to actual event commands, e.g. showing text box in Lua or changing section settings/moving layers. So I can code in Lua nice cutscenes without the need to "chain" events just to show few text messages one after another, then move a layer (maybe it was an option in the old editor, but in the new one, you can only set one message per event, it seems).
Most of them are global functions like
  • Text.showMessageBox(string)
  • Layer.get(string layerName)
  • Player.keyPressing*****
to name a few. I recommend using the search-function at the wiki. Almost all of the event functionalities are implemented and available in lua.

darkhog
Buster Beetle
Buster Beetle
Posts: 87
Joined: Sat Dec 10, 2016 11:17 pm

Re: Event equivalents in Lua?

Postby darkhog » Thu Dec 15, 2016 7:30 pm

I see, thanks. Maybe I'll do such index on the wiki listing each event command and how to do it in Lua for anyone in future who might want to know it, once I'll figure it out myself. Thank you.


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 1 guest

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari