Author Topic: New instance to run event cases  (Read 3682 times)

0 Members and 2 Guests are viewing this topic.

Offline Robert Eric

New instance to run event cases
« on: March 15, 2004, 07:14:53 AM »
I've been trying to use an instance of Script to run my cases instead of RoomScript, to keep things in order.  I have:

In RoomScript

(if(== (send gEgo:onControl()) ctlGREEN)
  (if(Said('talk'))
    (send gEgo:setMotion(MoveTo 50 50 moveScript))
  )
)

In it's own instance

(instance moveScript of Script
    (properties)
    (method (changeState newState)
        = state newState
        (switch (state)
            (case 0
                Print("He moved.")
                = cycles 10
            )
            (case 1
                Print("He's still there.")
                = cycles 10
            )
            (case 2
                Print("The view has moved to it's first position!")
                = cycles 10
            )
        )
    )
)

When I'm on the green control, and I type "talk", he walks to 50,50, but then nothing happens.  Any ideas?



Offline Eigen

Re:New instance to run event cases
« Reply #1 on: March 15, 2004, 07:45:06 AM »
The code works here...

Are you sure it reaches 50 50? Maybe there's something blocking the way.



-Eigen
Artificial Intelligence Competition

Offline Cloudee1

Re:New instance to run event cases
« Reply #2 on: March 15, 2004, 09:01:56 AM »
You are trying to get it to do all cases in one pass aren't you?  It seems to be a bit of a debate about this type of thing in other posts but what I have become convinced of is that the Roomscripts changestate is the only place that works, these other instances only seem to be good for one case actions, or to illustrate how your script worked in my test game:

first time talk, dude treked over and said "he moved"
... then nothing
wander around talk again and this time he goes and reports "he's moving"
...  then nothing
roam some and talk again and away he goes again "reached his position"

I assume that isn't the desiredresponse however?



Halloween Competition Brass Lantern Prop Competition Groundhog Day Competition

Offline Robert Eric

Re:New instance to run event cases
« Reply #3 on: March 15, 2004, 04:02:12 PM »
I thought it was supposed to run the next case no matter if you have an actor move, animate, have a sound play, Print(), or Display() something?  I have those Print() functions to test that theory.  It works in the RoomScript instance, but if it can't do the same in a seperate Script instance, then that really bytes.  I mean, bites.

Edit: Actually, I put it in RoomScript, but it didn't work.  He moved to 50, 50, then stopped, and nothing happened.
« Last Edit: March 15, 2004, 04:06:55 PM by Robert Eric »

Offline Cloudee1

Re:New instance to run event cases
« Reply #4 on: March 16, 2004, 01:06:08 PM »
Hey Rob Bob,
 When I stick this in roomscript, it works. With just this, upon room start it prints the statements.
Code: [Select]
(instance RoomScript of Script(properties)
 (method (changeState newState)
 = state newState
  (switch (state)
   (case 0
   Print("He moved.")
   = cycles 10
   )
   (case 1
   Print("He's Moving.")
   = cycles 10
   )
   (case 2
   Print("The view has moved to it's first position!")
   = cycles 10
   )
  )
 )
 (method (handleEvent pEvent)

now just add a local variable and check against it as to whether to start this or not and you should be fine
Halloween Competition Brass Lantern Prop Competition Groundhog Day Competition

Offline Robert Eric

Re:New instance to run event cases
« Reply #5 on: March 16, 2004, 04:01:08 PM »
It DOES work, but I was hoping to be able to use it in it's own instance.  I guess this will do for now, until I can figure it out on my own.  Thanks cloudee.

Offline Cloudee1

Re:New instance to run event cases
« Reply #6 on: March 17, 2004, 09:42:57 AM »
me too, but I couldn't ever get mine to work  ::)
Halloween Competition Brass Lantern Prop Competition Groundhog Day Competition


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.053 seconds with 21 queries.