Jump to content


Photo

The Use In Trigger Events


  • Please log in to reply
126 replies to this topic

#1 onpon4

onpon4

    GMC Member

  • GMC Member
  • 1175 posts
  • Version:GM8

Posted 11 February 2010 - 10:38 PM

My understanding of trigger events is that it executes the given code every step, then does the event if it returns 1 (true).

So I just don't get it; what is the point in using trigger events?

I can see two uses for them:
1. Better organization
2. Separation from code allows it to be called in other places easily

However, since it isn't backwards-compatible with GM7, it requires Pro, and it apparently doesn't improve speed, I fail to see the real use for it. The better organization is a good thing, but you can do without it. Being able to call it elsewhere is nice, but this can be achieved easily with user defined events, and you generally don't even need to do this for the most part anyways.

So, in your opinion, is it worth it to use trigger events? Or is it better to just use user defined events or even just put it in the step event?

Edited by jaychant, 11 February 2010 - 10:43 PM.

  • 0

#2 Yourself

Yourself

    The Ultimate Pronoun

  • Retired Staff
  • 7352 posts
  • Version:Unknown

Posted 11 February 2010 - 10:47 PM

since it isn't backwards-compatible with GM


Uhhh, so?

but this can be achieved easily with user defined events


User defined events can't be named. User defined events must be triggered explicitly.

The better organization is a good thing, but you can do without it.


Better go use Assembly, then.

I don't get it, you list the two benefits of trigger events, then ask what benefits the trigger events have? What reason do you have for not using trigger events? What's better about user defined events?

Edited by Yourself, 11 February 2010 - 10:48 PM.

  • 0

#3 9_6

9_6

    Guest

  • GMC Member
  • 3627 posts

Posted 11 February 2010 - 10:52 PM

Well he has a point.
What do trigger events better that if-checks in the step event can't do that good?
They just clutter the events up.
  • 0

#4 onpon4

onpon4

    GMC Member

  • GMC Member
  • 1175 posts
  • Version:GM8

Posted 11 February 2010 - 10:54 PM

What I meant was, if you use trigger events, you can't share your source code with Lite users or GM7 users. So it seems that the costs outweigh the benefits.
  • 0

#5 Kolink

Kolink

    Almighty Shinx

  • GMC Member
  • 2351 posts

Posted 11 February 2010 - 11:02 PM

I don't plan to use trigger events... like, ever. event_user(0) works just fine for me, and doing it manually means you can check it every 10 steps, or whatever, to make the game faster.
  • 0

#6 NakedPaulToast

NakedPaulToast

    GM Studio/Mac/Win

  • GMC Member
  • 8134 posts
  • Version:GM:Studio

Posted 12 February 2010 - 12:12 AM

What I meant was, if you use trigger events, you can't share your source code with Lite users or GM7 users. So it seems that the costs outweigh the benefits.


Using this logic we'd all be limiting ourselves to the lite only functions of Version 5.
  • 1

#7 JaketheSnake3636

JaketheSnake3636

    GMC Member

  • New Member
  • 1905 posts

Posted 12 February 2010 - 01:14 AM

What I meant was, if you use trigger events, you can't share your source code with Lite users or GM7 users. So it seems that the costs outweigh the benefits.


Using this logic we'd all be limiting ourselves to the lite only functions of Version 5.

He's not saying all new features since version 5 are outweighed by their downsides, only the trigger events. In his opinion, it's not worth it to use them because of their apparent downsides. He's not forcing people to agree with him, so I don't see what's wrong with that. His logic never once implies that all new features are unworthy of being added because of their inability to work with previous versions.
  • 1

#8 superjoebob

superjoebob

    YM2612

  • New Member
  • 1515 posts

Posted 12 February 2010 - 01:26 AM

However, since it isn't backwards-compatible with GM7, it requires Pro, and it apparently doesn't improve speed, I fail to see the real use for it.

You could technically say that about drag and drop as well (Apart from the pro part) :).
  • 1

#9 Nocturne

Nocturne

    Nocturne Games

  • Administrators
  • 20925 posts
  • Version:GM:Studio

