MantisBT - Zandronum
View Issue Details
0002670Zandronum[All Projects] Bugpublic2016-03-07 04:162018-09-30 21:50
throwaway 
Torr Samaho 
normalminoralways
closedfixed 
3.0-beta 
3.03.0 
0002670: ACS_NamedExecuteWithResult on clientside script online - arguments get shifted as it goes to client
Simple enough. Arguments from ACS_NamedExecuteWithResult on a clientside script, when getting sent to the client, all get shifted to the left by 1. <arg1, arg2, arg3, arg4> becomes <arg2, arg3, arg4, 0>.
Take these two scripts:

script "y" (int a1, int a2, int a3) { ACS_NamedExecuteWithResult("z", a1,a2,a3); }

script "z" (int a1, int a2, int a3) clientside { Log(s:"<", d:a1, s:", ", d:a2, s:", ", d:a3, s:">"); }


1. Join a netgame with those two scripts and sv_cheats on.
2. Go to console
3. pukename y 1 2 3

You should see "<1, 2, 3>" get logged. Offline, it does. Online, "<2, 3, 0>" gets logged instead.
No tags attached.
? acsexecrestest.pk3 (656) 2016-09-17 15:10
/tracker/file_download.php?file_id=1888&type=bug
Issue History
2016-03-07 04:16throwawayNew Issue
2016-03-07 09:04DuskNote Added: 0014565
2016-03-07 12:12FusedNote Added: 0014567
2016-03-07 19:19throwawayNote Added: 0014568
2016-03-08 01:41CatastropheNote Added: 0014569
2016-03-08 01:42CatastropheNote Edited: 0014569bug_revision_view_page.php?bugnote_id=14569#r8827
2016-03-08 17:24FascistCatNote Added: 0014570
2016-03-08 17:25FascistCatNote Edited: 0014570bug_revision_view_page.php?bugnote_id=14570#r8829
2016-03-10 11:36DuskNote Added: 0014571
2016-04-16 18:55LeonardNote Added: 0014720
2016-04-30 09:31FusedNote Added: 0014772
2016-07-09 17:38Torr SamahoNote Added: 0015242
2016-07-09 17:38Torr SamahoAssigned To => Torr Samaho
2016-07-09 17:38Torr SamahoStatusnew => feedback
2016-09-16 19:18FusedNote Added: 0015645
2016-09-16 19:18FusedNote Edited: 0015645bug_revision_view_page.php?bugnote_id=15645#r9512
2016-09-17 08:35Torr SamahoNote Added: 0015646
2016-09-17 14:14IvanNote Added: 0015647
2016-09-17 14:44Torr SamahoFile Added: acsexecrestest.pk3
2016-09-17 14:56Torr SamahoFile Deleted: acsexecrestest.pk3
2016-09-17 15:10Torr SamahoFile Added: acsexecrestest.pk3
2016-09-17 15:13Torr SamahoNote Added: 0015648
2016-09-17 15:13Torr SamahoStatusfeedback => needs testing
2016-09-17 15:34IvanNote Added: 0015649
2016-12-24 22:42DuskTarget Version => 3.0
2017-01-26 05:59Ru5tK1ngNote Added: 0016694
2017-01-26 05:59Ru5tK1ngStatusneeds testing => resolved
2017-01-26 05:59Ru5tK1ngResolutionopen => fixed
2017-01-26 05:59Ru5tK1ngFixed in Version => 3.0
2018-09-30 21:50Blzut3Statusresolved => closed

Notes
(0014565)
Dusk   
2016-03-07 09:04   
There's two problems here:
- the server indeed sends the incorrect arguments to the client, because it was copy/pasted from ACS_ExecuteWithResult without adjusting the arguments in relation to the missing map parameter. Thanks, Carn.
- ACS_(Named)ExecuteWithResult shouldn't be used to execute clientside scripts like this. The point of the function is to immediately call the script and request the result value from it. The client/server mechanism provides neither.

Since it's not working at all in the first place, there shouldn't be any mods relying on it, so I suggest we disable it.
(0014567)
Fused   
2016-03-07 12:12   
Having it work in clientsided scripts can create nice features though. For example I wanted to create a waterfall that has a different translucency for software users, because it looks different compared to opengl. Same goes for other clientsided actors that could support software mode in a way.
(0014568)
throwaway   
2016-03-07 19:19   
If you're going to disable it, print a warning the first time the scripts tries to WithResult a clientside script online, because I ran into this entirely by accident.

