Problem addressing obj inside another obj

W

Warianos

Guest
Guys im making a cut-scene with 3 characters in it. I have a script that creates an obj_text with a text box and some animation.

The problem now is that i want to fast forward the animation of only the textBox that is appearing on the screen.

For that i´m doing another script that will receive the character´s obj that will speak, and detect if an object with the name "txt" is created inside that character. The problem here is that if the text box is not yet created this does not work.

//obj,speedText

if(object_exists(argument0)){
with(argument0){
if(instance_exists(argument0.txt)){
with(txt){
if (spd = 10){
instance_destroy();
timeline_position = timeline_position + 1
}

else{
spd = argument1;
}
}
}
}
}

Other problem is that if i just go and change

if(object_exists(argument0)){
with(argument0){
if(instance_exists(obj_text)){
with(obj_text){
if (spd = 10){
instance_destroy();
timeline_position = timeline_position + 1
}

else{
spd = argument1;
}
}
}
}
}

The speed will be incremented in all the textbox visible or not will stay in the create, making all the textbox really quick without even been clicked the mouse button.

Im calling this script here:

if (timeline_running){

if mouse_check_button_pressed(mb_left){
script_execute(FastText,obj_player,10)
script_execute(FastText,obj_cry_girl,10)
script_execute(FastText,obj_enemy_goblin,10)
}

}
 
Last edited by a moderator:
A

anomalous

Guest
object_exists: I'm not sure this should be used or you should design to so you have to use this. This is checking if the object exists in the RESOURCE tree, not in the room.
So it can be true, and yet any "with object" will fail. Although I'd expect you to use with INSTANCE in this case...

You get an error because you check if the object exists in the resource tree, and then you do "with obj". You would need to instead you instance_exists. However checking if instance exists of argument0.txt worries me too, are you really creating Objects? Perhaps that's not the ideal approach.

Typically I would expect that you have a text object in your resource tree. You would then instance that text object, and modify variables in that object to get it to do what you need it to do. Then you destroy it.
 
W

Warianos

Guest
Yap im creating the txt obj, and i´m unsing instance insted of exists, and now works :) If i may ask other question, do u know how i can pass a step of a timeline? i was trying "timeline_position = timeline_position + 1;" i thought that position = step, but its not working
 
A

anomalous

Guest
I've never used timelines, but in the manual under timeline there is a function called timeline_speed
"Normally, in each step the position in the time line is increased by 1, however you can change this amount by setting this variable to a different value. "
 
Top