Any Python Game Engine Scripts for wiki

Hi, I’m doing some work updating the wiki.
I was just wondering about adding a section for Game Engine Scripts in the Scripts/Catalog area. (wip below)
It seems this area has been long neglected in the availibility of scripts.
I have some snippets of code, but not much else.
To be Honest the more scripts I/Others can list/link to in Game Engine Scripts section (when I/someone writes it) the better.
[hint]There is talk of a Game Engine scripts section being included in Blender.[hint]
So could anyone please post some links, help or ideas on how to best gather as many useful Games related scripts so I can at least make a start.:slight_smile:

Hmm… I wrote several snippets for people who asked how to setup specific things, I don’t know if that’s what your looking for. I’ll try to remember in which threads I posted them.

Anyway, here’s one I did for Double Click detection in game:


#Logic Brick setup:
#
#Mouse Sensor---->Python
#Always------------^
#
#~Properties~
#Timer prop named "time" (<i>no quotes</i>)
#Int prop named "mstate" (<i>no quotes</i>)
#Int prop named "mcount" (<i>no quotes</i>)

cont = GameLogic.getCurrentController()
own = cont.getOwner()

#The mouse sensor:
mclick = cont.getSensor("mousesensorname")

if own.mcount == 0: #Keep time at bay
    own.time = 0

if mclick.isPositive() and own.mstate == 0:
    own.mcount += 1
    own.mstate = 1 #So that it won't keep going 

#Until you let go:
if not mclick.isPositive():
    own.mstate = 0

#How much time do you allow for double click? (<i>I chose 0.5sec</i>)
if own.time &gt; 0.5 or own.mcount == 2: #or dclick resets regardless
    if own.mcount == 1:
        #Single click event
    if own.mcount == 2:
        #Double click event
    #The reset:
    own.time = 0
    own.mcount = 0

From this thread: http://blenderartists.org/forum/showthread.php?t=77603

Also, I think we should check if the documentation holds any code examples before we start posting duplicates. I don’t think they have overly specific things listed, but I know for a fact that the docs hold code examples for scripting things like LOD, and how to use GameKeys etc.

If you have something specific in mind that you would like a script for tell me, and I’ll see if I can write it for you.

Thanks Social,
I guess thats the sort of stuff for sure.
Anything is great as it will be a few weeks before I add the Game section.
(always happens earlier, but theres plenty of time, the wiki will always be a WIP)
I don’t use the game engine much myself so any help is great.