Tripwire Interactive Forums

Go Back   Tripwire Interactive Forums > Red Orchestra 2 / Rising Storm Forums > RO2/RS Modifications > Coding

Reply
Click here to go to the first Dev post in this thread.  
Thread Tools Display Modes
  This is the last developer post in this thread.   #21  
Old 05-10-2012, 04:05 PM
[TW]StragoMagus [TW]StragoMagus is offline
Tripwire Interactive Staff
 
Join Date: Jun 2010
Posts: 97
Default

Quote:
Originally Posted by LordGleedo View Post
Upon compiling I get the following error:
Code:
Error, Missing opening '(' in Implements list
According to the documentation, the above should work:
http://udn.epicgames.com/Three/Unrea...nterfaces.html

My eyes have glazed over lol
On what line does does your code start generating compiler errors?
Reply With Quote
  #22  
Old 05-11-2012, 02:41 AM
LordGleedo's Avatar
LordGleedo LordGleedo is offline
Senior Member
 
Join Date: Jul 2010
Location: Bucks, England
Posts: 776
Default

Quote:
Originally Posted by [TW]StragoMagus View Post
On what line does does your code start generating compiler errors?
I believe in the two examples below, that in both cases it was the "if" line, but I can double check when I get home. Interesting thing is, the compiler shows the error mentioned, but does not specify a line number like it does for all other errors that ive ever seen.

Code:
if ( FTPawnIntf(HitActor) != none)
{
     // do stuff here....
}
Code:
local FTPawnIntf myIntf;

myIntf = FTPawnIntf(HitActor);

if ( myIntf != none)
{
     // do stuff here....
}
I believe the 2nd example is definitely the correct usage (according to the tutorials ive read) and indeed it does work and "myIntf" is usable as an interface in my UDK version, so I can do myIntf.Testfunction.

I am happy to throw together a very simple project to demonstrate this and send it to you if you wish?

Last edited by LordGleedo; 05-11-2012 at 03:55 AM.
Reply With Quote
  #23  
Old 05-11-2012, 05:02 AM
Ducky's Avatar
Ducky Ducky is offline
Moderator
 
Join Date: May 2011
Location: Netherlands
Posts: 2,723
Default

Your aproach is wrong. Try this:

Code:
var FTPawnIntf myIntf;  // To set reference to your interface
 
if (myIntf(HitActor) != none)
{
     // do stuff here....
}
I know it looks odd, but this is how it should be done with interfaces.
Reply With Quote
  #24  
Old 05-11-2012, 07:05 AM
LordGleedo's Avatar
LordGleedo LordGleedo is offline
Senior Member
 
Join Date: Jul 2010
Location: Bucks, England
Posts: 776
Default

Quote:
Originally Posted by Ducky View Post
Your aproach is wrong. Try this:

Code:
var FTPawnIntf myIntf;  // To set reference to your interface
 
if (myIntf(HitActor) != none)
{
     // do stuff here....
}
I know it looks odd, but this is how it should be done with interfaces.
The above code is the correct usage (as you say), it is what I am using, and it does not compile. It works fine in the UDK.
Reply With Quote
  #25  
Old 05-11-2012, 02:18 PM
LordGleedo's Avatar
LordGleedo LordGleedo is offline
Senior Member
 
Join Date: Jul 2010
Location: Bucks, England
Posts: 776
Default

OK, it was not a problem with the interface.

I basically had this code which should compile:

Code:
local FTPawnIntf myPawnIntf;

myPawnIntf = FTPawnIntf(HitActor);

// test if this actor implements our custom pawn interface...
if (myPawnIntf != none)
{
	`Log(">>> DEBUG : Actor has interface", , 'FTPlayerController');
}
But that results in the compile error:
Code:
Error, Missing opening '(' in Implements list

However, If I remove the log line (that I use everywhere!), and replace it with something else like below, it compiles and works.

Code:
local FTPawnIntf myPawnIntf;

myPawnIntf = FTPawnIntf(HitActor);

// test if this actor implements our custom pawn interface...
if (myPawnIntf != none)
{
	// we have a valid target to thaw!
	ClientMessage("Hit: Frozen Team Mate Detected");
	ClientMessage("Hit: "$HitActor$"  class: "$HitActor.class.outer.name$"."$HitActor.class);
	return ROPawn(HitActor);	
}
So the compile error, for some unknown reason, was caused by having a log statement inside my 'if' condition.

That would also be why it worked in the UDK version of my mod because I did not include the log line!

Last edited by LordGleedo; 05-11-2012 at 02:41 PM.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:28 AM.


Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Copyright ©2005 - 2013, Tripwire Interactive, LLC