Script auto selects when i dont want it to

me again sry so this script
if (this.getField("race").value = "Human"){
if (this.getField("gender").value = "Male"){
  var h_male = new Array ();
h_male[0] = "bob";
h_male[1] = "mathew";
h_male[2] = "andrew";
h_male[3] = "stephen";
h_male[4] = "ben";
var hm = math.floor(5*Math.random())
this.getField("character name").value = h_male[hm];}
else (this.getField("race").value = "Human")
(this.getField("gender").value = "Female");{
  var h_female = new Array ();
h_female[0] = "michelle";
h_female[1] = "sarah";
h_female[2] = "skye";
h_female[3] = "kayla";
h_female[4] = "louise";
var hf = Math.floor(5*Math.random())
this.getField("character name").value = h_female[hf];}
now it sort of works the problem im having is that when i hit the random button it auto puts gender to male  and random selects from h_female not the h_male
i might be wrong but i think its the (this.getField("gender").value = "Male") is writing to the field gender insted of reading it? if so how do i go about fixing it
Message was edited by: darka2011

Are you getting any errors in the JavaScript console?
I have a message about a missing code block terminator ,"}".
Once that is fixed, the  next message is about the reference to 'math' is not defined.
Using the nested if:
// array for random names
var aNames = new Array();
// clear the field
event.value = '';
// test for race
if (this.getField("race").value == "Human"){
   // human chose
   // test for human gender
   if (this.getField("gender").value == "Male"){
      // human male gender
      // populate male names
      aNames = ["bob", "mathew", "andrew", "stephen", "ben"];
      event.value = aNames[Math.floor(aNames.length * Math.random())];
   }else if (this.getField("gender").value == "Female"){
      // human female gender
      // populate frmale names
      aNames = ["michelle", "sarah", "skye", "kayla", "louise", 'Zelda'];
      event.value = aNames[Math.floor(aNames.length * Math.random())];
   } else {
      // human not male or female
      event.value = "";
   // end human gender options
} } else {
   event.value = '';
}  // end race options
Using the switch statement:
// array for random names
var aNames = new Array();
if (this.getField("race").value != " " & this.getField("gender").value != " ") {
switch(1) {
case (this.getField("race").value == "Human" & this.getField("gender").value == "Male"):
   // human male gender
   // populate male names
      aNames = ["bob", "mathew", "andrew", "stephen", "ben"];
      event.value = aNames[Math.floor(aNames.length * Math.random())];
break;
case (this.getField("race").value == "Human" & this.getField("gender").value == "Female"):
   // human female gender
  // populate frmale names
      aNames = ["michelle", "sarah", "skye", "kayla", "louise", 'zelda'];
      event.value = aNames[Math.floor(aNames.length * Math.random())];
break;
default:
// for all non-matched items
app.alert('No match');
break;
} // end switch selections
} else {
event.value = '';
} // end if race and gender not empty

Similar Messages

  • My ipod shuffles even when i dont want it to how do i correct this

    my ipod shuffles even when i dont want it to,  how do i correct this problem

    You most likely just have Shake to shuffle turned on.
    Shake can be disabled in two ways to prevent accidental activation of the feature:
    Setting the hold switch on the top of the iPod nano to on.
    Turn off the Shake feature by choosing Settings > Playback on iPod nano (4th and 5th generation). For iPod nano (6th generation), from the Home screen, tap Settings > Music and then tap the On/Off switch next to "Shake to Shuffle".

  • Problem with chapters playing when i dont want them to

    OK let me explain what I have going here. I have 4 timelines for seperate videos in my project. Each has a motion button on the main menu that will play each one independantly and then return to the main menu and a "play it all" button the will play them in order. Ok all that works fine except for one thing. I want to video that shows in my thumbnails on the main menu to be a seperate video than what is actually in the feature DVD so after searching the forum I found a solution that is working. What I did was to take the video I wanted to use for the thumbnails and add that to the end of each timeline as a new chapter and then added a poster frame to control what showed in the thumbnail.
    So to review.....each timeline had two chapters one that I want to show in the feature DVD and one that I do not.
    By using the end actions oneach of the first videos in each timeline I can get the DVD to play from the beginning and skip the video I dont want seen. However, .....and here is the reason for my post FINALLY....when i use the chapter skip on the preview it of course skips to the video I dont want shown.....the last video on each timeline. So instead of having 4 chapters I now have 8....4 of each i would like to not be accessable at all.
    Any way to to what I am wanting to do which essentially is tell Encore to skipthose chapters on the chapter skip button on the player??
    thanks for any help in advance!!!!!!!!!!!

    Unfortunately not, if you are using that workaround. I can offer two suggestions:
    1. Create your entire motion menu background (including the thumbnail animations) in Premiere or After Effects, then use that as a background video on your menu that is set up with buttons containing
    only subpicture layers (no other layers, including thumbnail layers).
    2. Keep your current workaround and add user operations to the timeline so that Next/Previous chapter navigation is prohibited.

  • Alphabetical playlists when I dont want them, any ideas?

    Ive got a new ipod Nano, and despite having the tracks in my playlists in the order I want on itunes my Nano keeps making them alphabetical when I add them to it, which I dont want. Any ideas?
    Many thanks in advance if you can help.
    Philip

    Unfortunately not, if you are using that workaround. I can offer two suggestions:
    1. Create your entire motion menu background (including the thumbnail animations) in Premiere or After Effects, then use that as a background video on your menu that is set up with buttons containing
    only subpicture layers (no other layers, including thumbnail layers).
    2. Keep your current workaround and add user operations to the timeline so that Next/Previous chapter navigation is prohibited.

  • Can I select when do i want to write my data into a file?

    What I want is like,
    When I click a button as ON then only it goes an writes the data into a spreadsheet.
    Now i have made the bolllean so that it will show TRUE when you have to write...but if FALSE nothing should happen...
    and I cant see any option in Write to Spread Sheet function for it..
    So can you help me out with what should I do
    Solved!
    Go to Solution.

    You put the Write to Spreadsheet file in a case structure.
    I would recommend looking at the online LabVIEW tutorials
    LabVIEW Introduction Course - Three Hours
    LabVIEW Introduction Course - Six Hours

  • Itunes opens when i dont want it too

    Ok i plug in my ipod to charge it and itunes flies up and it starts updating...how do i prevent that from happening?
    DELL   Windows XP  

    this happens because your iPod is set to auto-update and it is automatically going to open iTunes when you plug in your iPod to update it. So simply go to Prefrences --> iPod --> and check manually update this iPod.

  • Everytime I sync my computer puts all of my apps onto my iPhone when i dont want it to.

    Antime I sync my iPhone on my computer it puts all the apps on my computer (which came from my iPod Touch (4th generation)) but I don't want them to.

    You might need to uncheck "Automatically sync new apps" on the Apps tab of your iTunes sync settings, then make sure you only check the apps you want to have on your phone.  See "Losing Some Apps, Gaining Others After Syncing" here: http://gigaom.com/apple/itunes-101-multiple-devices-one-itunes-account/.

  • Music Syncing When I Dont Want It

    I have the sync only selected playlist option on my iPhone and I've turned off the show music from itunes option but for some reason it still has random songs from albums I have purchased and it wont even be the whole album it'll be one or 2 or more songs and i downloaded the new update for ios7 and ive tried all sorts of ways to get rid of them but I cant seem to do it, any ideas?

    I had all sorts of problems with iTunes after updating to io7s (and 7.0.2).  I deleted and reinstalled iTunes (backing up my iPhone first), then restored my phone.  Restoring is a hasstle and takes time. However, everyting seems to work OK now.

  • LR4 resizes .dng when I dont want it to

    Exporting my .nef files to .dng after editing them see's them going from full size 4692x3108 to 1024x768. Why?? I can save as .tif ok no problem. Using win 7 and latest LR version 4. Any help appreciated.

    You could go an alternative route to export: do a "Convert to DNG" inside Library module, but leave "Delete originals after successful conversion" unchecked.
    This will create a 2nd file inside LR catalog, where you could check in metadata panel which pixel dimensions it has. If ok, grab this DNG. You can remove the missing DNG-file afterwards from your catalog-
    Same would be achieved if you re-import the exported DNG for checking. Then you could see if indeed maybe your export settings could have dome some unintended damage.
    Cornelia

  • Auto Select Clip with playhead

    Hopefully this will be an easy query to answer.
    I would like to have premiere auto select a clip on the timeline via the playhead position.
    Eg: if I'm using the up & down arrows to go to next and previouse edit, I want the clips to auto select when the playhead jumps to the next clip.
    I'm in the process of coming over from Avid but i really miss this behaviour in Premiere.
    Can Someone help me out?
    Kale.
    Mac
    Pr CS6

    Can't be done.  Selecting requires a click.

  • Move Tool: Toggle auto select shortcut changed

    The changed shortcuts to toggle the autoselection of layers with the move tool selected is highly frustrating to me. I used to have a great workflow with auto select turned on and used cmd to drag elements that were either off-canvas or too small / too transparent to grab them.
    I used to have good time moving layers with Command hold, now holding Cmd toggles Layer/Group selection
    How can I change it to previous behaviour?

    Before:
    You really only needed to uncheck Auto-select when you wanted to use the layser stack to make your selection on what to move. This could be useful, especially if you had lots overlapping layers but in most web-design workflows was rather an exception than the rule.
    Holding down CTRL while in another tool, such as the Brush or Selection Rectangle or Lasso temporarily enabled the Move-Tool in whatever mode you had last set it when in the tool. That is similar in behaviour displayed by the color picker tool, which has several different picker modes that can be set with the tool active and that are applied when the temporary picker is used (by pressing ALT while using most tools that deals with pixel manipulation like the Brush and Pencil Tool ).
    Now:
    In Move Tool, Auto-Select Checked
    Holding Down CTRL will switch selection mode from Layer to Group and vice versa.
    In Move Tool, Auto-Select Unchecked
    Holding Down CTRL will toggle Auto-Select On and Off
    Releasing CTRL will revert to non-Auto-Select-Mode where you can move stuff around regardless on where you click in the workspace. So basically this is like it was before, only inverted.
    And here comes the catch, these are all possible scenariosthat can occur with the Move-Tools settings:
    Outside Move-Tool, Auto-Select Checked, Layer-Selection Mode active
    CTRL will still activate the Move-Tool, but it will invoke the Group-Selection
    Outside Move-Tool, Auto-Select Checked, Group-Selection Mode active
    CTRL will activate the Move-Tool and will invoke the Layer-Selection. This feels as it was before.
    Outside Move-Tool, Auto-Select Unchecked, Layer-Selection Mode active
    will activate the Move-Tool and will invoke the Layer-Selection.
    Outside Move-Tool, Auto-Select Unchecked, Group-Selection Mode active
    will activate the Move-Tool and will invoke the Layer-Selection.
    And this interrelation of behaviours is, what causes the problem. You need different settings for the Move-Tool to get the same action out of the temporary Move-Tool that you would get from the ragular Move-Tool.
    I see what they were shooting for with this change. The new functionality is not unusable, but it has flaws that interrupt a workflow that many users rely on.
    A compromise might be reached, by assigning the Layer/Group Toggle to another Function-Key combination like CTRL+ALT.
    In the meantime, please do as you promised: roll back this change and re-introduce it, once the flaws have been ironed out. If I remember correctly, one of the often mentioned advantages of the Creative Cloud-model was the rapidity of updates. It is now up to you to make good on that claim. Please do.

  • Dont want popup when sending mail

    Hi Experts,
    Im working on scripts, in that i need to send mail to the customer.
    In selection screen i have print & mail radio btns, when print is selected, popup comes to select the output device, but when mail is selected, i dont want that popup.
    For that, i have already given DIALOG = ' ' in OPEN_FORM function module when mail is selected, but still im getting the popup to select the output device.
    Some one please suggest how to supress that popup window.
    Thanks in advance.

    Hi Mytri,
    There's nothing wrong with your step.
    Just make sure you set the
    DIALOG = space.
    and also make sure the rest importing parameter set as default, i.e
    APPLICATION = 'TX'
    DEVICE          = 'PRINTER'
    LANGUAGE    = sy-langu
    AND RAW_DATA_INTERFACE = '*'.
    Looking forward if you find any other problem with this solution.
    Rgds

  • How can I sync my iPad to a computer after syncing it to the iCloud? I have the option of setting it up new, or restoring to a sync from many months ago. I dont want to lose any apps but I would like to back up on computer. No auto sync like other devices

    How can I sync my iPad to a computer after syncing it to the iCloud? I have the option of setting it up new, or restoring to a sync from many months ago. I dont want to lose any apps but I would like to back up on computer. No auto sync like other devices.

    Plug it into your computer. Tell it to sync with "this computer" instead of iCloud. You shouldn't have to remove any apps. Otherwise, you can save the app data by using i-FunBox ( http://www.i-funbox.com/ ) just go to the "devices" tab and select 'user applications' and select all of your apps and tell iFunBox to "copy to pc" you're done! You have them all backed up.

  • HT4097 when i turned on my ipad it has the itunes logo on it.  It says it is in recovery mode and that i have to restore it. I dont want to lose my photos I  have stored on it. I tried the suggestions from above but nothing works. What can I do

    When I turned on my ipad the itunes logo is on it. I cant get to my home screen. I plugged it to my computer and went to the itunes and it states that the ipad is in recovery mode and that I have to do a restore. I have some important photos on it that I dont want to lose. Is there a way I can restore it without losing the photos. I tried the suggestions on this site but it dont work. My last resort is to restore it if I have to.  Also, when Im on the itunes site it does say that i can update on March 15th Can anyone help? Thanks

    Then you can select that backup to restore from if you want. If it is an old backup - then you will be restoring the iPad to the condition that it was on that date. You mentioned March 15 in your first post. If your only backup is from last year, then you will lose all of the photos that you have taken since then.
    When you post back, include details ...not just a one sentence statement. Its difficult to ascertain exactly what you are experiencing without specific details.

  • How do you turn off the auto select behavior when working with shape layers?

    How do you turn off the auto select behavior when working with shape layers?
    I am using either of the path selection tools to select only some of the paths on the layer. I have the proper layer targeted. I have the selection too auto select option turned off.
    If another layer has a path in that area, that layer becomes auto targeted and I get the wrong path. Turning off the layer is the only way to avoid this but then I have to  turn on the layer back on between making my selection and transforming to use the other layer as guide. Is there any way to stop this auto select? Locking the other layer does not stop the auto select, just prevents editing.

    As far as i know the move tool options don't have any effect on the path selection tools.
    You might try clicking on one of the path points or on the path itself with one of path selection tools and if you want to select multiple points
    you can shift click with the Direct Selection Tool or Alt click to select the entire path.
    more path shortcuts:
    http://help.adobe.com/en_US/photoshop/cs/using/WSDA7A5830-33A2-4fde-AD86-AD9873DF9FB7a.htm l
    http://help.adobe.com/en_US/photoshop/cs/using/WSfd1234e1c4b69f30ea53e41001031ab64-7391a.h tml

Maybe you are looking for

  • DVD from USA on a Mac in germany!

    Hi everybody! I have a MacBook Pro (os x lion), i bought it 4 moths ago. I've just realized, that my mac cannot read DVD from USA. So my question, is there way to change this so that my mac can read every formate? If yes how? Thank you all

  • Moved media to TC. Now itunes keeps changing default library location

    I realize this might be better suited in the iTunes discussion forum however... I recently purchased a time capsule and moved all my media to the new drive. I changed the default library location in preferences. Problem is, every time I quit and rela

  • How to I get rid of Spam?

    I get so much spam on my Verizon account I can't use it as my main account.  I get pages of spam every day. I have a g-mail account and a mac.com account that works great.  Wish verizon.net did.   I would think that Verizon would have a spam filter.

  • Choqok don't want to authenticate with identi.ca

    Hi! I've tried to find similar thread by no success. So maybe someone has faced with this problem and 'll help me with it When I try to authenticate Choqok with identi.ca using OAuth I get an authentication error. Twitter works nice. I have no idea..

  • Running multiple instances of a top level vi

    The following question is copied from a 1999 post which I am also interested in an answer to. It wasn't answered in '99, but maybe there are more people around today who could comment; "I am interested in running multiple copies of a top-level vi in