i am new in this. i cant do my signals wor and i dont know why. i have read a lot of sites but i dont find the way to make my signals work.
i am tryigin to use they for knowing the localitation about where start (i am trying to sstar my lerning with a 2d rpg then character should be able to have several localitations available).
the thing is that i am trying to use first the signals for changing in code the start game localitation of the game even when i can do it in editor, i want to make it by signals because it will make me understand better how it works.
i also have test that i can change localitation of my game in code but no if i put the code inside the signal thing, i dont want the localitation of the room be always that, just the first time, the others times localitation must be in the door.

this is the code of my character:


signal personajecoll()





func _ready():
	set_contact_monitor (true)
	set_max_contacts_reported(15)
	get_node("/root/Node2D/Nodedatos1").connect("posStart", self, "has_signal")
	if has_signal ("PosStart") :
		position.x = 320
		position.y = 100

 
func _process(delta):
	if has_signal("body_entered") :
		emit_signal("personajecoll")
		

func _unhandled_key_input(event):
	if event is InputEventKey :
			if event.pressed and event.scancode == KEY_RIGHT :
				linear_velocity.x = 20
				linear_velocity.y = 0
				angular_velocity = 0
	if event is InputEventKey :
			if event.pressed and event.scancode == KEY_LEFT :
				linear_velocity.x = -20
				linear_velocity.y = 0
				angular_velocity = 0
	if event is InputEventKey :
			if event.pressed and event.scancode == KEY_DOWN :
				linear_velocity.y = 20
				linear_velocity.x = 0
				angular_velocity = 0
	if event is InputEventKey :
			if event.pressed and event.scancode == KEY_UP :
				linear_velocity.y = -20
				linear_velocity.x = 0
				angular_velocity = 0
			if event.pressed == false :
				linear_velocity.x = 0
				linear_velocity.y = 0
			_

and this the code from my autoload node that should control the localitation.

signal posStart()
signal pos_pasillolab_felixroom()
signal pos_felixroom()




func _ready():
	if PlaceD == "0A" :
		
		emit_signal ("posStart")
	if PlaceD == "pasillolab_felixroom" :
		emit_signal ("pos_pasillolab_felixroom")
	if PlaceD == "felixroom" :
		emit_signal ("pos_felixroom")
	 



func _process(delta):
	if has_signal("salidadehabitacionfelix") :
		PlaceD = "pasillolab_felixroom"
	if has_signal("entradadehabitacionfelix") :
		PlaceD = "felixroom_" ~~~
pd dont read # things,, , commentary are from godot not from me , i am not erasing some for lazyness.
pd2: i have tabs inside the code but coping and pasting it have erased they in the web version.

That code is very difficult to read.

Place ~~~ before and after the code to display it properly. If you copy/paste it from the Godot editor, the indenting will be retained.

