[ian-reeds-games] Re: Dev 41 craigs scripts bugs

  • From: "Allan Thompson" <allan1.thompson@xxxxxxx>
  • To: <ian-reeds-games@xxxxxxxxxxxxx>
  • Date: Sun, 3 Nov 2013 15:53:28 -0500

Sorry. I have two TB running, one is dev 39 and one is dev41. I sent the
wrong map pack. This link will give you the right test map to use.

https://dl.dropboxusercontent.com/u/68028683/test%20map.txt


-----Original Message-----
From: ian-reeds-games-bounce@xxxxxxxxxxxxx
[mailto:ian-reeds-games-bounce@xxxxxxxxxxxxx] On Behalf Of Allan Thompson
Sent: Sunday, November 03, 2013 3:22 PM
To: ian-reeds-games@xxxxxxxxxxxxx
Subject: [ian-reeds-games] Dev 41 craigs scripts bugs

Ok guys. I just went and tried the scripts out on my age of warlords map.

The move unit works fine still.
My permenant toggle team works
The temp toggle team script does not work at all. It lists some kind of
error which I will paste below.
The change unit is broke, but in strange ways I don't understand.

For example in all of my units that use the change unit, it simply does not
work minus one.
This one  deals with turning a unit into a statue. For that reason it works,
but the remove effect does not work to change it back, which means the
revert script is broke.
As I am pasting the various errors, I noticed that the gaze attack that
turns one into a stone statue did not work on a cleric, but did work on a
druid. I am not sure why this is. I am going to provide a link to the
version I am using in dev41. The test map is what you want to look at. 
There is an evil medusa. It will usually do the druid, unless you manipulate
units  so sh will strike at different ones. The druid will turn into stone,
but the cleric will not. 
The fairy does the temp toggle, the bard does the  permenant one, using
major charm.

The warden should turn  into invisible warden, wraith should turn into
incorporeal wraith, weer warrior into weer wolf, orc heavy marauders into
light marauders when it releases the hounds, and when the hounds recall, it
should go back to heavy marauders.
The human archers and catapult should transform after five attacks. The
great wyvern uses the wing storm to move units.

Clerics and druids can remove petrify, to test on stone statues etc.

I think that covers the test map. Below is link for age of warlords and test
map, below that ist he errors, but they can be reproduced as you use the
test map as well.

https://dl.dropboxusercontent.com/u/68028683/age%20of%20warlords.zip


Note: Below is script error for trying to use the revert script. 

