Jump to content


Photo

Script redeclaration problem?


  • Please log in to reply
18 replies to this topic

#1 grayman

grayman

    Master Builder, Coder

  • Active Developer
  • PipPipPipPipPip
  • 12934 posts

Posted 15 December 2018 - 10:58 PM

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.


#2 HMart

HMart

    Advanced Member

  • Member
  • PipPipPip
  • 864 posts

Posted 15 December 2018 - 11:34 PM

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. 



#3 grayman

grayman

    Master Builder, Coder

  • Active Developer
  • PipPipPipPipPip
  • 12934 posts

Posted 16 December 2018 - 12:08 AM

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

 

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



#4 nbohr1more

nbohr1more

    Darkmod PR, Wordsmith

  • Development Role
  • PipPipPipPipPip
  • 9518 posts

Posted 16 December 2018 - 12:22 AM

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.c...ds/the-dark-mod

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

#5 grayman

grayman

    Master Builder, Coder

  • Active Developer
  • PipPipPipPipPip
  • 12934 posts

Posted 16 December 2018 - 12:28 AM

Who handled the HRTF merge?



#6 nbohr1more

nbohr1more

    Darkmod PR, Wordsmith

  • Development Role
  • PipPipPipPipPip
  • 9518 posts

Posted 16 December 2018 - 12:49 AM

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.c...ds/the-dark-mod

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

#7 duzenko

duzenko

    Uber member

  • Active Developer
  • PipPipPipPip
  • 2321 posts

Posted 16 December 2018 - 04:59 AM

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?



#8 duzenko

duzenko

    Uber member

  • Active Developer
  • PipPipPipPip
  • 2321 posts

Posted 16 December 2018 - 05:26 AM

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.



#9 grayman

grayman

    Master Builder, Coder

  • Active Developer
  • PipPipPipPipPip
  • 12934 posts

Posted 16 December 2018 - 10:01 AM

@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.


  • Springheel likes this

#10 grayman

grayman

    Master Builder, Coder

  • Active Developer
  • PipPipPipPipPip
  • 12934 posts

Posted 16 December 2018 - 10:09 AM

@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."



#11 nbohr1more

nbohr1more

    Darkmod PR, Wordsmith

  • Development Role
  • PipPipPipPipPip
  • 9518 posts

Posted 16 December 2018 - 11:51 AM

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.c...ds/the-dark-mod

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

#12 nbohr1more

nbohr1more

    Darkmod PR, Wordsmith

  • Development Role
  • PipPipPipPipPip
  • 9518 posts

Posted 16 December 2018 - 12:01 PM

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


  • duzenko likes this
Please visit TDM's IndieDB site and help promote the mod:

http://www.indiedb.c...ds/the-dark-mod

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

#13 Springheel

Springheel

    Creative Director (retired)

  • Admin
  • 37781 posts

Posted 16 December 2018 - 12:02 PM

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?


TDM Missions:   A Score to Settle   *   A Reputation to Uphold   *   A New Job   *    A Matter of Hours
 
Video Series:   Springheel's Modules   *   Speedbuild Challenge   *   New Mappers Workshop  *   Building Traps

#14 nbohr1more

nbohr1more

    Darkmod PR, Wordsmith

  • Development Role
  • PipPipPipPipPip
  • 9518 posts

Posted 16 December 2018 - 12:12 PM

 

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.c...ds/the-dark-mod

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

#15 grayman

grayman

    Master Builder, Coder

  • Active Developer
  • PipPipPipPipPip
  • 12934 posts

Posted 16 December 2018 - 12:25 PM

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.



#16 Springheel

Springheel

    Creative Director (retired)

  • Admin
  • 37781 posts

Posted 16 December 2018 - 12:25 PM

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


TDM Missions:   A Score to Settle   *   A Reputation to Uphold   *   A New Job   *    A Matter of Hours
 
Video Series:   Springheel's Modules   *   Speedbuild Challenge   *   New Mappers Workshop  *   Building Traps

#17 nbohr1more

nbohr1more

    Darkmod PR, Wordsmith

  • Development Role
  • PipPipPipPipPip
  • 9518 posts

Posted 16 December 2018 - 12:30 PM

 
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.c...ds/the-dark-mod

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

#18 nbohr1more

nbohr1more

    Darkmod PR, Wordsmith

  • Development Role
  • PipPipPipPipPip
  • 9518 posts

Posted 16 December 2018 - 05:07 PM

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

 All set.


  • HMart likes this
Please visit TDM's IndieDB site and help promote the mod:

http://www.indiedb.c...ds/the-dark-mod

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

#19 grayman

grayman

    Master Builder, Coder

  • Active Developer
  • PipPipPipPipPip
  • 12934 posts

Posted 16 December 2018 - 09:48 PM

Fixed.

 

Thanks.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users