Posted 12 February 2010 - 07:26 AM

Personally I found the trigger events useful for my current WIP... The step event of a couple of objects have over 250 lines of code with multiple "if" and "switch"... The trigger events came in useful to seperate it out and give me a more visual aproach to the code...
  • 1

#10 T-Bird

T-Bird

    GMC Member

  • New Member
  • 1326 posts

Posted 12 February 2010 - 07:43 AM

I don't see why you are comparing trigger events to user-defined events. They are two completely different events for two completely different purposes. To recommend that one replaces the other is to completely misunderstand what either of them is.

User events are effectively scripts that are local to your object, you put code into one then manually trigger it when you're ready. This lets you have code activated on command from any event in your object (or from another object).

Trigger events are an abstraction for a series of code snippets that happen before Step events. The trigger event "if(x > 100)" with the action "y += 1" is exactly equivalent to a step event of "if(x > 100) { y += 1 } ... and the remainder of your step event goes here". All it is, is an organizational technique. Rather than having several if statements at the start of your step event you can pack them away in triggers which don't improve performance in any way, but just make it easier to keep things sorted. A 100 line step code can be turned into a series of short triggers which are easier to maintain, edit, and keep track of. Triggers also are portable between objects, so you can make one code change and have the change affect multiple objects. If you have a trigger of "if x > 1000" and each object does something when it crosses that line, then if you decide to move that line to x > 2000 all you have to do is change one trigger and the change takes affect for all objects. Saving potentially dozens of mundane code changes. (If triggers still work the way I remember from the RC).

Does this explain triggers?
  • 0

#11 onpon4

onpon4

    GMC Member

  • GMC Member
  • 1175 posts
  • Version:GM8

Posted 12 February 2010 - 11:16 AM

Ah, inheritance. That is another good reason to use triggers.
  • 0

#12 Recreate

Recreate

    Furry

  • GMC Member
  • 2971 posts
  • Version:GM8

Posted 13 February 2010 - 06:44 AM

What I meant was, if you use trigger events, you can't share your source code with Lite users or GM7 users. So it seems that the costs outweigh the benefits.


Using this logic we'd all be limiting ourselves to the lite only functions of Version 5.


Not everyone instantly got GM8. Many people may have bought GM7 before the time one can qualify for a free upgrade.
  • 0

#13 Yourself

Yourself

    The Ultimate Pronoun

  • Retired Staff
  • 7352 posts
  • Version:Unknown

Posted 13 February 2010 - 05:14 PM

Many people may have bought GM7 before the time one can qualify for a free upgrade.


Which was well over a year ago, so that's not really an excuse. They're paying more for internet access than they are for GM by an order of magnitude.
  • 0

#14 9_6

9_6

    Guest

  • GMC Member
  • 3627 posts

Posted 13 February 2010 - 05:52 PM

Who cares if gm7 had no triggers?
Gm8 gmk files can't be opened by that anyway.
  • 0

#15 petenka

petenka

    The Chosen One

  • New Member
  • 911 posts

Posted 13 February 2010 - 06:23 PM

Who cares if gm7 had no triggers?
Gm8 gmk files can't be opened by that anyway.

Unless you resave them using lateralgm.

But by the OP's argument, you shouldn't use alpha transparency in your sprites either, otherwise you can't use them in gm7.
He's saying you shouldn't use the new features of gm8, because they are new and make life easier.
  • 0

#16 JaketheSnake3636

JaketheSnake3636

    GMC Member

  • New Member
  • 1905 posts

Posted 13 February 2010 - 06:29 PM

He's saying you shouldn't use the new features of gm8, because they are new and make life easier.

No he's not.
  • 0

#17 onpon4

onpon4

    GMC Member

  • GMC Member
  • 1175 posts
  • Version:GM8

Posted 13 February 2010 - 10:03 PM

Who cares if gm7 had no triggers?
Gm8 gmk files can't be opened by that anyway.

Unless you resave them using lateralgm.

But by the OP's argument, you shouldn't use alpha transparency in your sprites either, otherwise you can't use them in gm7.
He's saying you shouldn't use the new features of gm8, because they are new and make life easier.


