Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 8 of 8
  1. #1
    Join Date
    Oct 2003
    Location
    Jacksonville Alabama
    Posts
    10

    Dialog.Message error

    I have been using AMS4 for a little while now and love it but I am considering upgrading to take advantage of the wonderful new abilities of AMS5. So I just downloaded the trial version of AMS5 Pro.

    Ran into a snag right off the bat. I endered this code into the OnClick action for a graphic.

    result = Image.GetPos("Image1");--get top/left
    Dialog.Message("Notice", result);--tell me the top/left

    but I get On Click, Argument 2 must be of type string.

    I thought type conversion were automatic with AMS?
    I cant find in the documentation where it says that the GetPos returns a unique type or requires special conversions.

    What am I doing wrong?????

    Thanks in advance

  2. #2
    Join Date
    Jul 2002
    Location
    USA
    Posts
    3,959
    GetPos returns a table:

    if (result ~= nil) then
    Dialog.Message("Notice", "X = " .. result.X .." \r\n\Y = " .. result.Y);--tell me the top/left
    end
    Last edited by Worm; 03-19-2004 at 01:38 PM.

  3. #3
    Join Date
    Oct 2003
    Location
    Jacksonville Alabama
    Posts
    10

    new code same error

    Wow what a swift reply. Thanks

    Here is the code now:

    result = Image.GetPos("Image1");--get top/left
    if (result ~= nil)then
    Dialog.Message("Notice", result);--tell me the top/left
    else
    Dialog.Message("Notice", "nil");--tell me the top/left
    end

    Exact same error for line 3.

    Im confused k

  4. #4
    Join Date
    Jul 2002
    Location
    USA
    Posts
    3,959
    Yea, you caught me inbetween edits. I realized after I posted that, what was wrong. Look at the original (edited) reply.

    Sometimes speedy answers need editing, especially when they are read just as quickly

  5. #5
    Join Date
    Jul 2003
    Posts
    712

    Re: new code same error

    Hello Midlander,

    Image.GetPos returns a type table (not a string). In fact, the table contains two numbers, referenced by .X and .Y. So to output the position of the image, you will have to effectively reference two numbers.

    Do this:
    Code:
    Dialog.Message("X Position", result.X);
    Dialog.Message("Y.Position", result.Y);
    Keep in mind that Image.GetPos is really returning two values in the form of a table, and u'll be set!

    Desmond.

  6. #6
    Join Date
    Oct 2003
    Location
    Jacksonville Alabama
    Posts
    10

    OK next question

    Works perfectly!

    Now, why the .. before and after???
    I can sort of understand the result.X (guess getting the value for X) but why was the raw result not displayed??

    Thanks again

  7. #7
    Join Date
    Jul 2002
    Location
    USA
    Posts
    3,959
    The .. concatate (combines) strings in lua

    "My" .. " Name " .. "is" .. " Brad"

    would be the same as

    "My Name is Brad"

  8. #8
    Join Date
    Oct 2003
    Location
    Jacksonville Alabama
    Posts
    10

    Thanks

    So many new features so little time. Thanks all.

    Now I will go back to playing with AMS5.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts