Please Help Me On This Script

OK im working on this age of war type game if you dont now what that is its a game where you press buttons to send your troops to battle the computer ive just started but ive hit a problam this is my script for spawning the troops by presing the button ill explain the proplam i have with it under the script.
on (release) {   
if (spear>=0) {       
spear = true;
     } else {       
spear = false;   
if (spear == true) {
  this.attachMovie("spearman_mc","spearman_mc",this.getNextHighestDepth, {_x:1.1,_y:485});
_root.spearman_mc.duplicateMovieClip("spearman_mc_"+"x", x);
     setProperty("spearman_mc_"+"x", _x, 1.1);       
     setProperty("spearman_mc_"+"x", _y, 485);       
x++;       
cash-=35;   
} else {       
cash-=0;   
spearman_mc is my movieclip what gets created. spear i just put it in the code so i could use it in the if statement i might need to make it a Boolean at the start. NOW i will get to my problam when i press the button it creates the movie clip and i can keep creating them but when i get to 0 Cash (i start with 300) it still keeps creating and goes in to the minuses(-)

ive worked it out like i say its like a age of war type game
what should happen is tht when you click the button called spearman_btn the movie clip spearman should get attachet to a named Xaxis and a named Yaxis for example: setProperty("spearman_mc_"+"x",  _x, 95.1); and then duplicated but ive worked out now i will post another problam tonight.
this is my script now
on (release) {   
if (cash>=9) {       
this.attachMovie("spearman_mc","spearman_mc",this.getNextHighestDepth, {_x:95.1,_y:485});
_root.spearman_mc.duplicateMovieClip("man_mc_"+"x", x);
         setProperty("spearman_mc_"+"x", _x, 95.1);       
         setProperty("spearman_mc_"+"x", _y, 485);       
x++;       
cash-=10;   
} else {       
cash-=0;   
the spearman_movie clip costs 10 cash    if this dosent make sense tell me.

Similar Messages

  • Please Help me simplify this Script

    Hi
    I did a magnyfying menu based on this Tutorial:
    http://www.flashkit.com/tutorials/Interactivity/Navigation/Mac_OS_X-Aaron_Ha-722/index.php
    The problem : is that I have 20 Menu Items. Each time I want
    to modify something, there are too much things to modify.
    The answer I'm lloking for: I guess there is a much more
    intelligent and short way of doing this using just a few script
    lines and a few xml or txt files:
    1-Creates Movie Clip with button inside
    2-Get the list of items to create in this txt file (lets say
    "list_of_movies_containing_a_button.txt")
    3-Put the butons separated by 40px on Y and X=0
    4-Name each button instance with this other txt file
    5-Put inside each bouton the text on this third file.
    text_appearing_in_each_button.txt
    6-For all buttons, use this colour on Over and this other
    color on mouse up style.css (?)
    7-Each button links to the url defined in Links.txt file.
    8-All buttons behave in such manner....
    Do you understand what I mean?
    Can you please help me? Thanks a lot
    Here's the 17th century script I'm using now (with only 10
    items in this example)
    onClipEvent (load) {
    function checkOffset (coffset) {
    if (coffset<-120) {
    coffset = -120;
    } else if (coffset>120) {
    coffset = 120;
    return coffset;
    function setScale (soffset) {
    return 100*(2-(1*(Math.abs(soffset)/120)));
    onClipEvent (mouseMove) {
    // Get cursor x and y coordinates
    y = getProperty("_root.drag", _y);
    x = getProperty("_root.drag", _x);
    // Find cursor offset for each icon based on icon's starting
    location
    HomeOffset = y-200;
    NewsEventsOffset = y-240;
    ScheduleOffset = y-280;
    ManualOffset = y-320;
    DirectionsOffset = y-360;
    LessonOffset = y-400;
    ContactUsOffset = y-440;
    MP3CollectionOffset = y-460;
    BookmarkOffset = y-500;
    LinksOffset = y-540;
    // If cursor is inside menu
    if (x>=0 and x<=100 and y>=100 and y<=700) {
    // Make sure the offsets are within acceptable limits
    HomeOffset = checkOffset(HomeOffset);
    NewsEventsOffset = checkOffset(NewsEventsOffset);
    ScheduleOffset = checkOffset(ScheduleOffset);
    ManualOffset = checkOffset(ManualOffset);
    DirectionsOffset = checkOffset(DirectionsOffset);
    LessonOffset = checkOffset(LessonOffset);
    ContactUsOffset = checkOffset(ContactUsOffset);
    MP3CollectionOffset = checkOffset(MP3CollectionOffset);
    BookmarkOffset = checkOffset(BookmarkOffset);
    LinksOffset = checkOffset(LinksOffset);
    // Move the Home Icon
    // setProperty ("_root.Home", _y, 200-HomeOffset);
    setProperty ("_root.Home", _xscale, setScale(HomeOffset));
    setProperty ("_root.Home", _yscale, setScale(HomeOffset));
    // Move the News and Events Icon
    // setProperty ("_root.NewsEvents", _y,
    230-NewsEventsOffset);
    setProperty ("_root.NewsEvents", _xscale,
    setScale(NewsEventsOffset));
    setProperty ("_root.NewsEvents", _yscale,
    setScale(NewsEventsOffset));
    // Move the Schedule Icon
    //setProperty ("_root.Schedule", _y, 260-ScheduleOffset);
    setProperty ("_root.Schedule", _xscale,
    setScale(ScheduleOffset));
    setProperty ("_root.Schedule", _yscale,
    setScale(ScheduleOffset));
    // Move the Manual Icon
    // setProperty ("_root.Manual", _y, 290-ManualOffset);
    setProperty ("_root.Manual", _xscale,
    setScale(ManualOffset));
    setProperty ("_root.Manual", _yscale,
    setScale(ManualOffset));
    // Move the Directions Icon
    //setProperty ("_root.Directions", _y,
    320-DirectionsOffset);
    setProperty ("_root.Directions", _xscale,
    setScale(DirectionsOffset));
    setProperty ("_root.Directions", _yscale,
    setScale(DirectionsOffset));
    // Move the Lesson Icon
    //setProperty ("_root.Lesson", _y, 350-LessonOffset);
    setProperty ("_root.Lesson", _xscale,
    setScale(LessonOffset));
    setProperty ("_root.Lesson", _yscale,
    setScale(LessonOffset));
    // Move the Contact Us Icon
    // setProperty ("_root.ContactUs", _y, 380-ContactUsOffset);
    setProperty ("_root.ContactUs", _xscale,
    setScale(ContactUsOffset));
    setProperty ("_root.ContactUs", _yscale,
    setScale(ContactUsOffset));
    // Move the MP3 Collection Icon
    // setProperty ("_root.MP3Collection", _y,
    410-MP3CollectionOffset);
    setProperty ("_root.MP3Collection", _xscale,
    setScale(MP3CollectionOffset));
    setProperty ("_root.MP3Collection", _yscale,
    setScale(MP3CollectionOffset));
    // Move the Bookmark Icon
    //setProperty ("_root.Bookmark", _y, 440-BookmarkOffset);
    setProperty ("_root.Bookmark", _xscale,
    setScale(BookmarkOffset));
    setProperty ("_root.Bookmark", _yscale,
    setScale(BookmarkOffset));
    // Move the Links Icon
    //setProperty ("_root.Links", _y, 470-LinksOffset);
    setProperty ("_root.Links", _xscale, setScale(LinksOffset));
    setProperty ("_root.Links", _yscale, setScale(LinksOffset));
    } else {
    //setProperty ("_root.Home", _y, 200);
    setProperty ("_root.Home", _xscale, 100);
    setProperty ("_root.Home", _yscale, 100);
    // setProperty ("_root.NewsEvents", _y, 240);
    setProperty ("_root.NewsEvents", _xscale, 100);
    setProperty ("_root.NewsEvents", _yscale, 100);
    // setProperty ("_root.Schedule", _y, 280);
    setProperty ("_root.Schedule", _xscale, 100);
    setProperty ("_root.Schedule", _yscale, 100);
    //setProperty ("_root.Manual", _y, 290);
    setProperty ("_root.Manual", _xscale, 100);
    setProperty ("_root.Manual", _yscale, 100);
    // setProperty ("_root.Directions", _y, 320);
    setProperty ("_root.Directions", _xscale, 100);
    setProperty ("_root.Directions", _yscale, 100);
    //setProperty ("_root.Lesson", _y, 350);
    setProperty ("_root.Lesson", _xscale, 100);
    setProperty ("_root.Lesson", _yscale, 100);
    // setProperty ("_root.ContactUs", _y, 380);
    setProperty ("_root.ContactUs", _xscale, 100);
    setProperty ("_root.ContactUs", _yscale, 100);
    // setProperty ("_root.MP3Collection", _y, 410);
    setProperty ("_root.MP3Collection", _xscale, 100);
    setProperty ("_root.MP3Collection", _yscale, 100);
    //setProperty ("_root.Bookmark", _y, 440);
    setProperty ("_root.Bookmark", _xscale, 100);
    setProperty ("_root.Bookmark", _yscale, 100);
    //setProperty ("_root.Links", _y, 470);
    setProperty ("_root.Links", _xscale, 100);
    setProperty ("_root.Links", _yscale, 100);

    Thanks a lot! It works fine.

  • Please help me with this calculation script

    Hello everyone.
    I have 2 fields named A and B. FieldA is user-enter value and FieldB is calculated. I want to write a script that do the following:
    If FieldA is more than or equal to $10000, then FieldB always is $1000, Else FieldB = FieldA * 10%.
    I don't know about scripting; however, after hour of search through google, I wrote this one:
    var tvar
    If (tvar >= 10000)then deposit.value = 1000
    else deposit.value = total.rawValue*0.01
    endif
    And when I try to run, it say "Invalid Property Set Operation, value doesn't have a default property."
    I know my script is bad and over the place. Can anyone please help me with this problem ASAP. Thank you so much, I'm in your debt.
    I used Adobe LiveCycle Designer to create a PDF file.

    Thank you for your response.
    tvar = total
    At first I wrote it like this:
    If (total.rawValue >= 10000)then deposit.rawvalue = 1000
    else deposit.rawvalue = total.rawValue*0.01
    endif
    then I get an error message "accessor 'Total.rawValue' is unknown"
    Hic, I think my script is screwed. Can you help me start fresh :)
    Thank again.

  • Please help me with this "2012 R2" PS Script

    Please be kind to help me with this Script. Thank you.....
    Import-Csv C:\Scripts\NewADUsers.csv | foreach-object { $userprinicpalname = $_.SamAccountName + "@{loona}.com"; New-ADUser -SamAccountName $_.SamAccountName -UserPrincipalName $userprinicpalname -Name $_.name -DisplayName $_.name -GivenName
    $_.cn -SurName $_.sn -Description $_.Description -Department $_.Department -Path $_.path -AccountPassword (ConvertTo-SecureString "Loona123" -AsPlainText -force) -Enable $True -PasswordNeverExpires $Ture -PassThru }
    New-ADUser : Directory object not found
    At line:1 char:114
    + Import-Csv C:\Scripts\NewADUsers.csv | foreach-object { $userprinicpalname = $_. ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : ObjectNotFound: (CN=Student01,OU...DC=loona,DC=com:String) [New-ADUser], ADIdentityNotFoundException
        + FullyQualifiedErrorId : ActiveDirectoryCmdlet:Microsoft.ActiveDirectory.Management.ADIdentityNotFoundException,Microsoft.Activ 
       eDirectory.Management.Commands.NewADUser

    Please check it the caractors - + =. i have no idea about PowerShell
    ImportCsv C:\Scripts\NewADUsers.csv |
    ForEach-Object{
    $props=@{
    SamAccountName=$_.SamAccountName
    UserPrincipalName=$_.SamAccountName + '@loona.com'
    Name=$_.name
    DisplayName=$_.name
    GivenName=$_.cn
    SurName=$_.sn
    Description=$_.Description
    Department=$_.Department
    Path=$_.path
    AccountPassword=(ConvertTo-SecureString "Loona123" -AsPlainText -force)
    Enabled=$True
    PasswordNeverExpires=$true
    NewObject @orops -PassThru

  • I am not able to launch FF everytime i tr to open it, it says FF has to submit a crash report, i even tried doing that and the report was submitted too, but stiil FF did not start, and the problem still persists, please help me solve this issue in English

    Question
    I am not able to launch FF everytime i try to open it, it says FF has to submit a crash report,and restore yr tabs. I even tried doing that and the report was submitted too, but still FF did not start, and the problem still persists, please help me solve this issue
    '''(in English)'''

    Hi Danny,
    Per my understanding that you can't get the expect result by using the expression "=Count(Fields!TICKET_STATUS.Value=4) " to count the the TICKET_STATUS which value is 4, the result will returns the count of all the TICKET_STATUS values(206)
    but not 180, right?
    I have tested on my local environment and can reproduce the issue, the issue caused by you are using the count() function in the incorrect way, please modify the expression as below and have a test:
    =COUNT(IIF(Fields!TICKET_STATUS.Value=4 ,1,Nothing))
    or
    =SUM(IIF(Fields!TICKET_STATUS=4,1,0))
    If you still have any problem, please feel free to ask.
    Regards,
    Vicky Liu
    Vicky Liu
    TechNet Community Support

  • Hello, i restored and updated my iphone 4 to the latest version of 5.1.1 and after that when i connect my mobile to i tunes all i see is a big rectangle and a apple logo on left and a small lock on right side please help me fix this problem.

    hello,
    i restored and updated my iphone 4 to the latest version of 5.1.1 and after that when i connect my mobile to i tunes all i see is a big rectangle and a apple logo on left and a small lock on right side please help me fix this problem.

    I sloved this issue by resting my phone from settings>general>reset>reset all settings...the problem will be fixed

  • I bought a movie the movie Godzilla 2014 recently but it didn't show up in my library. I went check the itunes store and it wants me to buy it again. Please help me with this problem.

    I just bought this movie "Godzilla 2014" but it won't show in my Movie Library. I closed my Itunes and put it back on again but still won't show up. I checked my purchased list and it shows that I recently bought the movie but when I checked the itunes store it wants to buy the movie again. Please help me with this right away Apple.

    Apple Store Customer Service at 1-800-676-2775 or visit online Help for more information.
    To contact product and tech support: Contacting Apple for support and service - this includes
    international calling numbers..
    For Mac App Store: Apple - Support - Mac App Store.
    For iTunes: Apple - Support - iTunes.

  • My icloud activation lock is ON my iphone, which requires an activation login to access the homescreen, but when i log in with the apple ID on the phone, it says the apple ID is not meant to unclock this iphone 5 ios 8.0.2. please help me solve this.

    My icloud activation lock is on my iphone, which requires an activation login to access the homescreen, but when i log in with the apple ID on the phone, it says the apple ID is not meant to unclock this iphone 5 ios 8.0.2. please help me solve this.

    Yes the phone belongs to me. It was purchased from United Kingdom Vodafone to West Africa, i had to factory unlock to use any sim in it. so it belongs to me. I did the activation myself, now after updating my iphone to the latest update, it required a user id and password to activate the phone, but anytime i enter the details, it tells me the user Id is not correct but the password is correct..

  • I have upgraded My leopard to Mountain lion 10.7 via snow leapeard. Now My itunes is not working properly nor I able to install google chrome successfully. Please help me in this occasion. I am facing following messages.

    Hello Team,
    I have upgraded My leopard to Mountain lion 10.7 via snow leapeard. Now My itunes is not working properly nor I able to install google chrome successfully. Please help me in this occasion.
    Also, I am not being able to upgrade Mac OS X 10.7 to 10.7.4 or letest for lion.
    I am facing following messages when I open itunes ( I down loaded and install new for 10.7)
    Process:         iTunes [463]
    Path:            /Applications/iTunes.app/Contents/MacOS/iTunes
    Identifier:      com.apple.iTunes
    Version:         10.7 (10.7)
    Build Info:      iTunes-10702101~1
    Code Type:       X86-64 (Native)
    Parent Process:  launchd [273]
    Date/Time:       2012-10-22 23:33:07.226 +0200
    OS Version:      Mac OS X 10.7 (11A390)
    Report Version:  8
    Interval Since Last Report:          4918 sec
    Crashes Since Last Report:           2
    Per-App Crashes Since Last Report:   2
    Anonymous UUID:                      3DE933E2-7A48-4840-91F4-7DC466ED9C26
    Crashed Thread:  0
    Exception Type:  EXC_BREAKPOINT (SIGTRAP)
    Exception Codes: 0x0000000000000002, 0x0000000000000000
    Application Specific Information:
    dyld: launch, loading dependent libraries
    @executable_path/../Frameworks/iPodUpdater.framework/Versions/A/iPodUpdater
    Dyld Error Message:
      Library not loaded: @executable_path/../Frameworks/iPodUpdater.framework/Versions/A/iPodUpdater
      Referenced from: /Applications/iTunes.app/Contents/MacOS/iTunes
      Reason: unsafe use of @executable_path in /Applications/iTunes.app/Contents/MacOS/iTunes with restricted binary
    Binary Images:
           0x102a96000 -        0x103c36fff  com.apple.iTunes (10.7 - 10.7) <0CC47E12-134F-A9E1-7E4F-3EAC797C3050> /Applications/iTunes.app/Contents/MacOS/iTunes
        0x7fff62696000 -     0x7fff626cb1ff  dyld (195 - ???) <71093406-21CF-3DBE-A001-802259ED5300> /usr/lib/dyld
    Model: MacBook4,1, BootROM MB41.00C1.B00, 2 processors, Intel Core 2 Duo, 2.4 GHz, 2 GB, SMC 1.31f1
    Graphics: Intel GMA X3100, GMA X3100, Built-In, 144 MB
    Memory Module: BANK 0/DIMM0, 1 GB, DDR2 SDRAM, 667 MHz, 0xAD00000000000000, 0x48594D503131325336344350362D59352020
    Memory Module: BANK 1/DIMM1, 1 GB, DDR2 SDRAM, 667 MHz, 0xAD00000000000000, 0x48594D503131325336344350362D59352020
    AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0x88), Broadcom BCM43xx 1.0 (5.10.131.36.5)
    Bluetooth: Version 2.5.0b13, 2 service, 12 devices, 2 incoming serial ports
    Network Service: AirPort, AirPort, en1
    Serial ATA Device: FUJITSU MHY2160BH, 160.04 GB
    Parallel ATA Device: MATSHITADVD-R   UJ-867
    USB Device: Built-in iSight, apple_vendor_id, 0x8501, 0xfd400000 / 2
    USB Device: USB Receiver, 0x046d  (Logitech Inc.), 0xc52f, 0x1d100000 / 2
    USB Device: Bluetooth USB Host Controller, apple_vendor_id, 0x8205, 0x1a100000 / 2
    USB Device: Apple Internal Keyboard / Trackpad, apple_vendor_id, 0x022a, 0x5d200000 / 3
    USB Device: IR Receiver, apple_vendor_id, 0x8242, 0x5d100000 / 2
    And Google chrome just keep loading the page for hours and nothing is appear on its browser. But safari and firefox working absolutly fine.
    In addition, I have reboot computer as well but it never worked. Please help me in this occasion.
    Eagerly waiting for your response on this issue.
    Best Regards,

    You need to upgrade your copy of MS Office. You're using a version that is 8 years old (at least). You can buy Office 2011, which will work. You could also get a copy of Pages from the App Store, which is cheaper and will open Word files (though not perfectly). Or you could get a free Office clone, like OpenOffice or LibreOffice.

  • HT5278 My words with friends kept disappearing on screen 3 seconds after opening. So I deleted & reinstalled it today 8/17/12 & it still happens. I'm so frustrated I dont know what to do next. Please help me w/this

    My iPad 1 doesn't stay logged on. It stays @ 3 seconds.this has been happening for a week s I deleted that app, &amp; downloaded another, same one &amp; STILL won't stay opened on page. Please help me figure this out. Very much appreciated. Thank you, Connie Sypriano

    There's a whole lot to read in your post, and frankly I have not read it all.
    Having said that, this troubleshooting guide should help:
    http://support.apple.com/kb/TS1538
    In particular, pay attention to the mobile device support sections near the bottom, assuming you have already done the items above it.

  • My safari keeps closing unexpectedly and when it does it tells me that it quite while using the .GameHouseBeachParty.so plugin. I have no idea what this means! Can someone please help me fix this?

    My safari keeps closing unexpectedly and when it does it tells me that it quite while using the .GameHouseBeachParty.so plugin. I have no idea what this means! Can someone please help me fix this?

    You have the Flashback trojan.
    Check out the replies in this thread for what to do;
    https://discussions.apple.com/message/18114958#18114958

  • I have a problem with my iphone 4. My 3G always stays activated but I lose my network signal. The bars all get lost and I'm not able to receive / send sms, mms or phone calls. Could you guys please help me fix this problem? Ios 5.1.1

    I have a problem with my iphone 4. My 3G always stays activated but I lose my network signal. The bars all get lost and I'm not able to receive / send sms, mms or phone calls. Could you guys please help me fix this problem? Ios 5.1.1

    I haven't gotten a new sim card because the problem has been presenting itself in various cards not only mine. So far, all I've done is reset my network settings.
    Last night, I turned off the 3G tab and it had all the signal bars. Today, I did the network reset and it's working apparently. But like I said before, previously the bars just disappear and the iphone only has the 3G activated.

  • Hi! I want to transfer my old mails from mac book pro to iPad 2, Please help me on this.

    Hi! I want to transfer my old mails from mac book pro to iPad 2, Please help me on this.

    Did you select the Pages app to sync to the iPad? Do you know how to do that or do you auto sync and rely on that only?

  • Help!! I just updated my iPad 2 into IOS 5.1.1.. When it finished updating, I can't open all of my games. Please help me fix this. :( thank you.

    Help!! I just updated my iPad 2 into IOS 5.1.1.. When it finished updating, I can't open all of my games. Please help me fix this. :( thank you.

    You are most welcome

  • Hello Technical Experts... please help me on this error :- 'Tax data is missing ArrayOffset 12, srcLineNum 0, srcGroupNum -1'.

    In my A/P credit memo screen i have incorporated a column for adding reference to closed A/P Invoices. upon filling this field with DocNum of APInvoice certain other fields also get filled from an SQL query. One among them is the TaxCode. My problem is that the TaxAmount(LC) field at the last row of the matrix is not filled with the appropriate value, it remains 0. On trying to add the document or pressing the link button on the TaxAmount field a status bar error message pops up showing, 'Tax data is missing ArrayOffset 12, srcLineNum 0, srcGroupNum -1'.
    Please Help me solve this issue.
    Thanks in Advance
    Rajeev

    Hi,
    Please check SAP note:
    1860926 - When updating a Purchase Order via DI API "-12109 Tax data
    is missing..." Error occurs
    Thanks & Regards,
    Nagarajan

Maybe you are looking for