Are you getting any error or warning messages?

    DaveTheCoder Well i have changed the text for making it more readable as you told me.

    I dont remember the exact error but i have had several trying. I think one of they dont let me to start the game but last time i tried i was capable of starting the game, just signals dependebla things dont run.

    You may be misunderstanding "has_signal". That tells you whether a signal has been declared in an Object. It doesn't tell you whether a signal has been emitted.

    To detect an emitted signal, you need to connect the signal to a function, or wait for the signal with yield().

    You're emitting signals in an autoload's _ready() function. The nodes that are listening for the signals may not be initialized yet, and wouldn't be able to handle the signal.

      DaveTheCoder You're emitting signals in an autoload's _ready() function. The nodes that are listening for the signals may not be initialized yet

      I'm not sure about that even being a maybe.

      i still dont know how to made it run. i have changed the code. i remember i am a noob in this.
      character code:

      # Declare member variables here. Examples:
      signal listo
      
      
      
      # Called when the node enters the scene tree for the first time.
      func _ready():
      	emit_signal("listo")
      	set_contact_monitor (true)
      	set_max_contacts_reported(15)
      	get_node("/root/Node2D/Nodedatos1").connect("posStart", self, "iniciop")
      
      func iniciop(posStart) :
      	position.x = 320
      	position.y = 100
      
      # Called every frame. 'delta' is the elapsed time since the previous frame. 
      func _process(delta):
      	if has_signal("body_entered") :
      		emit_signal("personajecoll")
      		
      
      #	pass
      func _unhandled_key_input(event):
      	if event is InputEventKey :
      			if event.pressed and event.scancode == KEY_RIGHT :
      				linear_velocity.x = 20
      				linear_velocity.y = 0
      				angular_velocity = 0
      	if event is InputEventKey :
      			if event.pressed and event.scancode == KEY_LEFT :
      				linear_velocity.x = -20
      				linear_velocity.y = 0
      				angular_velocity = 0
      	if event is InputEventKey :
      			if event.pressed and event.scancode == KEY_DOWN :
      				linear_velocity.y = 20
      				linear_velocity.x = 0
      				angular_velocity = 0
      	if event is InputEventKey :
      			if event.pressed and event.scancode == KEY_UP :
      				linear_velocity.y = -20
      				linear_velocity.x = 0
      				angular_velocity = 0
      			if event.pressed == false :
      				linear_velocity.x = 0
      				linear_velocity.y = 0

      autoload code:

      extends Node
      
      var PlaceD = "0A"
      signal posStart()
      signal pos_pasillolab_felixroom()
      signal pos_felixroom()
      var iniciado = 0
      # var b = "text"
      
      
      # Called when the node enters the scene tree for the first time.
      func _ready():
      	iniciado = 0
      	
      	 # Replace with function body.
      func places(listo) :
      	if PlaceD == "0A" :
      		emit_signal ("posStart")
      		iniciado = 1
      	if PlaceD == "pasillolab_felixroom" :
      		emit_signal ("pos_pasillolab_felixroom")
      		iniciado =1
      	if PlaceD == "felixroom" :
      		emit_signal ("pos_felixroom")
      		iniciado = 1
      # Called every frame. 'delta' is the elapsed time since the previous frame.
      func _process(delta):
      	if has_signal("salidadehabitacionfelix") :
      		PlaceD = "pasillolab_felixroom"
      	if has_signal("entradadehabitacionfelix") :
      		PlaceD = "felixroom"
      	if iniciado == 0 :
      		get_node("/root/Node2D/RigidBody2Dchar").connect("listo", self, "places")

      Please explain the reason for this code:

      if has_signal("body_entered") :
              emit_signal("personajecoll")

        DaveTheCoder
        I have not changed it because i have decided that first i want to make the character to start in other place of the map.
        It is not relevant to the first objective and is related to he second objective. It is made for working with the door script for changing scene, and the 3 nodes should help me to change scene. But at the moment i am not going to change that part until i am able to change the start localitation. I have dont changed it because i was not focused in it, once i made run the first objective, i will change that too..
        That script was made for trying door collision but since i use signals too i prefer to learn first signals separated and after that going to mix it with collisions.

        Faulty code or code that you don't understand could have side effects and prevent other code from working. You should remove or comment-out such code.

          DaveTheCoder. Well i i will change it next time i open godot. But what i want to know is if the way to call functions is like that because i have the feeling that they are not triggered and i cant get information about how trigger functioms that i have created. I know ready is for when node has ended of load in the scene and is one time alone and procces is trigerred everytime but i dont know how the mines are triggered.

            mtcat But what i want to know is if the way to call functions is like that because i have the feeling that they are not triggered and i cant get information about how trigger functioms that i have created.


            if has_signal("body_entered") :
                    emit_signal("personajecoll")

            So, you are making an if statement checking if a node has a signal/callback function named "body_entered", it doesn't trigger it nor check if "body_entered" has been triggered.

            DaveTheCoder. I removed it but it still dont run, it just plays the game as if the code wasnt there.