Welcome Back! Please login below. If you are not yet a member, why not register? Enjoy!
We have now opened a new Build server! IP: 188.165.193.102:27016

    HoloHangman [E2]

    Share
    avatar
    Blizzard
    Wire Pro
    Wire Pro

    Number of posts : 334
    Age : 26
    Location : Switzerland
    In-Game Name : [BS] Blizzard

    Credits Credits :
    1 / 1001 / 100

    Warnings! Warnings! :
    0 / 100 / 10

    Registration date : 2008-11-23
    Points : 342
    Reputation : 14
    20090927

    HoloHangman [E2]

    Post by Blizzard



    Hey guys,

    Bam just set me up my own room! Yay, thanks!
    To celebrate, I tweaked my HoloHangman a bit, and removed almost all bugs it had.
    For those who don't know it. It's a Hangman I made in E2. It's completely chat controlled. You / Someone on the Server can play it. The first time you'll spawn it, it'll make you say a message telling to write -start to start a game. The person who writes -start first, is the only person who will be able to play then. It resets itself, so you can play it that many times you want to.

    Known Bugs:
    When you've already used a letter, you don't get any message at all.
    When you use more than one character, it won't get counted, but you will also get no message.
    To-Do:
    Implement an instant-solve function.

    The use of it is really easy. Just spawn it, and you're ready to go! You / someone on the server just gotta follow the instructions to play it.
    The wordlist contains 123 Words. Each time a game gets started, a random word will be picked out of the wordlist. It's easy to add new words. Just copy one of the lines of the directory, paste it on a new line and enter the new word you want to.
    The script is even programmed, so it automaticly got a delay of 1.5 seconds before each writing, because of some spam protections on some servers (like the one on Bam's)
    The script is not really clean and really well readable, but it was fairly hard to make, and I didn't plan to release it on the first time. But I hope you can learn from it and enjoy playing!
    If someone's playing it, and he wants a hint, you could put a debugger on it. It then should tell you the solution.

    Code:
    @name HoloHangman by Blizzard
    @outputs String:string
    @persist Person:entity PersonName:string Running Words:table Index Init StringIndex Hang Guess:string Phase Letter:string Letters:string StringL I Won Ind Indexer
    @trigger all
    #by Blizzard
    #Wordlist
    if(first()) {
    Index = 1
    Words:setString(toString(Index),"accident"), Index++
    Words:setString(toString(Index),"afternoon"), Index++
    Words:setString(toString(Index),"airplane"), Index++
    Words:setString(toString(Index),"alphabet"), Index++
    Words:setString(toString(Index),"anything"), Index++
    Words:setString(toString(Index),"aquarium"), Index++
    Words:setString(toString(Index),"architect"), Index++
    Words:setString(toString(Index),"arithmetic"), Index++
    Words:setString(toString(Index),"baseball"), Index++
    Words:setString(toString(Index),"basement"), Index++
    Words:setString(toString(Index),"basketball"), Index++
    Words:setString(toString(Index),"beautiful"), Index++
    Words:setString(toString(Index),"bedroom"), Index++
    Words:setString(toString(Index),"birthday"), Index++
    Words:setString(toString(Index),"biscuit"), Index++
    Words:setString(toString(Index),"blackberry"), Index++
    Words:setString(toString(Index),"blackboard"), Index++
    Words:setString(toString(Index),"blueberry"), Index++
    Words:setString(toString(Index),"bookcase"), Index++
    Words:setString(toString(Index),"bracelet"), Index++
    Words:setString(toString(Index),"breakfast"), Index++
    Words:setString(toString(Index),"broccoli"), Index++
    Words:setString(toString(Index),"brother"), Index++
    Words:setString(toString(Index),"building"), Index++
    Words:setString(toString(Index),"butterfly"), Index++
    Words:setString(toString(Index),"calendar"), Index++
    Words:setString(toString(Index),"calender"), Index++
    Words:setString(toString(Index),"cardinal"), Index++
    Words:setString(toString(Index),"caterpillar"), Index++
    Words:setString(toString(Index),"celebrate"), Index++
    Words:setString(toString(Index),"chicken"), Index++
    Words:setString(toString(Index),"children"), Index++
    Words:setString(toString(Index),"chocolate"), Index++
    Words:setString(toString(Index),"christmas"), Index++
    Words:setString(toString(Index),"coleslaw"), Index++
    Words:setString(toString(Index),"colorful"), Index++
    Words:setString(toString(Index),"connected"), Index++
    Words:setString(toString(Index),"container"), Index++
    Words:setString(toString(Index),"correcting"), Index++
    Words:setString(toString(Index),"croaking"), Index++
    Words:setString(toString(Index),"crutches"), Index++
    Words:setString(toString(Index),"daughter"), Index++
    Words:setString(toString(Index),"december"), Index++
    Words:setString(toString(Index),"decorated"), Index++
    Words:setString(toString(Index),"dictionary"), Index++
    Words:setString(toString(Index),"different"), Index++
    Words:setString(toString(Index),"difficult"), Index++
    Words:setString(toString(Index),"direction"), Index++
    Words:setString(toString(Index),"disagree"), Index++
    Words:setString(toString(Index),"disease"), Index++
    Words:setString(toString(Index),"dismissed"), Index++
    Words:setString(toString(Index),"electric"), Index++
    Words:setString(toString(Index),"elephant"), Index++
    Words:setString(toString(Index),"elevator"), Index++
    Words:setString(toString(Index),"eleventh"), Index++
    Words:setString(toString(Index),"envelope"), Index++
    Words:setString(toString(Index),"evergreen"), Index++
    Words:setString(toString(Index),"everybody"), Index++
    Words:setString(toString(Index),"everything"), Index++
    Words:setString(toString(Index),"fastened"), Index++
    Words:setString(toString(Index),"favorite"), Index++
    Words:setString(toString(Index),"february"), Index++
    Words:setString(toString(Index),"football"), Index++
    Words:setString(toString(Index),"furniture"), Index++
    Words:setString(toString(Index),"giraffe"), Index++
    Words:setString(toString(Index),"grandfather"), Index++
    Words:setString(toString(Index),"grandmother"), Index++
    Words:setString(toString(Index),"grandparents"), Index++
    Words:setString(toString(Index),"grocery"), Index++
    Words:setString(toString(Index),"halloween"), Index++
    Words:setString(toString(Index),"happened"), Index++
    Words:setString(toString(Index),"identical"), Index++
    Words:setString(toString(Index),"includes"), Index++
    Words:setString(toString(Index),"instrument"), Index++
    Words:setString(toString(Index),"lantern"), Index++
    Words:setString(toString(Index),"lightening"), Index++
    Words:setString(toString(Index),"measuring"), Index++
    Words:setString(toString(Index),"medicine"), Index++
    Words:setString(toString(Index),"mistake"), Index++
    Words:setString(toString(Index),"multiply"), Index++
    Words:setString(toString(Index),"necklace"), Index++
    Words:setString(toString(Index),"neighborhood"), Index++
    Words:setString(toString(Index),"neighbor"), Index++
    Words:setString(toString(Index),"newspaper"), Index++
    Words:setString(toString(Index),"november"), Index++
    Words:setString(toString(Index),"picture"), Index++
    Words:setString(toString(Index),"potato"), Index++
    Words:setString(toString(Index),"pressing"), Index++
    Words:setString(toString(Index),"pumpkin"), Index++
    Words:setString(toString(Index),"question"), Index++
    Words:setString(toString(Index),"resurrection"), Index++
    Words:setString(toString(Index),"sandwich"), Index++
    Words:setString(toString(Index),"saturday"), Index++
    Words:setString(toString(Index),"scissors"), Index++
    Words:setString(toString(Index),"scrambled"), Index++
    Words:setString(toString(Index),"screwdriver"), Index++
    Words:setString(toString(Index),"sentence"), Index++
    Words:setString(toString(Index),"september"), Index++
    Words:setString(toString(Index),"shepherd"), Index++
    Words:setString(toString(Index),"shoelaces"), Index++
    Words:setString(toString(Index),"shoulder"), Index++
    Words:setString(toString(Index),"somebody"), Index++
    Words:setString(toString(Index),"something"), Index++
    Words:setString(toString(Index),"sometimes"), Index++
    Words:setString(toString(Index),"standing"), Index++
    Words:setString(toString(Index),"straight"), Index++
    Words:setString(toString(Index),"student"), Index++
    Words:setString(toString(Index),"subtract"), Index++
    Words:setString(toString(Index),"surrounded"), Index++
    Words:setString(toString(Index),"swimming"), Index++
    Words:setString(toString(Index),"teacher"), Index++
    Words:setString(toString(Index),"telephone"), Index++
    Words:setString(toString(Index),"thursday"), Index++
    Words:setString(toString(Index),"together"), Index++
    Words:setString(toString(Index),"triangle"), Index++
    Words:setString(toString(Index),"tricycle"), Index++
    Words:setString(toString(Index),"upstairs"), Index++
    Words:setString(toString(Index),"vacation"), Index++
    Words:setString(toString(Index),"vaccinate"), Index++
    Words:setString(toString(Index),"valentine"), Index++
    Words:setString(toString(Index),"vegetable"), Index++
    Words:setString(toString(Index),"watching"), Index++
    Words:setString(toString(Index),"wednesday"), Index++
    holoCreate(1,entity():pos()+vec(0,25,90),vec(0,0,0))
    holoCreate(2,entity():pos()+vec(0,0,150),vec(0,0,0))
    holoCreate(3,entity():pos()+vec(0,25,210),vec(0,0,0))
    holoCreate(4,entity():pos()+vec(0,10,201),vec(0,0,0),ang(0,0,45))
    holoCreate(5,entity():pos()+vec(0,50,200),vec(0,0,0))
    holoCreate(6,entity():pos()+vec(0,50,180),vec(0,0,0))
    holoModel(6,"sphere")
    holoCreate(7,entity():pos()+vec(0,50,160),vec(0,0,0))
    holoCreate(8,entity():pos()+vec(0,58,130),vec(0,0,0),ang(0,0,45))
    holoCreate(9,entity():pos()+vec(0,42,130),vec(0,0,0),ang(0,0,-45))
    holoCreate(10,entity():pos()+vec(0,58,160),vec(0,0,0),ang(0,0,45))
    holoCreate(11,entity():pos()+vec(0,42,160),vec(0,0,0),ang(0,0,-45))
    Init = 1
    runOnChat(1)
    }
    #init
    if(Init == 1 & changed(Init)) {timer("beginning",1500)
    }
    if(lastSaid() == "-start" & Running == 0) {
        Person = lastSpoke()
        PersonName = Person:name()
        timer("delay",1500)
        StringIndex = floor(random(1,Index))
        String = Words:string(toString(StringIndex))
        StringL=String:length()
        Guess="-":repeat(StringL)
        Hang = 0
        Letters = ""
        Letter = ""
        Running = 1
    }
        #holo part placeholder start
        #Hung at 11
        if(Hang == 0 & $Hang != 0) {
        Indexer = 0
        while(Indexer < 11) {
            Indexer++
            holoScale(Indexer,vec(0,0,0))
        }
       }
        if(Hang == 1 & $Hang != 0) {
     holoScale(1,vec(0.5,6,0.5))
        }
        if(Hang == 2 & $Hang != 0) {
     holoScale(2,vec(0.5,0.5,10))
        }
        if(Hang == 3 & $Hang != 0) {
     holoScale(3,vec(0.5,6,0.5))
        }
        if(Hang == 4 & $Hang != 0) {
     holoScale(4,vec(0.5,2,0.5))
        }
        if(Hang == 5 & $Hang != 0) {
     holoScale(5,vec(0.5,0.5,2))
        }
        if(Hang == 6 & $Hang != 0) {
     holoScale(6,vec(2,2,2))
        }
        if(Hang == 7 & $Hang != 0) {
     holoScale(7,vec(0.5,0.5,4.5))
        }
        if(Hang == 8 & $Hang != 0) {
     holoScale(8,vec(0.5,0.5,2))
        }
        if(Hang == 9 & $Hang != 0) {
     holoScale(9,vec(0.5,0.5,2))
        }
        if(Hang == 10 & $Hang != 0) {
     holoScale(10,vec(0.5,0.5,2))
        }
        if(Hang == 11 & $Hang != 0) {
     holoScale(11,vec(0.5,0.5,2))
        }
        #holo part placeholder end
        if(clk("delay")) {
        concmd("say "+PersonName+" just started a game of Blizzard's Hangman")
        timer("delay1",1500)
    }
    if(clk("delay1")) {
        concmd("say Your Word is: "+Guess+" please enter a - followed by a character to start guessing. (eg. -a)")
        Phase = 1
    }
    if(Phase == 1) {
        if(Person:lastSaid():explode("")[1,string] == "-" & Letters:find(Person:lastSaid():explode("")[2,string]:lower()) == 0 & Person:lastSaid():length() == 2) {
        Letter = Person:lastSaid():explode("")[2,string]:lower()
        Letters = Letters+Letter
        if(String:find(Letter) != 0 & Guess != String) {
    I=0
    while (I<StringL) {
        I++
        if (String:index(I)==Letter & StringL != I) {
            Guess=Guess:left(I-1)+String:index(I)+Guess:right(String:length()-I)
        }
        if (String:index(I)==Letter & StringL == I) {
            Guess=Guess:left(I-1)+String:index(I)
        }
    }
    Letters = Letters+Letter
    timer("delay2",1500)
    }
    #not working yet:
    #if(Person:lastSaid():length() > 2) {
    #timer("delay15",1500)
    #}
    #if(clk("delay15")) {
    #concmd("say You tried entering an incorrect amount of letters.")
    #}
    else {
        Hang++
        timer("delay3",1500)
    }
    }
    if(clk("delay2")) {
    concmd("say Match found! Word: "+Guess+"")
    }
    if(clk("delay3")) {
    concmd("say No match found! Word: "+Guess+"")
    }
    }
    if(Hang == 11 & changed(Hang)) {
        timer("delay4",3000)
    }
    if(clk("delay4")) {
        concmd("say You have been hung! Game over. Word: "+String+"")
        timer("beginning",1500)
        Phase = 0
    }
    if(clk("beginning")) {Running = 0
        Won = 0
        Phase = 0
        concmd("say Blizzard's Hangman initialized. If you want to start a game, enter: -start")
    }
    if(Guess == String & Running == 1 & Won == 0) {
        Phase = 0
        Running == 0
        timer("won",1500)
        Won = 1}
    if(clk("won")) {
        concmd("say You Won! Word: "+String+"")
        timer("beginning",1500)
    }

    IMPORTANT: To make it working, you have to type in the console: wire_expression2_concmd 1

    Sharing among other sites without my approval is not permitted!


    Last edited by Blizzard on Sun Sep 27, 2009 3:48 am; edited 2 times in total


    _________________


    Share this post on: diggdeliciousredditstumbleuponslashdotyahoogooglelive

    avatar

    Post on Sun Sep 27, 2009 3:09 am by Bam

    Wow! I have to ask, how long did this take from start to where it is now?

    Great work =]
    avatar

    Post on Sun Sep 27, 2009 3:11 am by Blizzard

    Bam wrote:Wow! I have to ask, how long did this take from start to where it is now?

    Great work =]

    I made it some weeks ago. It took me about 24-30 hours of working time in total.
    Today I started removing the bugs which took about 3-4 hours.

    I got a lot of positive feedback from people on the server like Vixen, The Erik, Longino, Ham and Jelly and some others I forgot (sorry for that). Thank you to all who supported me with suggestions and feedback!

    The hardest part of it, was finding the right words for it. After searching the net for hours for good programs and wordlists, I couldn't find anything good. They were either too small, too easy, too big, too hard...
    The right solution was, I took a regular wordlist from a crossword game, and ran a wordlist program through it, sorting words out with a certain length. This was the best solution I found.
    The most complex part of the coding was the part of where it puts the letters in the stripe like ----e--s at the right position without glitching. I had to fiddle a lot with it.
    avatar

    Post on Sun Sep 27, 2009 3:24 am by Bam

    Genius. Shows all your hard work paid off! Nice One
    avatar

    Post on Sun Sep 27, 2009 3:26 am by AdamNub

    Sexy stuff Smile looks awesome
    avatar

    Post on Mon Sep 28, 2009 5:22 am by jakegadget

    Very nice. You should add some garrysmod/popculture references to it.
    avatar

    Post on Mon Sep 28, 2009 10:39 am by HikariMisako

    Awesome Very Happy
    avatar

    Post on Mon Sep 28, 2009 4:07 pm by Blizzard

    jakegadget wrote:Very nice. You should add some garrysmod/popculture references to it.

    What do you mean with this?
    avatar

    Post on Mon Sep 28, 2009 6:17 pm by jakegadget

    Mingebag, RickRoll, ROFLCopter, Fretta, Facepunch, etc.
    avatar

    Post on Mon Sep 28, 2009 6:34 pm by Blizzard

    jakegadget wrote:Mingebag, RickRoll, ROFLCopter, Fretta, Facepunch, etc.

    Oh, well everyone's free to add them on their own.
    avatar

    Post on Mon Sep 28, 2009 8:27 pm by Bam

    Not facepunch lol
    avatar

    Post on Tue Sep 29, 2009 1:09 am by jakegadget

    Bam wrote:Not facepunch lol
    Sorry Bam xD
    Failpunch?
    avatar

    Post on Tue Sep 29, 2009 2:05 am by Bam

    jakegadget wrote:Sorry Bam xD
    Failpunch?

    That's better Wink
    avatar

    Post on Wed Sep 30, 2009 8:03 pm by Jacko245

    I have to say blizzard, you are the ultimate E2 NINJA! Suspect
    avatar

    Post on Wed Sep 30, 2009 9:39 pm by Blizzard

    Yay thx Very Happy
    avatar

    Post on Thu Oct 01, 2009 10:53 am by chargers5583

    I have always wanted to learn how to use the hologram commands....

    Post  by Sponsored content


      Current date/time is Fri Jan 18, 2019 9:25 pm