(I use ExecuteWithResult to instantly execute tracer scripts in single player, without the potential inexplicable one-tic delay of ExecuteAlways)
(0014569)
Catastrophe   
2016-03-08 01:41   
(edited on: 2016-03-08 01:42)
> Having it work in clientsided scripts can create nice features though. For example I wanted to create a waterfall that has a different translucency for software users, because it looks different compared to opengl. Same goes for other clientsided actors that could support software mode in a way.

Sorry but gotta agree with Dusk here. ACS_executewithresult needs to return something immediately. Using it for client-server communication is a big no-no due to latency.

However, if you are using ACS_executewithresult on clientside script to clientside script, then you should be fine. The examples you gave can be more or less done purely with clientside scripts only.

(0014570)
FascistCat   
2016-03-08 17:24   
(edited on: 2016-03-08 17:25)
Maybe the same issue happens (where values are handled with an offset) when returning values using clientside scripts like here:'http://zandronum.com/tracker/view.php?id=2367 [^]' , because the returning value is always zero on a netgame.

(0014571)
Dusk   
2016-03-10 11:36   
Quote from "Fused"
Having it work in clientsided scripts can create nice features though. For example I wanted to create a waterfall that has a different translucency for software users, because it looks different compared to opengl. Same goes for other clientsided actors that could support software mode in a way.

That has nothing to do with ACS_(Named)ExecuteWithResult in particular. That simply relies on server→client ACS calls that work with ACS_(Named)Execute(Always).

Quote from "FascistCat"
Maybe the same issue happens (where values are handled with an offset) when returning values using clientside scripts like here:http://zandronum.com/tracker/view.php?id=2367, because the returning value is always zero on a netgame.

That is a different issue, relating to DECORATE.
(0014720)
Leonard   
2016-04-16 18:55   
Of course the return value problem is hopeless but ACS_ExecuteWithResult supports a 4th argument that no other ACS-calling function has and this advantage could be useful even for clientside scripts.
(0014772)
Fused   
2016-04-30 09:31   
We've been using a non-official 3.0 binary that properly handles this to properly test our mod since a few weeks now. Will this be addressed at all?
At the very least the arguments shouldn't be shifted on the clients and the 4th argument should be useable as it is very useful in many cases.
(0015242)
Torr Samaho   
2016-07-09 17:38   
The arguments definitely shouldn't be shifted on the clients. If you add a minimal example wad, I'll look into this. Would also be helpful if you post the code changes of the non-official binary you are using.
(0015645)
Fused   
2016-09-16 19:18   
Sorry, but the binary was kind of lost as time passed because it was not going to get updated every time a new 3.0 build was released.

Has there been progress on this? I can't work without this because of desync, and it's a pretty bad bug.

(0015646)
Torr Samaho   
2016-09-17 08:35   
I'm still waiting for the minimal example wad I asked for two months ago. Also disclosing the code changes of the non-official binary would be helpful.
(0015647)
Ivan   
2016-09-17 14:14   
Made the example wad as the OP suggested:'https://www.dropbox.com/s/x572n4gl7n2yi2l/acsexecrestest.pk3?dl=0 [^]'

However I see nothing online for some reason. Offline works fine.
(0015648)
Torr Samaho   
2016-09-17 15:13   
As far as I can tell, the script "Y" was not flagged as CLIENTSIDE in the compiled ACS lump in your example pk3. I recompiled the ACS source and uploaded the result. When using this, the CLIENTSIDE script is executed on the clients.

I also fixed the argument shifting. Note: Currently, ACS_ExecuteWithResult still only supports three arguments on CLIENTSIDE scripts.
(0015649)
Ivan   
2016-09-17 15:34   
It indeed wasn't, as I just copied the example scripts provided in the OP. The OP forgot CLIENTSIDE on script "y" which caused the problem on my end.
(0016694)
Ru5tK1ng   
2017-01-26 05:59   
Tested with the latest changes and the argument shifting seems to be gone now.