[Resolved] Calling a coroutine from a component in a race


#1

I am trying to call a coroutine from a component within a race, however, the compiler thinks that it is an immediate statement… not a coroutine. I highlighted where the error is and included the error message. Is there some syntax that I need to apply here? Should I wrap this in a coroutine within the object that is invoking it? Thanks!


#2

I can’t see the whole coroutine in the screen shot above - the edge is cut off.

I don’t see where a race command is used?

Can you please copy the text of _ooze_ai() and paste it into a follow up reply?

SkookumScript code looks best wrapped in three backticks and if you say it is the “javascript” language it has a fair approximation for syntax highlighting. (We’ll add an option for SkookumScript proper when we get a chance.)

```javascript
[
// Comment
skookum_code(42)
]
```

looks like this:

[
// Comment
skookum_code(42)
]

#3

right click and open in a new tab =)

if you still need me to add the text I will, I had changed it and was being lazy… didnt feel like rewriting it


#4

Ha. Thought it would expand if I just clicked on it.

Though it would still be nice if you cut and pasted the text - I am now copying it out by hand so that I can run the parser on it and analyze it.


#5

Oh, hold on I will type it then, do not want to create extra work for you =)


#6

Missed this part. You wrote around the problem? That code would be cool to see as well.


#7
() 
  [
  // Your code here.
    loop [
      println(@mode)
      @aiperception._wait_perception_updated
      if @mode = EAI_Mode.@@patrol [@ai_simple_patrol._patrol _mode_switch]
         @mode = EAI_Mode.@@persue []
      //@ai_move_towards_player._move_towards_player
      _wait
    ]
    
  ]

Here is the wrapper for it.

and in code…

() 
  [
  // Your code here.
    loop [
      println(@mode)
      @aiperception._wait_perception_updated
      if @mode = EAI_Mode.@@patrol [_patrol_wrapper _mode_switch]
         @mode = EAI_Mode.@@persue []
      //@ai_move_towards_player._move_towards_player
      _wait
    ]
    
  ]

Not being able to call inner coroutines is not good, this does not work as well:

race [@aiperception._wait_perception_updated _some_random_coroutine]

#8

Hmm. It works for me in all the tests that I have tried so far.

I don’t have the same project as you so there could be some difference.

So the following code also does not compile?

()
  [
  race [@aiperception._wait_perception_updated _wait]
  ]

What about this?

()
  [
  race [@aiperception._wait _wait]
  ]

You could try using the old SkookumIDE to see if the result is any different.


#9

Yep, the compiler/ide thinks it is a normal method call as you can see above… it refers to it as an immediate statement


#10

It may be a parser error that snuck into the new version of the SkookumIDE that you are using.

We will try to confirm.

We probably won’t have an update until tomorrow at the earliest.

In the meantime you could try to use the old SkookumIDE. If you want to do that you will have to ensure that any generated overlays for your project are not using archive files. Change any A to 1 in the project.ini file. If you go this route let us know if you need any help.


#11

Ok this is fixed. It was a bug in the parser that would falsely consider any call on a raw member as immediate. We will roll the fix out very shortly as part of a new plugin/IDE drop for you guys!


#12

awesome job, thanks!


#13

So this update is out, just hot from the press!