Jump to content

Nerd Olympics - 4.1


Szhlopp
 Share

Recommended Posts

:D

Okay people, this has been completely redone. It's still in it's 'beta' stage though...

GUI is now dynamically built.

Games are added from a folder.

I've included three games with the set so you can see how it works :lmao: . HOWEVER, the point in Monoceres and me redoing this is so that this can be a community game app.

I would like to have everyone who has a nerdy/geeky game that requires "mad computer skillz" to post the game file here.

Since the GUI is built dynamically, it only takes 1 line to add your game to the list ;)

; ------------------Plugins go here--------------------
#include "sports\ReactionTimesSZH.au3"
#include "sports\MouseSpeedSZH.au3"
#include "sports\MouseAccuracySZH.au3"
; #----------------------------------------------------

In 3 lines I included my games. Now it's your turn to add to that list.

'Core4.1' is currently the app launcher where people can play the games.

'ScriptWriter' takes the information needed and creates a proper .au3/NerdOlympic formatted file.

The folder "Sports" is where all the games are kept.

Here is the file:

Nerd_Olympics_V4.1.zip

Prev DL - 12

Again, this is the beta version so if you find any bugs please post them.

Also as I mentioned above, I'd like to add to that game list. So post your games here! ;)

Edited by Szhlopp
Link to comment
Share on other sites

Nice, but you need to declare the $AccuracyClickedCount as Global, because the

WARNING: $AccuracyClickedCount possibly not declared/created yet

If $AccuracyClicked = True Then $AccuracyClickedCount += 1 warning appears. ;)

Link to comment
Share on other sites

Hi!

I can't test your script right now since I'm at a shared computer, but doesn't the purpose of using my high precision sleep dissapear when you're using GUIGetMsg()?

Will be testing it later and give you feedback! ;)

Broken link? PM me and I'll send you the file!

Link to comment
Share on other sites

Nice, but you need to declare the $AccuracyClickedCount as Global, because the

WARNING: $AccuracyClickedCount possibly not declared/created yet

If $AccuracyClicked = True Then $AccuracyClickedCount += 1 warning appears. ;)

Doh. Missed that one. I'll fix it very soon

thanks for sharing!!

8)

Thanks for all the feedback!

Hi!

I can't test your script right now since I'm at a shared computer, but doesn't the purpose of using my high precision sleep dissapear when you're using GUIGetMsg()?

Will be testing it later and give you feedback! :lmao:

Hrmm, It could, maybe... However I performed ALOT of tests around it's accuracy.

If you find it's off show me how=) We'll correct it to the best of our abilities. =)

look at post below...

If Were Nerds Won't We Just Write A Bot ;)

Nice Job :cheer:

- John

:D

I had to a bot to test the accuracy of this so I wrote a bot that would do the green square clicking. I timed the the thing to go off a second later. The time I was getting was .99/1.0.

Link to comment
Share on other sites

The script works fine and I just thought the timing would be off since GUIGetMsg() has an internal sleep. However I didn't notice it.

;)

However I have an idea how to make this really cool.

In the olympics there are a lot of different competition and that's the thing about it right? But in a script it would be complicated if a lot of people have to modify the core and message loop just to have their competitions added, now stay with me, here's how it could be done:

There is a core script that takes care of the GUI and keeps track of the score and everything, but the competitions are made up by functions that are completely stand alone. Each competition must have two "entry functions", one called "_COMPETITIONNAME_INFO" which returns an array of info about the competition, and the other called "_COMPETITIONNAME_RUN", this one takes some parameters like hwnd and player name so it can operate in any way it like.

Don't know if this sounds interesting but I would love to work with you want to make it happen!

:D

Broken link? PM me and I'll send you the file!

Link to comment
Share on other sites

Very interesting. Let me make sure I get what your saying :lmao:

So the GUI is basically dynamically built off of functions read from a file/location?

Then when somebody wants to add their own 'game'/'sport', they just add a file in the pre-defined location and the game is automatically built into the system?

Sounds awesome, if that is what you had in mind ;)

The file would look something like this?

;$_KEYBOARDSPEED_INFO
;$_KEYBOARDSPEED_RUN

; Two above would be what the parser reads?
Global $_KEYBOARDSPEED_INFO[4]
$_KEYBOARDSPEED_INFO[0] = "DisplayName" ; Button text?
$_KEYBOARDSPEED_INFO[1] = "Description" ; Tooltip text? Or something...
$_KEYBOARDSPEED_INFO[2] = "Category" ; Mouse/Keyboard/Reaction/Speed...  ect. ect. ect.
$_KEYBOARDSPEED_INFO[3] = "Author" ; Who wrote it
; ^^^ Ect Ect

