Page 1 of 1

ecompile.exe problem pol-core-Beta-x64-2016-10-15

Posted: Mon Apr 10, 2017 10:18 am
by guialtran
First of all, I'm sorry, I do not speak English.


I encountered a problem, when I was converting some old pol 95 scripts to the pol-core-Beta-x64-2016-10-15.

Using two constants within one (if (1 == 1)), generates an internal problem in the compiler.

The program does not know how to perform the function.
(PlayObjectCenteredEffectex), and when I put it.
(Print ("" + PlayObjectCenteredEffect (...))
Or the program closes.
20170410134009-0.dmp

Code: Select all

Use os;
Use uo;
program usea( character )
	erro(  Target( character )  );
endprogram

function erro( character )
	if( 1 == 1 )
		if(1 == 1)
			PlayObjectCenteredEffectex(character,14089,0,30);
		elseif( 2 == 1 )
			print(2);
		endif
	endif
endfunction
OR

Code: Select all

Use os;
Use uo;

const A := 1;
const B := 1;
const C := 2;
program usea( character )
	erro(  Target( character )  );
endprogram

function erro( character )
	if( A == B )
		if(B == A)
			//sleepms(1);
			print(""+PlayObjectCenteredEffect(character,14089,1,30));// CRASH POL
			//PlayObjectCenteredEffect(character,14089,0,30);
		elseif( B == C )
			print(2);
		endif
	endif
endfunction

Can someone tell me if this is normal?

It is forbidden to place two constants inside if (), example (if (1 == 1))?

i ADD arquive CRASH 20170410140946-0.dmp

Re: ecompile.exe problem pol-core-Beta-x64-2016-10-15

Posted: Mon Apr 10, 2017 4:18 pm
by Yukiko
I'm not sure what you are attempting to accomplish with the "if" statements but if you want the character to target an object and have the effect appear on the object you will need to assign a variable to the object reference returned by the function Target as in my example below:

Code: Select all

Use os;
Use uo;
program usea( character )
	var targ := Target( character );
	erro(targ);
endprogram

function erro( targ )
	if( 1 == 1 )
			PlayObjectCenteredEffectex(targ,14089,0,30);
			print(2);
		
	endif
endfunction
I will note that the effect only appeared when I targetted a mobile. It should appear for any object such as a dynamically (in game) placed item. When I added the "elseif(2 ==1)" after the PlayObjectCenteredEffectex statement I didn't get the flame effect either. See below:

However POL didn't crash when I ran your original code either. I used your first example.

This programme doesn't work.

Code: Select all

Use os;
Use uo;
program usea( character )
	var targ := Target( character );
	erro(targ);
endprogram

function erro( targ )
	if( 1 == 1 )
			PlayObjectCenteredEffectex(targ,14089,0,30);
	elseif(2 == 1)
			print(2);
		
	endif
endfunction

Re: ecompile.exe problem pol-core-Beta-x64-2016-10-15

Posted: Mon Apr 10, 2017 7:22 pm
by guialtran
This program has no purpose.
I want to show that when you use this pol with this code, the pol crash.
And I mean that the compiler is generating a faulty code when I put constants inside the if ()

Re: ecompile.exe problem pol-core-Beta-x64-2016-10-15

Posted: Tue Apr 11, 2017 12:20 am
by Yukiko
Oh. My apologies. You're doing the work of the angels, and a good bug tester; trying to break something we think works. :)

Also, it's good to find "crash points" because these are often exploited by hackers.

Thanks for pointing this out.

I thought your code looked strange :P Now I know why.

Re: ecompile.exe problem pol-core-Beta-x64-2016-10-15

Posted: Tue Apr 11, 2017 3:07 am
by guialtran
Was a very old pol 95 code (with problem) 2k lines
I've erased everything.
That was left
I hope it helped you.

I think it should generate a compilation error when the programmer puts 2 constants inside an if, because this does not make sense.

PS: Could you explain why this(crash) happens?