Kalikk
(Kalik)
April 21, 2024, 10:45pm
1
Hey, i’ve been learning verse for maybe a month now and just stubbled uppon this error code in relation with the subscribe function I’ve never seen before.
CheckIfLeft(Agent: agent)<suspends>:void=
loop:
Sleep(0.0)
if (Self.MaybeCorPlayer = TycoonAsset.AgentToCustomPlayer[Agent].LeavingPlayer):
Print("yes, its him!")
executed like:
for(Obj:ClassSelector):
Obj.ClassSelector.TeamSwitchedEvent.Subscribe(Obj.SetMaybeCorPlayer)
Obj.ClassSelector.TeamSwitchedEvent.Subscribe(Obj.CheckIfLeft) # BROKEN
error:
nixbb
(nixbb)
April 22, 2024, 6:39am
2
The error is telling you that Subscribe not expecting a function with the <suspends>
effect.
You will need to spawn the suspends function in your event handler
CheckIfLeft(Agent: agent)<suspends>:void=
loop:
Sleep(0.0)
if (MaybeCorPlayer = TycoonAsset.AgentToCustomPlayer[Agent].LeavingPlayer):
Print("yes, its him!")
break
OnTeamSwitched(Agent:agent):void =
spawn{CheckIfLeft(Agent)}
for (Obj : ClassSelector)
Obj.ClassSelector.TeamSwitchedEvent.Subscribe(Obj.SetMaybeCorPlayer)
Obj.ClassSelector.TeamSwitchedEvent.Subscribe(Obj.OnTeamSwitched)
1 Like
Kalikk
(Kalik)
April 23, 2024, 3:32pm
3
Thanks man, makes sense and fixed my code so far! <3
system
(system)
Closed
May 23, 2024, 3:32pm
4
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.