Global $_KEYBOARDSPEED_RUN[2]
$_KEYBOARDSPEED_RUN[0] = $myGui1
$_KEYBOARDSPEED_RUN[1] = "KeyboardSpeedGame()"


Func KeyboardSpeedGame()
    
    ;
    ;
    ;
    ;
    ;
    
    
    EndFunc

This file then would be placed in a folder called like "OlympicSports".

Love the idea and I'd love to work with you on this. I'll be back here in a few hours to look into this more :cheer:

Yeah you got the basic idea.

This is a sample of how I imagine the plugin system:

Core:

#include <array.au3>

Global $SPORTS[1]=[0]
#include "sports\reactiontime.au3"; This is the only line that needs to be added to include a plugin


For $i=1 To $SPORTS[0]
    $info=Call("_"&$sports[$i]&"_INFO")
    _ArrayDIsplay($info)
   ; Call("_"&$sports[$i]&"_RUN",$hwnd,$player); Running the plugin
Next

And the plugin (named reactiontime.au3 and resides in sports):

_ArrayAdd($SPORTS,"ReactionTime")
$SPORTS[0]+=1

Func _ReactionTime_INFO()
    Local $a[4]
    $a[0]="Reaction Time"; Name of the sport
    $a[1]="Sample game"; Description
    $a[2]="Easy"; Difficulty
    $a[3]="Andreas Karlsson"; Author
    Return $a
EndFunc

Func _ReactionTime_RUN($hwnd,$name)
    MsgBox(0,"","Game is running!")
EndFunc

Really easy eh? Only one line to add and no parser :D

Oh and you got pm ;)

Broken link? PM me and I'll send you the file!

Link to comment
Share on other sites

Updated to 4.1

Updated the Core

Updated ScriptWriter

Added 1 new game...

Either download 4.1 or add it yourself. It's VERY easy!

Add this to your "Sports" folder:

KeyboardSpeedSZH.au3

Add this in the "Plugin" section of the 'Core' app

; ------------------Plugins go here--------------------
#include "sports\KeyboardSpeedSZH.au3"

New game added ;)

Link to comment
Share on other sites

New game!

Do you recognize peoples avatars?

http://monoceres.se/Uploads/AvatarManiaMONO.zip

Extract into Sports subdir & add

#include "sports\AvatarManiaMONO\AvatarManiaMONO.au3"

To core ;)

Lol I got 90% :D
Link to comment
Share on other sites

Double click the list view..

#include-once

#include <array.au3>
#include <GuiListView.au3>
#include <Misc.au3>
#include <EditConstants.au3>
#include <GUIConstants.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
; General set of includes for almost ALL games

Global $SPORTS[1] = [0]

; ------------------Plugins go here--------------------
#include "sports\ReactionTimesSZH.au3"
#include "sports\MouseSpeedSZH.au3"
#include "sports\MouseAccuracySZH.au3"
#include "sports\KeyboardSpeedSZH.au3"
; #----------------------------------------------------


Global $DisplayNames[$SPORTS[0]]
Global $Description[$SPORTS[0]]
Global $Author[$SPORTS[0]]
Global $Level[$SPORTS[0]]


For $i = 1 To $SPORTS[0]
    $CallInfo = Call("_" & $SPORTS[$i] & "_INFO")
    $DisplayNames[$i - 1] = $CallInfo[0]
    $Description[$i - 1] = $CallInfo[1]
    $Level[$i - 1] = $CallInfo[2]
    $Author[$i - 1] = $CallInfo[3]
Next


$hMainGUI = GUICreate("Nerd Olympics", 380, 200, -1, @DesktopHeight * .3)
$hListMain = GUICtrlCreateListView("Name             |Description       |Author        | Level", 5, 5, 370, 155)
$LaunchButton = GUICtrlCreateButton("Launch Game", 290, 165, 80, 30)
For $i = 0 To $SPORTS[0] - 1
    GUICtrlCreateListViewItem($DisplayNames[$i] & "|" & $Description[$i] & "|" & $Author[$i] & "|" & $Level[$i], $hListMain)
Next
$Label1 = GUICtrlCreateLabel("Welcome to Nerd Olympics! Choose your game above.", 5, 168, 262, 17)
$Label2 = GUICtrlCreateLabel("Highscores are saved in the script directory.", 25, 185, 210, 17)
GUICtrlSetColor(-1, 0x3399FF)
GUISetState(@SW_SHOW)

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