Error in script.
Calling Context: toggle_team_effect
Filename: teamtoggle.js
Line: 65
Column: 29, 30
Method 'Game.JSScriptFlagsDictionary.Item' not found.
Noesis.Javascript.JavascriptException: Method
'Game.JSScriptFlagsDictionary.Item' not found. --->
System.MissingMethodException: Method 'Game.JSScriptFlagsDictionary.Item'
not found.
   at System.RuntimeType.InvokeMember(String name, BindingFlags
bindingFlags, Binder binder, Object target, Object[] providedArgs,
ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
   at Noesis.Javascript.JavascriptExternal.SetProperty(JavascriptExternal* ,
Handle<v8::Value>* , UInt32 iIndex, Handle<v8::Value> iValue)
   --- End of inner exception stack trace ---
   at Noesis.Javascript.JavascriptContext.Run(String iScript, String
iScriptResourceName)
   at Game.JS.Run(String script, String callingContext) in
C:\Data\Recent\TacticalRPG\TacticalRPG\JS.cs:line 113

* Note: Below is the error when attempting to use a temporary toggle script
 
Error in script.
Calling Context: toggle_team_effect
Filename: teamtoggle.js
Line: 65
Column: 29, 30
Method 'Game.JSScriptFlagsDictionary.Item' not found.
Noesis.Javascript.JavascriptException: Method
'Game.JSScriptFlagsDictionary.Item' not found. --->
System.MissingMethodException: Method 'Game.JSScriptFlagsDictionary.Item'
not found.
   at System.RuntimeType.InvokeMember(String name, BindingFlags
bindingFlags, Binder binder, Object target, Object[] providedArgs,
ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
   at Noesis.Javascript.JavascriptExternal.SetProperty(JavascriptExternal* ,
Handle<v8::Value>* , UInt32 iIndex, Handle<v8::Value> iValue)
   --- End of inner exception stack trace ---
   at Noesis.Javascript.JavascriptContext.Run(String iScript, String
iScriptResourceName)
   at Game.JS.Run(String script, String callingContext) in
C:\Data\Recent\TacticalRPG\TacticalRPG\JS.cs:line 113

*Note: the below happened when I had reloaded the map. The unit was changed
into a stone statue, but this error happened. This is confuseing because
this skill did not work at all on a different unit. 

Error in script.
Calling Context: change_unit_type
Filename: typechanges.js
Line: 64
Column: 28, 29
Index was out of range. Must be non-negative and less than the size of the
collection.
Parameter name: index
Noesis.Javascript.JavascriptException: Index was out of range. Must be
non-negative and less than the size of the collection.
Parameter name: index ---> System.ArgumentOutOfRangeException: Index was out
of range. Must be non-negative and less than the size of the collection.
Parameter name: index
   at System.ThrowHelper.ThrowArgumentOutOfRangeException()
   at System.Collections.Generic.List`1.set_Item(Int32 index, T value)
   at Game.JSList`1.set_Item(Int32 index, T value) in
C:\Data\Recent\TacticalRPG\TacticalRPG\JSList.cs:line 31
   --- End of inner exception stack trace ---
   at Noesis.Javascript.JavascriptContext.Run(String iScript, String
iScriptResourceName)
   at Game.JS.Run(String script, String callingContext) in
C:\Data\Recent\TacticalRPG\TacticalRPG\JS.cs:line 113






-----Original Message-----
From: ian-reeds-games-bounce@xxxxxxxxxxxxx
[mailto:ian-reeds-games-bounce@xxxxxxxxxxxxx] On Behalf Of Ian Reed
Sent: Sunday, November 03, 2013 1:32 PM
To: ian-reeds-games@xxxxxxxxxxxxx
Subject: [ian-reeds-games] Dev 41: A fix for Craig's scripts, hopefully

I've released dev 41.
Be wary of trying it unless you want to help me find the bugs.
I haven't tested with Craig's scripts directly since I don't have test cases
for that so I appreciate anyone who wants to check if this fixes them.

Craig, I did find the problem with setting variables on the global object
and it should be fixed now.
If it wasn't broken in dev 38 and 39 I'm surprised because I don't think
that code changed in dev 40.

In dev 38 I changed how the global object works.
It used to be an actual javascript object, but now it is a C# object.

There are 3 things you should know about:
1 The scripter storage stuff is no longer necessary.
Because it is a C# object you can store actual C# types on it like Units,
Skills or Items and they will get saved and loaded properly.
That is the main reason I made this change.

2 If you set a javascript object on the global object it will change it into
a C# object.
This means that you'll want to get a new reference to that object.
So this code does not work:
var cr = new Object();
global.craig_brett = cr;
// at this point cr is still a javascript object and global.craig_brett is a
C# object.
On the other hand this code does work:
global.craig_brett = new Object();
var cr = global.craig_brett;
// both cr and global.craig_brett point to the same C# object.

I've done this because javascript objects can not be shared between
javascript and C# and always get copied by value when they cross the
language boundary.
So the best I can do is turn the copied by value object into a C# object
that can be shared after that point.

3 for (var prop in object) continues to not work on the C# objects and
arrays.
This has not changed but since you were storing javascript arrays and
objects on the global object you may have previously been using this form of
iteration on them which would be broken now since they are converted to C#
objects.

Sorry for the changes, but I think it's better off since it gets rid of the
confusing scripter storage stuff.

Ian Reed






Other related posts: