|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
hiring_dude Newbie cheater Reputation: 0
Joined: 28 Nov 2010 Posts: 20
|
Posted: Tue Dec 27, 2011 7:59 am Post subject: form property access and few bugs |
|
|
Hi,
still working on my project..
I want to draw some graphics from retrieved statistics and then use canvas.
Mantis tracking bugs
NOTE : all those test have been done with a "panel" control
1 ---------------------------------------------------------------------------
MINOR
canvas_getWidth and canvas_getHeight return Zero until you modify some canvas property
also got "access violation" error message box after 1st execution of the loaded .ct
get reseted to 0 each time a window cover (even partially) the customControl
----------------------------------------- code example
canvas = customControl_getCanvas(UDF1_PANEL);
print(canvas_getWidth(canvas));
print(canvas_getHeight(canvas));
canvas_setPenPosition(canvas, 0, 0);
print(canvas_getWidth(canvas));
print(canvas_getHeight(canvas));
output :
0
0
320
240
2 ---------------------------------------------------------------------------
MINOR
canvas_lineTo(destinationx, destinationy)
the function do not exist..
3 ---------------------------------------------------------------------------
MINOR
following function have no effect :
brush_setColor(brush, color)
color remain 0xFFFFFF and affect following function
canvas_rect()
canvas_fillRect()
canvas_ellipse()
canvas_textOut(x,y, text) -- bg remain white
4 ---------------------------------------------------------------------------
MINOR
is it normal that canvas_rect() is filled with the brush color ?
a simple workaround would be to use canvas_line() to draw manually the borders,
but what can i do with canvas_ellipse() if i want to simply draw an unfilled circle
5 ----------------------------------------------------------------------------
TRIVIAL
uncomplete documentation :
canvas_lineTo(canvas, destinationx, destinationy)
canvas_rect(canvas,x1,y1,x2,y2)
canvas_fillRect(canvas,x1,y1,x2,y2)
canvas_textOut(canvas, x, y, text)
6 ----------------------------------------------------------------------------
TRIVIAL
I don't understand what do this function because have no visual effect :
canvas_floodFill(canvas,x,y)
7 ----------------------------
QUESTION ABOUT : Undefined Property Functions
Quote: | Not all properties of all classes have been explicitly exposed to lua, but if you know the name of a property of a specific class you can still access them (assuming they are declared as published in the pascal class declaration)
getPropertyList(class)
Returns a StringList object containing all the published properties of the specified class (free the list when done) (Note, not all classed with properties have 'published' properties. E.g StringList itself)
setProperty(class, propertyname, propertyvalue) Sets the value of a published property of a class (Won't work for method properties)
getProperty(class, propertyname) Gets the value of a published property of a class (Won't work for method properties) |
The documentation seem to refer to property listed in the object Inspector windows property panel.
we are able to effectively do :
print(getProperty(UDF1_PANEL,"Height"));
after some few search (i'm not a C,C++ developper) i finally understood how to access and get/set info in stringList object
then i'm facing a new problem, how can i get a sub property from a property ??
t = getProperty(UDF1_PANEL,"Font")
how can i access font.size or evej Font.Style.fsBold ?
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25296 Location: The netherlands
|
Posted: Tue Dec 27, 2011 12:38 pm Post subject: |
|
|
I recommend using an image control instead of a panel since in a panel you'll have to do your code in the onpaint event else your drawing will be gone if anything renders over it (like another window)
(That also fixes 1)
Besides that, I can confirm these bugs in 6.1 (some are already fixed in the svn)
7:
There is currently no way to access the font property with lua code in 6.1
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
mgr.inz.Player I post too much Reputation: 218
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Tue Dec 27, 2011 1:41 pm Post subject: |
|
|
As you know, I'm using current rev.
form_setBorderStyle(MyForm, bsSizeable)
form_getBorderStyle(MyForm)
gives:
attempt to call global 'form_setBorderStyle' (a nil value)
because it's not registered (Lua_register)
I know I can fix this by adding few lines in initializeLuaForm procedure.
But I also tried this:
setProperty(MyForm, "BorderStyle", bsSizeable)
but MyForm still isn't "sizeable".
Btw. this works
setProperty(MyForm, "Caption","setproperty test")
_________________
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25296 Location: The netherlands
|
Posted: Tue Dec 27, 2011 1:43 pm Post subject: |
|
|
try this:
setProperty(MyForm, "BorderStyle", "bsSizeable")
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
mgr.inz.Player I post too much Reputation: 218
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Tue Dec 27, 2011 3:30 pm Post subject: |
|
|
thank you.
If anyone interested:
anchors - setProperty(MyPanel, 'Anchors','akTop,akLeft,akRight,akBottom')
(if you want top and left: 'akTop,akLeft')
Image:
Proportional - setProperty(MyImage, 'Proportional','true')
stretch - image_stretch(MyImage, true)
Code: | function FormClose(sender)
object_destroy(MyForm)
MyForm = nil
return caFree --Possible options: caHide, caFree, caMinimize, caNone
end
FormClose()
MyForm = createForm(false)
control_setSize(MyForm, 400,400)
control_setCaption(MyForm,'Canvas Test')
setProperty(MyForm, 'BorderStyle', 'bsSizeable')
form_onClose(MyForm, FormClose)
form_show(MyForm)
MyPanel = createPanel(MyForm)
control_setPosition(MyPanel, 10,10)
control_setSize(MyPanel, 380,380)
setProperty(MyPanel, 'Anchors','akTop,akLeft,akRight,akBottom')
MyImage = createImage(MyPanel)
control_setAlign(MyImage, alClient)
setProperty(MyImage, 'Anchors','akTop,akLeft,akRight,akBottom')
--setProperty(MyImage, 'Proportional','true')
image_stretch(MyImage, true)
canvas = image_getCanvas(MyImage)
brush = canvas_getBrush(canvas)
brush_setColor(brush, 0xff00ff) --pink BBGGRR
pen = canvas_getPen(canvas)
pen_setWidth(pen, 1)
canvas_line(canvas, 0,0,90,90)
pen_setColor(pen, 0x00ffff) --yellow BBGGRR
-- house
canvas_setPenPosition(canvas, 80, 100)
canvas_lineTo(canvas,120,140)
canvas_lineTo(canvas,120,190)
canvas_lineTo(canvas,40,190)
canvas_lineTo(canvas,40,140)
canvas_lineTo(canvas,80,100)
-- door
pen_setColor(pen, 0x00ff00) --green BBGGRR
canvas_setPenPosition(canvas, 100, 190)
canvas_lineTo(canvas,100,170)
canvas_lineTo(canvas,90,170)
canvas_lineTo(canvas,90,190)
-- ground
pen_setColor(pen, 0x888888) --gray BBGGRR
pen_setWidth(pen, 5)
canvas_setPenPosition(canvas, 0, 193)
canvas_lineTo(canvas,240,193)
--begin tree
pen_setWidth(pen, 12)
pen_setColor(pen, 0xeeeeee) --gray BBGGRR
canvas_setPenPosition(canvas, 170, 185)
canvas_lineTo(canvas,170,170)
pen_setWidth(pen, 1)
pen_setColor(pen, 0x00ff00) --green BBGGRR
for index=0,80,10 do
canvas_setPenPosition(canvas, 170, 170)
canvas_lineTo(canvas,170 - index + 40,120)
end
-- end tree
canvas_rect(canvas,20,50,50,80) --yes it's filled
canvas_textOut(canvas,20,110,'text')
collectgarbage ("collect") |
_________________
|
|
Back to top |
|
|
atom0s Moderator Reputation: 198
Joined: 25 Jan 2006 Posts: 8518 Location: 127.0.0.1
|
Posted: Tue Dec 27, 2011 5:51 pm Post subject: |
|
|
Just doing some testing too: (Using CE6.1 Alpha 3)
1. Confirmed broken.
2. Not sure if this is broken since the right implementation exists:
Code: | 2 ---------------------------------------------------------------------------
MINOR
canvas_lineTo(destinationx, destinationy)
|
The first param is the canvas, then the position coords afterward:
Code: | canvas_lineTo(canvasObj, posx, posy) |
3. brush_setColor seems fixed in Alpha3. Sets the background color of text and various other objects fill color. But it works fine for me and brush_getColor returns properly when brush_setColor is used.
4. Rect is filled based on two colors.
- Border = Pen = pen_setColor
- Fill = Brush = brush_setColor
Code: | brush = canvas_getBrush( canvas );
brush_setColor( brush, 0xff0000 ); -- blue fill
pen = canvas_getPen( canvas );
pen_setColor( pen, 0x00ff00 ); -- green border
canvas_rect( canvas, 1, 1, 25, 25 ); |
5. -- Trivial --
6. You have to do manual drawing for it. DB posted an example somewhere but I can't find it. I don't remember if it was in the beta section or not.
7. Properties of properties isn't support (currently) in Beta 3.
Quote: | undefined property functions. Not all properties of all classes have been explicitly exposed to lua, but if you know the name of a property of a specific class you can still access them (assuming they are declared as published in the pascal class declaration) |
Quote: | setProperty(class, propertyname, propertyvalue) : Sets the value of a published property of a class (Won't work for method properties)
getProperty(class, propertyname) : Gets the value of a published property of a class (Won't work for method properties) |
Note the wont work on method properties part too.
This 'should' work since Style is returned with getPropertyList:
Code: |
function onFormClose( sender )
object_destroy( form );
form = nil;
return caFree;
end
onFormClose();
form = createForm( true );
form_onClose( form, onFormClose );
local font = control_getFont( form );
local text = createLabel( form );
control_setCaption( 'This is some text.' );
local bold = getProperty( font, "Style" );
print( 'font: ' .. tostring( font ) .. ' :: bold: ' .. tostring( bold ) );
|
But getProperty fails to return a valid value.
_________________
- Retired. |
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25296 Location: The netherlands
|
Posted: Tue Dec 27, 2011 6:01 pm Post subject: |
|
|
getProperty for the "Font" property of an object returns an integer.
6.2 has an integerToUserData you can use to convert the integer to a valid Object
(This code ONLY works on the 6.2 alpha, so not really useful. Just showing that it will be possible)
Code: |
x=getProperty(UDF1_CELabel1,"Font")
x2=integerToUserData(x)
print(object_getClassName(x2))
|
prints TFont which can be controlled with the font_ functions
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
atom0s Moderator Reputation: 198
Joined: 25 Jan 2006 Posts: 8518 Location: 127.0.0.1
|
Posted: Tue Dec 27, 2011 6:14 pm Post subject: |
|
|
Dark Byte wrote: | getProperty for the "Font" property of an object returns an integer.
6.2 has an integerToUserData you can use to convert the integer to a valid Object
(This code ONLY works on the 6.2 alpha, so not really useful. Just showing that it will be possible)
Code: |
x=getProperty(UDF1_CELabel1,"Font")
x2=integerToUserData(x)
print(object_getClassName(x2))
|
prints TFont which can be controlled with the font_ functions |
You can't edit the extra exposed properties like you should be able to though with setProperty.
Code: |
function onFormClose( sender )
object_destroy( form );
form = nil;
return caFree;
end
onFormClose();
form = createForm( true );
form_onClose( form, onFormClose );
local font = control_getFont( form );
local text = createLabel( form );
control_setCaption( 'This is some text.' );
local bold = getProperty( font, "Style" );
print( 'font: ' .. tostring( font ) .. ' :: bold: ' .. tostring( bold ) );
local props = getPropertyList( font );
for x = 0, strings_getCount( props ) - 1 do
print( 'property: ' .. strings_getString( props, x ) );
end
|
Prints out:
font: userdata: 04951380 :: bold:
property: CharSet
property: Color
property: Height
property: Name
property: Orientation
property: Pitch
property: Quality
property: Size
property: Style
_________________
- Retired. |
|
Back to top |
|
|
mgr.inz.Player I post too much Reputation: 218
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Tue Dec 27, 2011 6:18 pm Post subject: |
|
|
Code: | x =integerToUserData(getProperty(label,"Font"))
font_setSize(x,18)
font_setColor(x,0x00ffff) -- yellow BBGGRR
setProperty(x, 'Style','fsBold,fsItalic,fsUnderline') |
FULL
Code: | function FormClose(sender)
object_destroy(MyForm)
MyForm = nil
return caFree --Possible options: caHide, caFree, caMinimize, caNone
end
FormClose()
MyForm = createForm(false)
control_setSize(MyForm, 400,400)
control_setCaption(MyForm,'Canvas Test')
setProperty(MyForm, 'BorderStyle', 'bsSizeable')
form_onClose(MyForm, FormClose)
form_show(MyForm)
MyPanel = createPanel(MyForm)
control_setPosition(MyPanel, 10,10)
control_setSize(MyPanel, 380,380)
setProperty(MyPanel, 'Anchors','akTop,akLeft,akRight,akBottom')
label = createLabel(MyPanel)
control_setPosition(label, 100,200)
control_setCaption(label,'My text')
control_setColor(label,0x0000ff) --RED
x =integerToUserData(getProperty(label,"Font"))
font_setSize(x,18)
font_setColor(x,0x00ffff) -- YELLOW
setProperty(x, 'Style','fsBold,fsItalic,fsUnderline')
|
So "can be controlled with the font_ functions" and setProperty
Description: |
|
Filesize: |
8.52 KB |
Viewed: |
22590 Time(s) |
|
_________________
Last edited by mgr.inz.Player on Tue Dec 27, 2011 6:28 pm; edited 1 time in total |
|
Back to top |
|
|
atom0s Moderator Reputation: 198
Joined: 25 Jan 2006 Posts: 8518 Location: 127.0.0.1
|
Posted: Tue Dec 27, 2011 6:28 pm Post subject: |
|
|
Ah it has bitshifted values, overlooked that. This works fine too rather then using getProperty for the font:
Code: |
function onFormClose( sender )
object_destroy( form );
form = nil;
return caFree;
end
onFormClose();
form = createForm( true );
form_onClose( form, onFormClose );
local font = control_getFont( form );
local text = createLabel( form );
control_setCaption( text, 'This is some text.' );
setProperty( font, "Style", "[fsBold, fsItalic, fsUnderline]" );
|
_________________
- Retired. |
|
Back to top |
|
|
hiring_dude Newbie cheater Reputation: 0
Joined: 28 Nov 2010 Posts: 20
|
Posted: Thu Dec 29, 2011 11:21 am Post subject: |
|
|
Hi,
thanks for the support !
actually i saw you are refering to SVN or newer version, seems i'm losing my time trying to dig bugs probably already fixed (i'm now facing bugs with the ToggleBox..)
if i want an up to date version must we compile it by ourself or something ?
or is it already a build/binary version somewhere ??
regards
|
|
Back to top |
|
|
atom0s Moderator Reputation: 198
Joined: 25 Jan 2006 Posts: 8518 Location: 127.0.0.1
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|