Question:

Actionscropt 2.0, need some help with this script

by  |  earlier

0 LIKES UnLike

Alright guys, im working on making my first RPG using actionscript 2.0 heres my code

//on the first keyframe press f9 and type

score = 0;

hp=100;

currentslotnum = 1;

stop();

function addToSlot(item) {

if (!item.found) (

item._x = eval ("ItemSlot" currentslotnum

item._y = eval ("ItemSlot" currentslotnum

item.found=true;

currentslotnum ;

}

}

i get the errors

} not expected (at end)

and the item.x/y "ItemSlot" says expected }/) or ;...

whats the problem with my script? can anybody correct it

 Tags:

   Report

2 ANSWERS


  1. You're missing a couple of ending parenthesis and semi-colons.

    This should work, although I don't code in RPG, I'd suggest giving it a shot. :)

    //on the first keyframe press f9 and type

    score = 0;

    hp=100;

    currentslotnum = 1;

    stop();

    function addToSlot(item) {

    if (!item.found) (

    item._x = eval ("ItemSlot" currentslotnum);

    item._y = eval ("ItemSlot" currentslotnum);

    item.found=true;

    currentslotnum ;

    )

    }


  2. It's almost certainly a syntax error, and it's quite likely complaining about something that yahoo clipped.  Try posting the code on http://www.pastebin.com (which is free) and let us know it's there so we can see it working.

    You can also check my book

    Flash Game Programming for Dummies

    http://www.cs.iupui.edu/~aharris/flash

    Good luck to you

Question Stats

Latest activity: earlier.
This question has 2 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.