You're not even close. :)

I'm saying that TRIGGER EVENTS are not useful enough considering that it requires GM8 Pro and doesn't improve the game considerably. Not everyone has GM8 Pro, so if I use trigger events in my open-source projects and/or team projects, anyone who doesn't have GM8 pro won't be able to use it. This would be fine if trigger events really offered a benefit (like an increase in speed), but it turns out that it doesn't.

Alpha transparency offers the obvious benefit of giving full control over transparency, whereas GM7 only applied full transparency to one color, and then a certain amount of transparency to the rest of the image. On top of that, this feature isn't restricted to Pro users.

Trigger events, on the other hand, are restricted to Pro users, and what benefits do they offer? You can organize your code a little better. But the restrictions? Well, you automatically make your game useless to anyone who hasn't bought GM8 Pro, which is fine if you intend to do everything by yourself and make it a closed-source project. But on any open-source project, this means you have to create a separate version for Lite users, which would mean some extra work or loss of features, or exclude Lite users, which would make the source only useful to Pro users. And you do this... to make life easier? You end up doing more work, or your project fails because you exclude the many users who haven't yet purchased Pro, or who never will purchase Pro.

Edited by jaychant, 13 February 2010 - 10:05 PM.

  • 0

#18 petenka

petenka

    The Chosen One

  • New Member
  • 911 posts

Posted 13 February 2010 - 10:13 PM

@criticism to what I said - I was being sarcastic of course

Really, it's all just a matter of preference, and what you're doing.

If you're just making an example, it's best to use gm7 lite. If your example requires pro functions, then you might as well use triggers since your example is already pro only.
If you're making a closed-source game however, there's no reason not to use triggers other than personal preference.
  • 0

#19 Yourself

Yourself

    The Ultimate Pronoun

  • Retired Staff
  • 7352 posts
  • Version:Unknown

Posted 13 February 2010 - 10:41 PM

And you do this... to make life easier? You end up doing more work, or your project fails because you exclude the many users who haven't yet purchased Pro, or who never will purchase Pro.


Why did you get pro if you're not going to use its features because not everyone has pro? That's just stupid.

Edited by Yourself, 13 February 2010 - 10:48 PM.

  • 0

#20 krele

krele

    GMC Member

  • GMC Member
  • 617 posts
  • Version:GM:Studio

Posted 13 February 2010 - 10:45 PM

One GREAT thing is:

If you're making a multiplayer game with dual-view/screen, and you want to draw things in separate views, you can create a "Draw in View1" trigger and "Draw in View2" events. You would check "if view_current" and use screen_redraw at the end of each... Makes it a LOT more easier/organised in my opinion. It's an awesome improvement, atleast for me =)
  • 0

#21 miky

miky

    GMC Member

  • New Member
  • 1023 posts

Posted 13 February 2010 - 10:55 PM

Organization is an absolutely humongous reason to use triggers. Code is read far more than it is written, so anything that makes code clearer and easier to read is a plus (unless it has huge performance repercussions--but that rarely happens).

Inheritance is another huge benefit.

How often are you going to be sharing your gmk's with people who don't have GM8 Pro anyway? And using that logic, you shouldn't use 3D or particles, you shouldn't use png transparency, you shouldn't use pretty much anything that wasn't in GM5.
  • 0

#22 paul23

paul23

    GMC Member

  • Global Moderators
  • 3802 posts
  • Version:GM:Studio

Posted 13 February 2010 - 11:01 PM

Well I explained this a long time already: but I myself won't use triggers as much as I would like too...


For the simple reason they are always 'global', and even worse: hidden from the main interface (resource tree). In my opinion they should've been local to the object (and it's children), like user events are at the moment.. That would've increased the object-based activities of gamemaker a lot (It would've given us finally an 'unlimited' number of user-defined, LOCAL scripts).
  • 0

#23 onpon4

onpon4

    GMC Member

  • GMC Member
  • 1175 posts
  • Version:GM8

Posted 14 February 2010 - 03:09 AM

Why did you get pro if you're not going to use its features because not everyone has pro? That's just stupid.


You're cherry-picking. Note what I said before that:

Well, you automatically make your game useless to anyone who hasn't bought GM8 Pro, which is fine if you intend to do everything by yourself and make it a closed-source project. But on any open-source project, (snip)


And let me point out, I do use Pro features, all the time. However, for open-source projects, I always either make a version for Lite users or build it into the main GMK (by checking gamemaker_pro before using Pro features), though I prefer the latter. The reason triggers are useless for open-source projects in my opinion is I'll end up having to redo it in the Lite-friendly version anyway, and considering that I would then be working with multiple different files at that point, it's just not worth it. Now, if it actually improved speed in the game or reduced size or something of that nature, I would use trigger events and deal with the extra file. But to my knowledge it doesn't, so I don't, at least not with open-source projects.

And using that logic, you shouldn't use 3D or particles, you shouldn't use png transparency, you shouldn't use pretty much anything that wasn't in GM5.


No...

3D allows the potential to make 3D games or make 2D games look much better. There is a clear reason to use it despite the Pro requirement.

PNG transparency, besides being supported by GM8 Lite, it very useful, allowing for more freedom customizing sprites.

Particles are nice graphical effects and can be easily made optional by first checking gamemaker_pro.

My logic is not "Lite doesn't have it, so I won't use it". My logic is "This function offers little improvement, yet requires Pro, so there's no real reason to use it". The exact same functionality that trigger events offer can easily be achieved with user defined events and checks in the step event, including inheritance, calling it from other places, and better organization (albeit not quite as good organization as trigger events).

Edited by jaychant, 14 February 2010 - 03:14 AM.

  • 0

#24 Yourself

Yourself

    The Ultimate Pronoun

  • Retired Staff
  • 7352 posts
  • Version:Unknown

Posted 14 February 2010 - 06:45 AM

However, for open-source projects, I always either make a version for Lite users or build it into the main GMK


I don't understand why you singled out triggers then. You argued that they weren't worth it because they were pro only. Well, so what? A lot of features are pro only, but that's not a reason not to use them in general, which seemed to be the point you were trying to make. If you don't want to use them so you can produce something for lite users then fine, but then what's the point of this topic?
  • 0

#25 petenka

petenka

    The Chosen One

  • New Member
  • 911 posts

Posted 14 February 2010 - 06:54 AM

what's the point of this topic?

Sometimes people just want to state their views.
Once they get people to agree with them, they feel satisfied.
If people don't agree, you can see what happened above.
There's no actual point to this topic.

Edited by petenka, 14 February 2010 - 06:55 AM.

  • 0

#26 jakman4242

jakman4242

    Vertical Shmup Junkie

  • New Member
  • 3222 posts

Posted 14 February 2010 - 07:36 AM

More of you need to hop on the Apple Bandwagon with their unwritten rule:
"If you're using older software, we spare no pity"
:)
  • 0

#27 Schyler

Schyler

    Noskcirderf Derf

  • GMC Member
  • 2677 posts
  • Version:GM:Studio

Posted 14 February 2010 - 07:42 AM

I think triggers are something that can be extremely useful, however in very few cases. It only takes one person to discover a really clever way of using them for something, and you won't ever hear the end of them.
  • 0

#28 onpon4

onpon4

    GMC Member

  • GMC Member
  • 1175 posts
  • Version:GM8

Posted 14 February 2010 - 01:08 PM

I don't understand why you singled out triggers then. You argued that they weren't worth it because they were pro only. Well, so what? A lot of features are pro only, but that's not a reason not to use them in general, which seemed to be the point you were trying to make. If you don't want to use them so you can produce something for lite users then fine, but then what's the point of this topic?


I never said that I consider it useless because it's Pro-only. I'm saying that, the way I see it, it's not good enough to be Pro-only. Really, I'm getting sick of saying this over and over again, so just re-read my earlier posts. There's a reason for singling out Trigger events.

Sometimes people just want to state their views.
Once they get people to agree with them, they feel satisfied.
If people don't agree, you can see what happened above.
There's no actual point to this topic.


Actually, I was hoping to have a nice discussion about trigger events or Pro features in general, and to exchange ideas on the matter.

