Jump to content


Camman

Member Since 18 Mar 2006
Offline Last Active Apr 24 2013 12:18 AM

Posts I've Made

In Topic: Blackjack (21)

15 April 2013 - 12:48 AM

My apologies, not sure what happened there!


In Topic: [Solved] Gm Studio - Left Mouse Pressed & Released

11 April 2013 - 01:32 PM

So, if I am understanding correctly, you *only* want the code to be performed if the user presses & releases the mouse on the same object?

If so, try creating a temporary variable (let's say pressed) in the "Create Event" and set it to false. In your "Left Pressed" event, set pressed to true. Now, in your "Left Released" event, check and see if pressed is true. If it is, do your desired action. If it is not, then do not. Either way, make sure you set pressed back to false afterwards. Also, create a "Global Left Released" event. In this event, set pressed to false. This will prevent the pressed variable from staying set to true if you release the mouse while not on your object (and thus preventing undesired functionality if the user presses on the object, moves the mouse off the object, releases, presses again off the object, moves the mouse back on to the object, and releases again).


In Topic: Advanced Inventory System

11 April 2013 - 01:17 PM

It really is a bummer that we don't have member functions. It would make some things much easier. :P

Anyway, yes, that should work. However, from a performance standpoint, it is not as efficient as using user defined events. You can add user defined events like any other event: Add Event -> Other -> User Defined. GM:Studio allows for up to 15 user defined events.
with (item_object)
{
event_perform(ev_other, ev_user0); 
}
Put the code you want to execute when the item is used in your user defined event. This event will only be triggered when you use the code above.

This way is more efficient, because you aren't constantly checking to see if the item has been used. It only uses the item when you trigger the event.

In Topic: Storing An Array Inside A Ds_Map

01 April 2013 - 03:47 PM

I found out that GM does not work this way a few weeks ago when I was trying to pass an array to a script.

You're much better off leaving arrays alone and just use one of GM's data structures (ds_* functions).

Just make sure to properly remove all of those data structures from memory when you're done with them (memory leaks = bad)!

In Topic: Write Your Own Assert Script?

01 April 2013 - 03:39 PM

I don't think so, but show_error might be worth looking into. Other than that, I do not believe there is anything like what you're suggesting.