_GUICtrlListView_RegisterSortCallBack($hListMain)

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hListMain
            _GUICtrlListView_SortItems($hListMain, GUICtrlGetState($hListMain))
            
        Case $LaunchButton
            $ListItemSelected = GUICtrlRead(GUICtrlRead($hListMain))
            If $ListItemSelected <> "0" Then
                $split = StringSplit($ListItemSelected, "|")
                For $i = 0 To $SPORTS[0] - 1
                    If $DisplayNames[$i] = $split[1] Then
                        Call("_" & $SPORTS[$i + 1] & "_RUN", $hMainGUI, "")
                        WinActivate($hMainGUI)
                        ExitLoop
                    EndIf
                Next
                
            EndIf

    EndSwitch
    
WEnd

Func WM_NOTIFY($CtrlHandle, $MsgID, $CtrlID, $LPNMHDR)
    Local $hListView = $hListMain
    If $CtrlID = $hListView Then
        Local $NMHDR, $Event
        $NMHDR = DllStructCreate("int;int;int", $LPNMHDR)
        If @Error Then Return
        Local $nEvent = DllStructGetData($NMHDR, 3)
        If $nEvent = $NM_DBLCLK Then ControlClick($hMainGUI, '', $LaunchButton)
    EndIf
    $LPNMHDR = 0
EndFunc
Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet()
Link to comment
Share on other sites

Double click the list view..

#include-once

#include <array.au3>
#include <GuiListView.au3>
#include <Misc.au3>
#include <EditConstants.au3>
#include <GUIConstants.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
; General set of includes for almost ALL games

Global $SPORTS[1] = [0]

; ------------------Plugins go here--------------------
#include "sports\ReactionTimesSZH.au3"
#include "sports\MouseSpeedSZH.au3"
#include "sports\MouseAccuracySZH.au3"
#include "sports\KeyboardSpeedSZH.au3"
; #----------------------------------------------------


Global $DisplayNames[$SPORTS[0]]
Global $Description[$SPORTS[0]]
Global $Author[$SPORTS[0]]
Global $Level[$SPORTS[0]]


For $i = 1 To $SPORTS[0]
    $CallInfo = Call("_" & $SPORTS[$i] & "_INFO")
    $DisplayNames[$i - 1] = $CallInfo[0]
    $Description[$i - 1] = $CallInfo[1]
    $Level[$i - 1] = $CallInfo[2]
    $Author[$i - 1] = $CallInfo[3]
Next


$hMainGUI = GUICreate("Nerd Olympics", 380, 200, -1, @DesktopHeight * .3)
$hListMain = GUICtrlCreateListView("Name             |Description       |Author        | Level", 5, 5, 370, 155)
$LaunchButton = GUICtrlCreateButton("Launch Game", 290, 165, 80, 30)
For $i = 0 To $SPORTS[0] - 1
    GUICtrlCreateListViewItem($DisplayNames[$i] & "|" & $Description[$i] & "|" & $Author[$i] & "|" & $Level[$i], $hListMain)
Next
$Label1 = GUICtrlCreateLabel("Welcome to Nerd Olympics! Choose your game above.", 5, 168, 262, 17)
$Label2 = GUICtrlCreateLabel("Highscores are saved in the script directory.", 25, 185, 210, 17)
GUICtrlSetColor(-1, 0x3399FF)
GUISetState(@SW_SHOW)

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

_GUICtrlListView_RegisterSortCallBack($hListMain)

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hListMain
            _GUICtrlListView_SortItems($hListMain, GUICtrlGetState($hListMain))
            
        Case $LaunchButton
            $ListItemSelected = GUICtrlRead(GUICtrlRead($hListMain))
            If $ListItemSelected <> "0" Then
                $split = StringSplit($ListItemSelected, "|")
                For $i = 0 To $SPORTS[0] - 1
                    If $DisplayNames[$i] = $split[1] Then
                        Call("_" & $SPORTS[$i + 1] & "_RUN", $hMainGUI, "")
                        WinActivate($hMainGUI)
                        ExitLoop
                    EndIf
                Next
                
            EndIf

    EndSwitch
    
WEnd

Func WM_NOTIFY($CtrlHandle, $MsgID, $CtrlID, $LPNMHDR)
    Local $hListView = $hListMain
    If $CtrlID = $hListView Then
        Local $NMHDR, $Event
        $NMHDR = DllStructCreate("int;int;int", $LPNMHDR)
        If @Error Then Return
        Local $nEvent = DllStructGetData($NMHDR, 3)
        If $nEvent = $NM_DBLCLK Then ControlClick($hMainGUI, '', $LaunchButton)
    EndIf
    $LPNMHDR = 0
EndFunc

Nice!

I'll add this in 4.2. Thanks!! ;)

Also in 4.2:

New games

Highest score now easily shown per game

*Core will take care of managing the highscores

* - Hopefully will be in by '4.2'. Basically how this works is you return the value in your game and the core will create a new entry into the scores file. Will also update to the highest score column :D

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...