[Fixed] switches don't switch with acs_execute

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

switches don't switch with acs_execute

Postby Cyb » Tue Dec 23, 2003 12:07 am

in hubs, if you have a switch in one map that executes a script in another map the script will trigger just fine, but the switch won't swap textures and make a noise, so it seems like it hasn't been triggered at all. I attached an example of this.
You do not have the required permissions to view the files attached to this post.
Cyb
 
Joined: 15 Jul 2003

Postby cccp_leha » Tue Dec 23, 2003 12:30 am

Weird stuff. If you call ACS_execute(1, 2, 0, 0, 0) from within the script, it works just fine though...
User avatar
cccp_leha
Words are silver; silence is gold... so stfu.
 
Joined: 16 Jul 2003
Location: NJ, USA

Postby Cyb » Tue Dec 23, 2003 12:56 am

yeah, indirectly it works, but not directly, so it's not an issue for a work-around, but it still seems like it shouldn't be that way. Though it does sort of make sense since a script you execute on another map is actually executed when you (re)enter that map, so the switch won't flip until then... or something
Cyb
 
Joined: 15 Jul 2003

Postby Virgil » Tue Dec 23, 2003 3:09 am

I'm almost positive there's a way around it. Try making a script that executes the script you want to execute. This new script should have a map arg of 0. Then bind the switch onto this new script instead of onto the script that executes in another map. The switch should be fooled, since the script it is bound to has a map arg of 0.

I agree with you though. I think making a script just to execute another script on a different map is a waste. It'd be nice if ACS_Execute had an optional 6th parameter such as IsSwitchSilent, or something like that.
User avatar
Virgil
 
Joined: 28 Sep 2003

Postby Graf Zahl » Tue Dec 23, 2003 4:46 am

Virgil wrote:I agree with you though. I think making a script just to execute another script on a different map is a waste. It'd be nice if ACS_Execute had an optional 6th parameter such as IsSwitchSilent, or something like that.



Where do you want to put the 6th parameter? The map format only supports 5 plus, you can always put a non-switch texture on a wall if you don't want a switch effect.
Regarding Cyb's bug, it's just a missing 'return true' statement in the case that handles scripts on other maps so my guess is it will be fixed in the next version.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Postby The Ultimate DooMer » Tue Dec 23, 2003 6:55 am

It does support 6 parameters, but it would have to be an internal function. (like Thing_Projectile2)
User avatar
The Ultimate DooMer
Will you start the fans please!
 
Joined: 15 Jul 2003
Location: Industrial Zone

Postby Graf Zahl » Tue Dec 23, 2003 6:58 am

The Ultimate DooMer wrote:It does support 6 parameters, but it would have to be an internal function. (like Thing_Projectile2)


That's what I meant. Since this problem only occurs when the special is placed directly onto a linedef an internal function would be useless because the additional parameter has no use inside a script.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Postby Cyb » Tue Dec 23, 2003 11:28 am

Virgil wrote:I'm almost positive there's a way around it. Try making a script that executes the script you want to execute. This new script should have a map arg of 0. Then bind the switch onto this new script instead of onto the script that executes in another map. The switch should be fooled, since the script it is bound to has a map arg of 0.


way to say exactly what leha said in 4x as many words :P
Cyb
 
Joined: 15 Jul 2003

Postby Virgil » Tue Dec 23, 2003 3:42 pm

Does the switch get fooled though? I haven't tried it yet.
User avatar
Virgil
 
Joined: 28 Sep 2003

Postby cccp_leha » Tue Dec 23, 2003 3:46 pm

cccp_leha wrote:Weird stuff. If you call ACS_execute(1, 2, 0, 0, 0) from within the script, it works just fine though...

LOL
User avatar
cccp_leha
Words are silver; silence is gold... so stfu.
 
Joined: 16 Jul 2003
Location: NJ, USA

Postby HotWax » Fri Dec 26, 2003 3:26 am

Virgil wrote:Does the switch get fooled though? I haven't tried it yet.


Fooled? No. When you press use on the linedef with the switch, it checks its action to see if it can be used. If so, it checks its special. Since it activates an ACS script, it does so, plays the switch sound, and changes texture. What the script does (in this case calls a script in another map) has no bearing on the way the switch behaves.

The issue is that if the special on the line is to directly execute a script on another map, for some reason (the return true mentioned above, probably) the switch doesn't do its thing and so it seems to the player that nothing has happened.
User avatar
HotWax
Do what you must, and pay the price later.
 
Joined: 18 Jul 2003
Location: Idaho Falls, ID

Postby Graf Zahl » Fri Dec 26, 2003 7:23 am

For all those who are interested, here's the cause for this bug:

Code: Select allExpand view
bool P_StartScript (AActor *who, line_t *where, int script, char *map, int lineSide,
               int arg0, int arg1, int arg2, int always, bool net)
{
   if (map == NULL || 0 == strnicmp (level.mapname, map, 8))
   {
      // doing stuff here which returns true when a script is started
,   }
   else
   {
      addDefered (FindLevelInfo (map),
               always ? acsdefered_t::defexealways : acsdefered_t::defexecute,
               script, arg0, arg1, arg2, who);
               
      // return true; - this is missing here!
   }
   return false;
}


In short: a simple case of a missing return statement.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Postby randi » Fri Jan 02, 2004 8:43 pm

Fixed.
User avatar
randi
Site Admin
 
Joined: 09 Jul 2003


Return to Closed Bugs

Who is online

Users browsing this forum: No registered users and 1 guest