I'm not really arguing anything. I'm just kind of annoyed that some users don't get what my view is and/or keep manipulating it to be something it's not. People keep saying that I would rather use GM5 or assembly or that I consider new features useless. Which is just not true. If that was the case, then I wouldn't have paid $25 for GM7 Pro.

Now, I hate to bring up religion, but this is the best analogy that I can think of. Let's say you were a Christian Protestant and you were talking to a Catholic. You say to the Catholic that you think Catholicism is corrupt, evil, not right, etc. How would you feel, in that situation, if the Catholic then insisted that you worship Satan and/or hate God/Jesus because you hate Catholicism? In the same way, I'm saying that I consider ONE Pro feature to be not worth it, and a bunch of people are saying that I'm saying that I don't like ANY new features. Can you understand the frustration?

Most posts in this topic are good and actually discussing the topic, but these particular posts annoyed me:

Using this logic we'd all be limiting ourselves to the lite only functions of Version 5.

But by the OP's argument, you shouldn't use alpha transparency in your sprites either, otherwise you can't use them in gm7.
He's saying you shouldn't use the new features of gm8, because they are new and make life easier.

Why did you get pro if you're not going to use its features because not everyone has pro? That's just stupid.

How often are you going to be sharing your gmk's with people who don't have GM8 Pro anyway? And using that logic, you shouldn't use 3D or particles, you shouldn't use png transparency, you shouldn't use pretty much anything that wasn't in GM5.

I don't understand why you singled out triggers then. You argued that they weren't worth it because they were pro only. Well, so what? A lot of features are pro only, but that's not a reason not to use them in general, which seemed to be the point you were trying to make. If you don't want to use them so you can produce something for lite users then fine, but then what's the point of this topic?


Are you noticing a recurring theme here? Each of them is making the assumption that because I don't like Trigger events, I don't like ANY Pro features, and then asking why. One would have been fine, but it gets pretty annoying when it gets repeated over and over.
  • 0

#29 NakedPaulToast

NakedPaulToast

    GM Studio/Mac/Win

  • GMC Member
  • 8134 posts
  • Version:GM:Studio

Posted 14 February 2010 - 04:51 PM

Are you noticing a recurring theme here? Each of them is making the assumption that because I don't like Trigger events, I don't like ANY Pro features, and then asking why. One would have been fine, but it gets pretty annoying when it gets repeated over and over.


No, you stated that because it was incompatible with GM7 and lite users, it's costs outweigh it's benefits.


What I meant was, if you use trigger events, you can't share your source code with Lite users or GM7 users. So it seems that the costs outweigh the benefits.


However, since it isn't backwards-compatible with GM7, it requires Pro, and it apparently doesn't improve speed, I fail to see the real use for it.


And whether you like it or not that same reasoning can be applied to all kinds of new features, with every new version of Game Maker. Not all of the new features translate into immediate and measurable speed improvements. Game Maker members have a tendency to focus only on major changes between versions, and neglecting all the minor or less dramatic innovations.

They then draw the conclusion that the newer version isn't much of an update, or they're not interested because the new features aren't useful to them it's not a worthy update.

They completely neglect the cumulative effect of all the smaller and subtle improvements.

My impression of triggers is they do little to improve the performance of the target exe, but they can significantly improve the organization, readability of the code itself. They can also lend themselves well to being shared between objects, something Game Maker has historically been very week in.

Triggers are a brand new concept, the community has little experience with them, there's been almost zero material published about them. It's a little early to be taking the attitude, I don't think they're useful, prove to me their value.
  • 1

#30 onpon4

onpon4

    GMC Member

  • GMC Member
  • 1175 posts
  • Version:GM8

Posted 14 February 2010 - 05:10 PM

No, you stated that because it was incompatible with GM7 and lite users, it's costs outweigh it's benefits.


Yes, I said the costs outweigh the benefits.

However, in, for example, 3D, image rotation, and extensions, the benefits outweigh the costs. If forced to make two separate GMKs because, for example, I'm using extensions, then I would use triggers, because the benefits would outweigh the cost. But if I can keep everything in one GMK, then the costs outweigh the benefits.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users