Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- IFMATCHES(%@&chatclean%,"%@®ex%\.newgame",&name,1)
- IF(%&name% = %PLAYER%)
- UnSet(@&hfinal)
- UnSet(@&blank[])
- UnSet(@&character[])
- UnSet(@&hfound)
- UnSet(@&hinprogress)
- Echo(&7&oCreating new puzzle...)
- PROMPT(@&hstring,$$?,"Enter the phrase you want people to guess (no numbers):")
- PROMPT(@&topic,$$?,"Enter the topic for \"%@&hstring%\"")
- PROMPT(@#hlives,$$?,"How many lives should be allowed?")
- Set(@#hlivesleft,%@#hlives%)
- IF(@&hstring = "")
- Stop
- ENDIF
- @&hstringsave = %@&hstring%
- DO
- IFMATCHES(%@&hstring%,"..")
- MATCH(%@&hstring%,"(.)(.+)",{@&hletter,@&hstring})
- IFMATCHES(%@&hletter%,(?-i)[A-Za-z])
- Push(@&blank[],"_")
- Push(@&character[],%@&hletter%)
- ENDIF
- IFMATCHES(%@&hletter%," ")
- Push(@&blank[]," ")
- Push(@&character[],%@&hletter%)
- ENDIF
- ELSE
- Break
- ENDIF
- LOOP
- MATCH(%@&hstring%,"(.)",{@&hletter})
- IFMATCHES(%@&hletter%,(?-i)[A-Za-z])
- Push(@&blank[],"_")
- Push(@&character[],%@&hletter%)
- ENDIF
- IFMATCHES(%@&hletter%," ")
- Push(@&blank[]," ")
- Push(@&character[],%@&hletter%)
- ENDIF
- FOREACH(@&blank[],&character,#count)
- @&hfinal = %@&hfinal%%&character%
- NEXT
- @&hcomplete = "false"
- Echo(&aPuzzle: &6%@&hfinal% &aTopic: &6%@&topic% &aLives: &6%@#hlives%)
- Echo(&aUse &6.guess [letter] &aor &6.solve [guess] &ato play)
- ENDIF
- ENDIF
- IFMATCHES(%@&chatclean%,"%@®ex%\.guess ([A-Za-z]{1,1})",&guess,2)
- MATCH(%@&chatclean%,"%@®ex%\.guess (.+)",&guesser,1)
- IF(@&hcomplete != "true")
- IF(@&hinprogress != "true")
- @&hinprogress = "true"
- @&hfound = "false"
- FOREACH(@&character[],&character,#count)
- IFMATCHES(%&character%,%&guess%)
- Set(@&blank[%#count%],%@&character[%#count%]%)
- @&hfound = "true"
- ENDIF
- NEXT
- UnSet(@&hfinal)
- IF(@&hfound = "false")
- Dec(@#hlivesleft)
- ENDIF
- IF(@&hfound = "false")
- FOREACH(@&blank[],&character,#count)
- @&hfinal = %@&hfinal%%&character%
- NEXT
- IF(@#hlivesleft = 0)
- Echo(&cGame over. Answer: %@&hstringsave%)
- @&hinprogress = "false"
- @&hcomplete = "true"
- ELSE
- Echo("&c\"%&guess%\" is not in the puzzle. &aLives: &6%@#hlivesleft%")
- Echo(&aPuzzle: &6%@&hfinal% &aTopic: &6%@&topic%)
- @&hinprogress = "false"
- ENDIF
- ELSE
- IF(@#hlivesleft = 0)
- Echo(&cGame over. Answer: %@&hstringsave%)
- @&hinprogress = "false"
- @&hcomplete = "true"
- ELSE
- FOREACH(@&blank[],&character,#count)
- @&hfinal = %@&hfinal%%&character%
- NEXT
- IF(@&hstringsave = %@&hfinal%)
- Echo(&a%&guesser% wins! Answer: %@&hstringsave%)
- @&hinprogress = "false"
- @&hcomplete = "true"
- ELSE
- Echo("&a\"%&guess%\" is in the puzzle. &aLives: &6%@#hlivesleft%")
- Echo(&aPuzzle: &6%@&hfinal% &aTopic: &6%@&topic%)
- @&hinprogress = "false"
- ENDIF
- ENDIF
- ENDIF
- ENDIF
- ENDIF
- ENDIF
- IFMATCHES(%@&chatclean%,"%@®ex%\.solve (.+)",&solver,1)
- IFMATCHES(%@&chatclean%,"%@®ex%\.solve (.+)",&solve,2)
- IF(@&hcomplete != "true")
- IF(@&hinprogress != "true")
- UnSet(&final)
- FOREACH(@&character[],&letter,#count)
- &final = %&final%%&letter%
- NEXT
- IFMATCHES(%&solve%,%&final%)
- Echo(&a%&solver% successfully solved the puzzle!)
- @&hcomplete = "true"
- ELSE
- Dec(@#hlivesleft)
- IF(@#hlivesleft < 1)
- Echo(&cGame over. Answer: %@&hstringsave%)
- ELSE
- Echo(&c%&solver% did not solve the puzzle correctly. &aLives: &6%@#hlivesleft%)
- ENDIF
- ENDIF
- ENDIF
- ENDIF
- ENDIF
- ENDIF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement