autorun_e(ID)

Description: Have any suggestions or new ideas for SMBX-38A? This is a place for you. Good suggestions may appear in future versions of SMBX-38A.
Moderators: Lx Xzit, Yoshi021, 5438A38A, Semi-moderatos, Moderators

Lx Xzit M
Topic author, Moderator
Moderator
Avatar
Lx Xzit M
Topic author, Moderator
Moderator
Reputation: 399
Posts: 753
Joined: 9 Nov 2015
Website

Post #1by Lx Xzit » 15 Dec 2019, 21:01

This function would let us know when the conditions to execute an autorun event are met, without having to make an autorun event and adding a flag or make it trigger an script. The main advantage of this is that scripts would require less user-intervention, plus it would help to our scripts to be more organized.

It should be read-only and the only parameter is the ID of the auto-run event (starting from "P Switch - Start"):

Spoiler
Image

Here's an example of an usage.

Code: Select all

do
   if autorun_e(3)
      call showmsg("The level has ended!")
   end if
   call sleep(1)
loop


This would open a lot of possibilities, like executing a script when an NPC dies/gets killed, when the player gets a power-up or gets hurt, etc.. All without having to do messy autorun events triggering.
VISIT MY YOUTUBE CHANNEL! LX XZIT
Join our 38A Discord server!

Image

Victor ManuelMR M
Marquis
Marquis
Avatar
Victor ManuelMR M
Marquis
Marquis
Age: 19
Reputation: 99
Posts: 194
Joined: 7 Feb 2018

Post #2by Victor ManuelMR » 16 Jan 2020, 2:53

Lx Xzit wrote:This function would let us know when the conditions to execute an autorun event are met, without having to make an autorun event and adding a flag or make it trigger an script. The main advantage of this is that scripts would require less user-intervention, plus it would help to our scripts to be more organized.

It should be read-only and the only parameter is the ID of the auto-run event (starting from "P Switch - Start"):

Spoiler
Image

Here's an example of an usage.

Code: Select all

do
 if autorun_e(3)
 call showmsg("The level has ended!")
 end if
 call sleep(1)
loop


This would open a lot of possibilities, like executing a script when an NPC dies/gets killed, when the player gets a power-up or gets hurt, etc.. All without having to do messy autorun events triggering.


For example, how could I activate a death event if the second or first player dies?
and another, was the script supposed to repeat this sample message several times?
Image
[1.4.5] - Dream Team at The Challenging Portals:
Image

NESTED ERNEST M
Count
Count
Avatar
NESTED ERNEST M
Count
Count
Reputation: 71
Posts: 261
Joined: 23 Sep 2017
Location: Perú, Lima
Website

Post #3by NESTED ERNEST » 16 Jan 2020, 5:25

I am sorry to disappoint you, but the truth is that this suggestion was not added (ie it doesn't work), you can put autorun_e(3) or autorun(3) or autorublablablamm(3) or asujkdhsiuak and this will continue to run.
Programming NPCs in SMBX-38A is fun:
That is me
Image
Image
Image
Image

ROCKMAN GIF IN SMBX 38A

Image

Lx Xzit M
Topic author, Moderator
Moderator
Avatar
Lx Xzit M
Topic author, Moderator
Moderator
Reputation: 399
Posts: 753
Joined: 9 Nov 2015
Website

Post #4by Lx Xzit » 16 Jan 2020, 5:29

NESTED ERNEST wrote:I am sorry to disappoint you, but the truth is that this suggestion was not added (ie it doesn't work), you can put autorun_e(3) or autorun(3) or autorublablablamm(3) or asujkdhsiuak and this will continue to run.

I just noticed that
VISIT MY YOUTUBE CHANNEL! LX XZIT
Join our 38A Discord server!

Image

NESTED ERNEST M
Count
Count
Avatar
NESTED ERNEST M
Count
Count
Reputation: 71
Posts: 261
Joined: 23 Sep 2017
Location: Perú, Lima
Website

Post #5by NESTED ERNEST » 30 Mar 2020, 20:33

1.4.5 path 29 does can detect the error.
Programming NPCs in SMBX-38A is fun:
That is me
Image
Image
Image
Image

ROCKMAN GIF IN SMBX 38A

Image

NESTED ERNEST M
Count
Count
Avatar
NESTED ERNEST M
Count
Count
Reputation: 71
Posts: 261
Joined: 23 Sep 2017
Location: Perú, Lima
Website

Post #6by NESTED ERNEST » 10 Sep 2020, 3:18

A more serious answer(Although it is a possible information for other readers) (I can be right) (this is hypothetical)

If this were added I think this would not be 100% as you think: that script (that he put above) you would not have to put it in a loop and that script would have to be executed within an event "called" "the last event to execute all events "and that function called autorun would only work in the execution of that particular script in that particular event(Well an autorun with a higher index if you could read a previous one within an autorun original event)(you would not have to put that script in the Level - Start event, that hypothetical function would always return 0 and you would interpret it as an error). And the original event would be executed first and then this one, since it is executed in the "last event of all", so be careful.

Added after 16 hours 46 minutes:
I forgot.

Victor ManuelMR wrote:For example, how could I activate a death event if the second or first player dies?

That "problem" you raise, we actually already have them(without this suggestion): they can be solved with programming.

In this script, on Death Event, execute each player's kill once:
Spoiler
(This scritp doesn't take into account the resurrection of the player so if the player revives you have to do v(death1)=0 and v(death2)=0)

Code: Select all

if v(death1)=0 then
   if char(1).alive=0 then
   'scripts
   v(death1)=1
   end if
end if

if sysval(gamemode)>0 then   
   if v(death2)=0 then
      if char(2).alive=0 then
      'scripts      
      v(death2)=1
      end if
   end if
end if

Victor ManuelMR wrote:was the script supposed to repeat this sample message several times?

It is the same as normal, this would reset the value of the "autorun ()".
Programming NPCs in SMBX-38A is fun:
That is me
Image
Image
Image
Image

ROCKMAN GIF IN SMBX 38A

Image


Return to “Ideas & Suggestions”

Who is online (over the past 5 minutes)

Users browsing this forum: 2 guests