+ Reply to Thread
Results 1 to 5 of 5

Thread: Help on why code wont work

  1. #1
    Wire Amateur ab0mbs's Avatar
    Join Date
    Feb 2010
    Posts
    41

    Question Help on why code wont work

    First off i'm new to expression 2 so if theres something wrong could you please explain it throughly.
    I'm wondering why this code works fine.
    Code:
    @name Rave Break
    @inputs Num Em1:entity Em2:entity Em3:entity Em4:entity P1:entity
    @outputs Go
    
    if (Num == 1){
        Em1:soundPlay(1,0,"custom/RAVEBREAK.mp3")
        Em2:soundPlay(2,0,"custom/RAVEBREAK.mp3")
        Em3:soundPlay(3,0,"custom/RAVEBREAK.mp3")
        Em4:soundPlay(4,0,"custom/RAVEBREAK.mp3")
        Go = 1
    }
    else{
        soundPurge()
        Go = 0
    }
    Yet this code starts to play the song but keeps stuttering like its trying to play the song but restarting from the beginning.
    Code:
    @name CD Player Play
    @inputs R Sp1:entity Sp2:entity
    @outputs Go
    
    
    if (R == 254){
        Go = 1
        Sp1:soundPlay(1,0,"custom/broll.mp3")  
    }
    else{
        Go = 0
        soundPurge()
    }
    Any help is appreciated.

    EDIT: So i restarted my game and replaced the chip and other things and got it to work but i now want to add other colors in but i'm not sure how i would add the other lines I don't think this is correct but if you could give suggestions

    Code:
    @name CD Player Play
    @inputs R G Sp1:entity Sp2:entity
    @outputs Go
    
    
    if (R == 254){
        Go = 1
        Sp1:soundPlay(1,0,"custom/broll.mp3")  
    }
    else{
        Go = 0
        soundPurge()
    }
    if (G == 254){
        Go = 1
        Sp1:soundPlay(1,0,"custom/ravebreak.mp3")  
    }
    else{
    soundPurge()
    }
    Last edited by ab0mbs; 08-10-2010 at 08:30 PM.

  2. #2
    Spucatum Tauri Bull's Avatar
    Join Date
    Jun 2008
    Location
    Finland
    Posts
    6,009

    Default Re: Help on why code wont work

    Instead of R and G use the Color vector.
    Code:
    Go = 1
    if (Color == vec(254,0,0) ) {
        Sp1:soundPlay(1,0,"custom/broll.mp3")  
    }
    elseif (Color == vec(0,254,0) ) {
        Sp1:soundPlay(1,0,"custom/ravebreak.mp3")  
    }
    else {
        Go = 0
        soundPurge()
    }
    Last edited by Bull; 08-10-2010 at 10:23 PM.
    My signature has a point.
    Quote Originally Posted by Squeakyneb View Post
    when l3ulletje says do it, do it.
    That

    Quote Originally Posted by Anticept View Post
    By the way, Bull is in charge.

  3. #3
    Wire Amateur ab0mbs's Avatar
    Join Date
    Feb 2010
    Posts
    41

    Default Re: Help on why code wont work

    Where would i find this color vector. I've been trying to use a ranger to detect color so.

  4. #4
    Spucatum Tauri Bull's Avatar
    Join Date
    Jun 2008
    Location
    Finland
    Posts
    6,009

    Default Re: Help on why code wont work

    Col RGB [vector]
    My signature has a point.
    Quote Originally Posted by Squeakyneb View Post
    when l3ulletje says do it, do it.
    That

    Quote Originally Posted by Anticept View Post
    By the way, Bull is in charge.

  5. #5
    Wire Amateur ab0mbs's Avatar
    Join Date
    Feb 2010
    Posts
    41

    Default Re: Help on why code wont work

    OK Thanks a lot!

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
proceed-collector
proceed-collector
proceed-collector
proceed-collector
linguistic-parrots
linguistic-parrots
linguistic-parrots
linguistic-parrots