Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Test Builds => Topic started by: karajorma on August 16, 2008, 03:37:44 pm

Title: I'll be lucky if 10 people care about this!....
Post by: karajorma on August 16, 2008, 03:37:44 pm
But I don't care cause those who will are likely to be very happy. :D While trying to fix a bug in the argument SEXPs I noticed that it should be possible to make this work.

(http://homepage.ntlworld.com/karajorma/Misc-Pics/Nested-Arguments1.jpg)
(http://homepage.ntlworld.com/karajorma/Misc-Pics/Nested-Arguments2.jpg)

The <Argument> being used will always be the first one encountered when working up the chain from the <argument>. You can not use an <argument> from the first SEXP in the 2nd or 3rd argument SEXPs unless you use SEXP variables to pass them downstream. You can however use them in anything else still (and that now includes when and every-time, both of which would crash the game previously).

Here (http://www.freespacefaq.com/Misc-Downloads/Builds/NestedArgumentsBuild.7z)'s the build for those who want to play with it. If you haven't understood a word I've been on about then this probably isn't for you. :p
Title: Re: I'll be lucky if 10 people care about this!....
Post by: Colonol Dekker on August 16, 2008, 03:45:37 pm
Funky :yes:

Just when i get my head around Variables... Arguments throw me off agin :lol:
I'm sure this will help me get to know em. :nod:
Title: Re: I'll be lucky if 10 people care about this!....
Post by: Topgun on August 16, 2008, 05:02:39 pm
huh? so beta will self-destruct if one of the fenris's subsystems are destroyed?
Title: Re: I'll be lucky if 10 people care about this!....
Post by: karajorma on August 16, 2008, 05:05:41 pm
The SEXP itself isn't exactly doing anything interesting as such. What's interesting is the way it's working. I'm using when-argument within a when-argument. FS2_Open used to crash if you tried that sort of shenanigans before.  :D
Title: Re: I'll be lucky if 10 people care about this!....
Post by: chief1983 on August 17, 2008, 10:07:40 pm
So is that's essentially just a when-then-when?  I'm not so amazed that you fixed it, as that something which seems fairly intuitive didn't work before.  I hope I'm understanding it, and good job for catching that, regardless.
Title: Re: I'll be lucky if 10 people care about this!....
Post by: karajorma on August 18, 2008, 03:05:19 am
Doing the following has been possible since retail

When
-x
-When
--Y
--Do something
-When
--Z
--Do something else

In coding terms it's equivalent to

Code: [Select]

if (x) {
   If (y) {
      Do something
  }
   if (z) {
      Do something else
   }
}

As you can see that's both perfectly legal but also something coders often want to do. That has always worked. The problem was with the new -argument SEXPs Goober added. An analogy for when-argument isn't as simple but lets say using one allows us to declare a variable inside the if statement (It isn't really like that but just to keep things simple). What we had in FS2_Open would be equivalent to this

Code: [Select]
if (x) {
   int a;
 
   If (y) {
      Do something
  }
   if (z) {
      Do something to a    <-----------------------------------   a can't be accessed here so the game crashes
   }
}

As you can see it's something you might expect to be legal and is definitely something I wanted fixed. :D
Title: Re: I'll be lucky if 10 people care about this!....
Post by: chief1983 on August 18, 2008, 08:53:19 am
Ooooh.  Yes, very good catch indeed.
Title: Re: I'll be lucky if 10 people care about this!....
Post by: Deckard on August 18, 2008, 12:29:50 pm
Nice one! ;)
Title: Re: I'll be lucky if 10 people care about this!....
Post by: karajorma on September 01, 2008, 02:58:18 pm
:bump:

http://www.freespacefaq.com/Misc-Downloads/Builds/Argument-Changes.7z

I need someone to download and test this build in a mission or two which uses the argument SEXPs heavily. BtRL would be a good choice but anything that uses them a lot will be fine. I want reports of any reproducible crashes which don't occur in other builds (WMCoolmon's build here (http://www.hard-light.net/forums/index.php/topic,56120.0.html) would be a good choice to test against if you do get a crash).

I need this tested whether or not you care about the argument stuff above as what I'm most concerned about is that the changes in this build broke something.
Title: Re: I'll be lucky if 10 people care about this!....
Post by: Colonol Dekker on September 01, 2008, 07:43:40 pm
I'm still getting to grips with SCP extras in general Karajorma, :ashamed: wish i could help.
Title: Re: I'll be lucky if 10 people care about this!....
Post by: Zacam on September 01, 2008, 09:48:58 pm
BtRL is completely unplayable with this build. The first mission alone drags on the FPS so bad, it,s like flying through syrup once the furball is on. The waypoints do not update properly, I loose targeting and any attempt to target anything gives me a "Disengaging Targeting System", so I have to eyeball it....which would be fine if it wasn't for the molasses effect.

At least it doesn't crash. I will give it that much. But then, I cannot get through the first mission.

BtRL was just installed and updated. No modifications to anything: I copied in the posted EXE from here and executed it directly.

All other builds (including the built in one) work fine.
Title: Re: I'll be lucky if 10 people care about this!....
Post by: karajorma on September 02, 2008, 01:09:53 am
Hang on a sec. You get bad FPS in this build but get good FPS on any other recent 3.6.10 builds (for instance the one I linked to)?
Title: Re: I'll be lucky if 10 people care about this!....
Post by: Zacam on September 02, 2008, 01:16:22 am
Yes.

_Especially_ in the first mission past training. Everything is fine up until you split to follow the waypoints.

Additionally, this build falls under Mantis 1759 (http://scp.indiegames.us/mantis/view.php?id=1759)
Title: Re: I'll be lucky if 10 people care about this!....
Post by: karajorma on September 02, 2008, 02:02:08 am
EDIT : Nevermind. I think I see what I did wrong.

Okay, can you redownload and test this one (http://www.freespacefaq.com/Misc-Downloads/Builds/Argument-Changes.7z).
Title: Re: I'll be lucky if 10 people care about this!....
Post by: Zacam on September 02, 2008, 09:53:37 pm
Much better. Waypoints update as they should, and everything is smooth. No failures so far. Anything specifically other than BtRL I should test?
Title: Re: I'll be lucky if 10 people care about this!....
Post by: karajorma on September 03, 2008, 01:46:39 am
BtRL was a good choice cause both myself and Axem used the argument SEXPs heavily. For instance the problem you were seeing was due to a mistake in the way the new code was handling the in-sequence SEXP and Axem's mission is probably the only released mission using that one (I don't think I even used it in my missions).

Anything with heavy use of argument SEXPs is good. Use of nested arguments like in the first post is better but obviously you'd need to build missions that do that yourself. :)
Title: Re: I'll be lucky if 10 people care about this!....
Post by: Zacam on September 03, 2008, 02:08:43 am
Ka-Oh. I've got some ideas.

BTW, still affected in BtRL of jumped out ships still being targeted. I think WMC has a fix pending that. Refer to either last post on his or the above linked Mantis.
Title: Re: I'll be lucky if 10 people care about this!....
Post by: Black Wolf on November 30, 2008, 12:12:30 am
How is this different to chaining sexps? Just more efficient in terms of sexp node usage?
Title: Re: I'll be lucky if 10 people care about this!....
Post by: Colonol Dekker on November 30, 2008, 03:27:50 am
What would normally take fifteen sexps can now be done by one. :yes:
Title: Re: I'll be lucky if 10 people care about this!....
Post by: karajorma on November 30, 2008, 04:53:25 am
How is this different to chaining sexps? Just more efficient in terms of sexp node usage?

It's a lot more powerful. For a start chaining events wouldn't let you do this if you wanted the event to repeat since chaining repeating events together has always been fraught with problems.

If you've ever had to do this you'll see the use

Event 1
when-argument
-list of ships
-condition
-modify variable
--variable name
--<argument>

Event 2

when
-condition
do-something to the ship in the above variable

You'll see what this change can do. Now you can avoid messing around with variables and simply have the second check inside the first event.