Author Topic: Question about continous events.  (Read 5042 times)

0 Members and 1 Guest are viewing this topic.

Offline Falcon

  • 29
Question about continous events.
Is there a way that we can loop certain events like one event enabling another event.

Heres what Im trying to do. I trying to set up an event where I enable the AI by a certain key but when another key is pressed it will deactivate it. And I want this continous to go over and over and over activating and deactivating it whensoever I please.

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Question about continous events.
Ah. The bane of FREDders. The linked repeating event.

Quite simply can't be done on retail.

Don't know about FS2_Open though. It didn't work last time I tried but this may have been fixed now.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline Goober5000

  • HLP Loremaster
  • 214
    • Goober5000 Productions
Question about continous events.
Didn't CP figure out how to do this in retail?  I'm pretty sure he did because he said it no longer works in FSO. :nervous:

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Question about continous events.
Quote
Originally posted by Goober5000
Didn't CP figure out how to do this in retail?  I'm pretty sure he did because he said it no longer works in FSO. :nervous:


I tried several different ways and could never make it work. The first event repeats normally. The second event screws up (I can't remember if it just keeps repeating based on the interval time or just happens once but either way it doesn't work properly).
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline Falcon

  • 29
Question about continous events.
Im using the Fredd_open version.

Oh another thing how do you get skyboxes to work to?

In Freed_open

 

Offline Arc

  • 23
Question about continous events.
Wasn't the FSO code changed to allow a -1 Repeat Count so an event would repeat forever? Err... or was that one of argv's changes that got removed... :nervous:
(<- amateur FREDder, probably wrong)

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Question about continous events.
Quote
Originally posted by Arc
Wasn't the FSO code changed to allow a -1 Repeat Count so an event would repeat forever? Err... or was that one of argv's changes that got removed... :nervous:
(<- amateur FREDder, probably wrong)


The problem is not getting the event to repeat forever. The problem is getting the second event which is linked to the first to repeat too. It never worked when I tried it. I might give it another try later today and see if it works now.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline Sesquipedalian

  • Atankharz'ythi
  • 211
Re: Question about continous events.
Quote
Originally posted by Falcon
Is there a way that we can loop certain events like one event enabling another event.

Heres what Im trying to do. I trying to set up an event where I enable the AI by a certain key but when another key is pressed it will deactivate it. And I want this continous to go over and over and over activating and deactivating it whensoever I please.
Variables are your friend.  

1) Create a variable with a default value of zero
2) Create an event that sets the variable's value to 1 whenever you press the key you want.  
3) Create  a second event that sets the variable back to zero whenever the other key is pressed.  
4) Give both of these events repeat counts of 999999999999999.
5) Create a third event that says:
Code: [Select]
when
   =
     
      1
   

6)  Create a fourth event that says:
Code: [Select]
when
   =
     
      0
   


Give the third and fourth events repeat counts of 999999999999999 as well.

Should work.
« Last Edit: April 06, 2004, 01:08:00 pm by 448 »
Sesqu... Sesqui... what?
Sesquipedalian, the best word in the English language.

The Scroll of Atankharzim | FS2 syntax highlighting

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Question about continous events.
Hmmmm. Never tried that method. I was using chains but I could never get it to work with them. I'll have to give that a try.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 
Question about continous events.
I've tried that in the past and it doesn't work because FS2 doesn't re-evaluate the when condition after the first time the event has fired. Has this changed?

 

Offline Goober5000

  • HLP Loremaster
  • 214
    • Goober5000 Productions
Question about continous events.
It does for some sexps, not for others.  Not sure if the = sexp is included among them.

 
Question about continous events.
I'll test this when I get back to Birmingham, if the variable method works now it'll allow me to make a cool Inferno mission I've always wanted to script :D

 

Offline Sesquipedalian

  • Atankharz'ythi
  • 211
Question about continous events.
One thing I should add about this method: it will repeat the action of the third/fourth event every time the event repeats.  So you may have to fiddle with this basic method depending on what sort of action you are trying to accomplish.

In the case of assigning an AI class to a fighter, it doesn't matter if the class is reassigned every second, so this will work as it stands.  If the purpose were to fire a beam, one would need to drop the fourth event, and set the repeat interval on the third event to match the usual fire delay of the beam.  You probably get the idea.
Sesqu... Sesqui... what?
Sesquipedalian, the best word in the English language.

The Scroll of Atankharzim | FS2 syntax highlighting

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Question about continous events.
Aha. I thought that might be the case.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 
Question about continous events.
if you don't want an eternal loop on the action events, why not end them with setting the var to 3, or 2, or a or something?

so you get
when var = 0 then
when var = 1 then
when key1_pressed var = 0
when key2_pressed var = 1
just another newbie without any modding, FREDding or real programming experience

you haven't learned masochism until you've tried to read a Microsoft help file.  -- Goober5000
I've got 2 drug-addict syblings and one alcoholic whore. And I'm a ****ing sociopath --an0n
You cannot defeat Windows through strength alone. Only patience, a lot of good luck, and a sledgehammer will do the job. --StratComm

 

Offline Goober5000

  • HLP Loremaster
  • 214
    • Goober5000 Productions
Question about continous events.
:nod:

 

Offline Sesquipedalian

  • Atankharz'ythi
  • 211
Question about continous events.
Precisely the sort of tweaking I mean, kasperl. :nod: In my firt post I was laying out the basic method.  With my beam example I was giving one example of how it can be modified depending on the action one wants to execute.
Sesqu... Sesqui... what?
Sesquipedalian, the best word in the English language.

The Scroll of Atankharzim | FS2 syntax highlighting

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Question about continous events.
I tried it. We're back to me being correct in the first place by the looks of it.

The problem is the = SEXP I suspect. I created the mission like this



Both events have a high repeat count (999999 or something). When run in the mission everything is fine until you press 1. Once that happens the message is repeated continually.

That's exactly what I saw when I tried this the first time using chained events. Unchaining and going on variables did nothing. Obviously the = SEXP is only evalutated once.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline Goober5000

  • HLP Loremaster
  • 214
    • Goober5000 Productions
Question about continous events.
Okay, try this:
http://www.swooh.com/peon/Goober5000/fs2_open_r.zip

FRED your test mission, then go into Notepad and change the "when" to "every-time".  Then load it up in this build and see if it works.

 

Offline Trivial Psychic

  • 212
  • Snoop Junkie
Question about continous events.
Goob, you wouldn't be trying to slip a new feature in during a code-freeze now would you? :D

*flees in terror as Goober's BFGreen charges up*
The Trivial Psychic Strikes Again!