Hi Rick,
90% sure of this - perhaps Andy can verify:
char *name = the full path to the texture
char *origname = a partial/relative or filename-only path? (not entirely sure on this, but having the correct filename in *name seems to load it...)
add_new_texture_opt() returns the texture ID of the newly loaded texture, which you should be able to assign to the object using object_texture_set().
Hope that's correct