I did a code like this for enemy characters for seemingly random movement.
if direction = 0
{sprite_index = E;}
if direction = 45
{sprite_index = NE;}
if direction = 90
{sprite_index = N;}
if direction = 135
{sprite_index = NW;}
if direction = 180
{sprite_index = W;}
if direction = 225
{sprite_index = SW;}
if direction = 270
{sprite_index = S;}
if direction = 315
{sprite_index = SE;}
Simple, really. However, it's all intertwined with the events. For the object, you'll need to set an alarm for the Create event (and set movement to all directions in the Create event). Then in the Alarm event, run this handy piece of code (and reset the alarm and movement too!). Make sure you have an 8-directional sprite set up, with the names listed here for the sprites. Maybe you could implement this if it's not too simple, TFS. Personally, I'm proud of myself for figuring it out. Yours is nicer, though.