Jump to content
The Dark Mod Forums
Sign in to follow this  
grayman

Script redeclaration problem?

Recommended Posts

I started WS2:Home Again using the latest SVN (15447/7824) and got this error:

 

"ERROR: Error: file maps\ws2_homeagain.script, line 59: Type mismatch on redeclaration of length"

 

The line in question is:

 

float length = gybbsPlayer.startSoundShader(recording,1);
startSoundShader returns a float to the thread where the line in question appears.
The odd thing is the claim that the line redeclares "length" when this is the only declaration of "length" in the script file.
Anyone been fiddling with types lately?
Thx.

Share this post


Link to post
Share on other sites

That looks like a naming conflict, is that a map script or a object script? If is a map script did you put your code inside a namespace, to make it unique? If is a object script you need to use define guards to prevent conflicts.

 namespace mapname { 
     map code 
} 
#ifndef __SOMESCRIP__
#define __SOMESCRIP__

object code here

#endif //__SOMESCRIP__

hope this helps.

Share this post


Link to post
Share on other sites

map script, w/o namespace. wrapping with namespace still fails.

 

This script has been in use for 4+ years w/o reporting this error.

Share this post


Link to post
Share on other sites

If I had to hazard a guess, I suspect that the HRTF merge may have added data attributes to that audio

lookup and now it's getting bad data back?


Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Share this post


Link to post
Share on other sites

Stgatilov.

 

Now that I think about the error more, "length" might now be a reserved word in scripting?

 

Maybe that was done with stgatilov's changes to resolution handling.

 

Does replacing it with au_length or some other variable name fix it?


Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Share this post


Link to post
Share on other sites

It looks like it's conflicting with the existing float length(ev_vector) function

Personally I'm clueless but is it possible that @stgatilov fixed the typeinfo in a way that the scripts now have access to the underlying type methods?

ev_vector is based on IdVec3.

 

We do seem to have scriptEvent float vecLength(vector vec) already though.

 

@grayman I'm curious why you put the script file in the pk4/maps folder rather than in pk4/script? Is that where all fm scripts must go to?

Share this post


Link to post
Share on other sites

OK, here it is

darkmod\script\trigger_look.script

float length(vector v) {
	return sys.sqrt(v_x*v_x+v_y*v_y+v_z*v_z);
}
Revision: 14617
Author: springheel
Date: вторник, 1 ноября 2016 г. 23:06:31
Message:
obs look scripts
----
Added : /trunk/script/ai_trigger_look.script
Added : /trunk/script/trigger_look.script


@grayman, your first instinct might be to rename length in your map script however I suggest removing the function in trigger_look and replace its usage to vecLength as the latter is the binary code and is obviously faster.

Share this post


Link to post
Share on other sites

@grayman, your first instinct might be to rename length in your map script however I suggest removing the function in trigger_look and replace its usage to vecLength as the latter is the binary code and is obviously faster.

 

Nay nay, my first instinct is not to change my script.

 

There are at least 54 mission-supplied scripts already out there, and it's incumbent on us to not screw them up.

 

The question I would ask is : How many of them now won't run due to the recent changes.

 

The recent changes must be made to live with the released missions.

 

Of course, once those changes are made, we are now forced to verify there's been no further damage, and all of these missions must be started with the first 2.07 beta candidate to ferret out any other namespace collisions.

  • Like 1

Share this post


Link to post
Share on other sites

@grayman I'm curious why you put the script file in the pk4/maps folder rather than in pk4/script? Is that where all fm scripts must go to?

It's been that way since day 1.

 

From the wiki page:

 

"Using a plain text editor create a blank file with the same name as your map, eg, testScripts.script and save it in the same folder as your map."

Share this post


Link to post
Share on other sites

Yes. I looks like Springheel was trying to help the community by making Obsttorte's script part of the core mod.

Too bad it conflicts with the existing script. This probably never came up before because it was only ever used

as a custom script in mission packs. The best course of action is to change the newest one.

 

Removing trigger_look and it's entry in the master custom script file resolves this.


Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Share this post


Link to post
Share on other sites

Yes. I looks like Springheel was trying to help the community by making Obsttorte's script part of the core mod.

Too bad it conflicts with the existing script. This probably never came up before because it was only ever used

as a custom script in mission packs. The best course of action is to change the newest one.

 

Removing trigger_look and it's entry in the master custom script file resolves this.

 

Those look scripts have been part of the core mod for more than two years and have been through two different beta-testing cycles. Why would they just start causing problems now?

Share this post


Link to post
Share on other sites

 

Those look scripts have been part of the core mod for more than two years and have been through two different beta-testing cycles. Why would they just start causing problems now?

 

Because you added them to tdm_custom_scripts.script in rev 15443 December 15th 2018

 
+//#include "script/tdm_ropescroller.script"
+#include "script/ai_trigger_look.script"
+#include "script/trigger_look.script"
 

when you tried removing the New Job scripts from TDM.


Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Share this post


Link to post
Share on other sites

OK. I applied Duzenko's workaround to trigger_look and now WS2 loads again in Trunk.

 

How about in the 2.07 branch? That's where we're supposed to be making changes from now until 2.07 ships and we can switch back to the trunk.

 

Edit: The 2.07 branch still crashes.

Share this post


Link to post
Share on other sites

Well, that would definitely explain it. Not sure what happened there, but thanks for fixing it.

Share this post


Link to post
Share on other sites

 

How about in the 2.07 branch? That's where we're supposed to be making changes from now until 2.07 ships and we can switch back to the trunk.

 

Edit: The 2.07 branch still crashes.

I'll do that once 207 branch has finished downloading.


Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...