Hidden Function

Blitz3D Forums/Blitz3D Programming/Hidden Function

Neochrome(Posted 2003) [#1]
i just found out about EnableDirectInput 1/0

and Object is also a hidden these arn't documented..

HOW many more of these hidden function are there in Blitz???

!!!!!


Ross C(Posted 2003) [#2]
what does direct input do??


ckob(Posted 2003) [#3]
there are a bunch of "Hidden" commands every no and then someone will "find" them and post a bunch of these commands if you look around you'll find a couple threads doing so.


DrakeX(Posted 2003) [#4]
in a recent version of blitz mark was having some compatibility issues with DirectInput on some computers, so he switched input to windows messages instead, which are a bit slower but mroe compatible. EnableDirectInput uses the old DInput instead, you might want to have this as an option in your games.

Object and Handle are 2 useful (somewhat) functions, i've never actually used them but they have their uses. i forget who posted this, it was from BC:

You know what a type pointer is, right? a.mytype = New mytype... a is the
type pointer which points to a new type. Unfortunately, you can only
store the value of "a" in another type pointer. (eg b.mytype = a.. b now
points to the same type that a does.) It would really be beneficial if
you could find a numeric value of the type that "a" points to.

Help is at hand. Or rather, at Handle! (aha I just made that one up!)
Handle(a.mytype) returns a numeric value of the index number of the type.
In otherwords, an integer equivalent of the type pointer!! Woot!! You can
then convert back with the following syntax: a.mytype = Object.mytype
(id)
where id is the numeric value.

What are the uses of this? Well, for starters, you can store this numeric
value in lots more places. I have done it here to store a kind of pointer
to a type using the EntityName() paremeter of an entity. Handle(sprite)
converts the sprite type into a numeric value and stores it in the
entity. You can then find the type pointer by saying: Object.Mysprite(EntityName(spr))
where spr is the name of the sprite entity.

Another use? Great for polymorphic functions! A polymorphic function is a
function that decides what to do depending on the type of data you give
it. Consider this:


Function DoStuff(id)
    If Object.nose(id)<>Null
        ; ID is a "nose" type pointer
        n.nose = Object.nose(id)
        n\sniffing = True...

    Elseif Object.eye(id)<>Null
        ; ID is an "eye" type pointer
        e.eye = Object.eye(id)
        e\blinking = True ...

    ElseIf Object.mouth(id)<>Null
        ; ID is a "mouth" type pointer
        m.mouth = Object.mouth(id)
        m\yapping = True ...

    Else
        ; ID is not recognised.
    End If
End Function

If your Object.type(id) is null, then that type either does not exist, or
the ID number is pointing to another type, because each type has a unique ID.

Another use? Storing types in banks. Banks are resizable and so they can
act a bit like a redimensionable array. (For example, if you have a map
editor and you want the user to be able to resize the map at his/her
whim!) If your map data has lots of little bits of info, you might want
to store it in an array of types. Very useful, but if you want to start
resizing the map you might come into some problems. The best way is to
PokeInt the handle of the types in a bank.


For t.type = each type
    PokeInt(bank, cnt*4, Handle(t))
    cnt=cnt+1
Next

For i=0 To BankSize(bank) Step 4
    t.type = Object.type(PeekInt(bank,i))
    If t<>Null  ; (check, just in case..)
        ; Do what you like with t.
    End If
Next
The 4 is because Peek/PokeInt takes up FOUR bytes
This is quite advanced stuff, but it's very useful if you can
understand it!!


finally there are some other functions you haven't heard of, like VectorYaw, VectorPitch, and GetMatElement. those 3 are documented in the online help here: http://www.blitzbasic.com/b3ddocs/command_list_3d_cat.php

some of these hidden commands get turned into real commands later.


EOF(Posted 2003) [#5]
Shh, easter eggs ...
; undocumented commands

c=ActiveTextures()                    ; number of unique textures in use
RuntimeStats                          ; ?
a=Stats3D(typ)                        ; ?
VectorPitch(x#,y#,z#)                 ; calculates absolute PITCH angle for X-axis
VectorYaw(x#,y#,z#)                   ; calculates absolute YAW angle for Y-axis
p#=DeltaPitch(src_entity,dest_entity) ; calculate PITCH angle of objects rotation
y#=DeltaYaw(src_entity,dest_entity)   ; calculate YAW angle of objects rotation
v#=GetMatElement(entity,row,col)      ; find scale size of entity
a.mytype=Object.mytype(key)           ; find object by key
h=Handle(a.mytype)                    ; find key of referenced type
result=DirectInputEnabled()           ; returns true if Directinput is used else false 
EnableDirectInput flag                ; enable or disable the DirectInput API
c=CountGfxModes3D()                   ; determines the number of 3D graphics modes supported
SelectObject(hDc,hgdiobj)             ; Turn around and walk away ..!



Neochrome(Posted 2003) [#6]
well now thats what i call hidden! cool! i'll go away and play!

tho whats the runtimestats do and how you use it?


EOF(Posted 2003) [#7]
Probably just internal debugging stuff for Mark.


MrCredo(Posted 2003) [#8]
http://www.blitzbase.de/menu/1a.htm

all commands with blue star are "undocumented"

all commands with red star was kicked and should never be used in your programs...


sswift(Posted 2003) [#9]
I wanna know what SelectObject(hDc,hgdiobj) does... It looks like it has something to do with something internal to windows, like a window handle, or maybe it has something to do with selecting buttons and things by handle. Hm...


Koriolis(Posted 2003) [#10]
Yes, it's not a hidden function, it's an internal one. It's a Win32 API function. Maybe SyntaxError looked with an hexa editor into the runtime.dll file to find undocumented commands, and seing SelectObject(hDc,hgdiobj) thought it was an undocumented function, when it was only an import symbol.


DrakeX(Posted 2003) [#11]
mrcredo -- thanks, though it's all in german :P and my german skills are less than good...

i wonder how amusing babelfish can make it..!


Bot Builder(Posted 2003) [#12]
I don't know german either.... oh well. Just use the google page translater! ok, granted, it isn't perfect, but it actually works pretty well.

Coool... RuntimeStats, ActiveObjects, and ActiveTextures will be good for debugging world destroyers(in preperation for say, the next level).


uhhhhh, maybe the google tip isn't so great..... Not turned into EMERGENCY, and Handle and stats turned into Art..... oh well. at least you can read the descriptions. The stats3d command is really funny. I ran it like this:
for a=0 to 1000
 debuglog stats3d#(a)
next

and it looked like a random number genorator that picks "0" half the time, and numbers less than one the other half.
well, as the blitzbase site says, "The sense of this function could not be determined (still)."


DrakeX(Posted 2003) [#13]
"it isn't perfect, but it actually works pretty well"

yeah i was surprised too. i was even able to read the articles with almost no problem. there were some funny sentences tho, like this one:

"Beginning of the 80's was clouded phaenomenale success by BASIC something."

i'd like to know what "BASIC something" is :D

not to mention they kept talking about something called "lightning basic" and i didn't realize they were talking about blitz until i remembered that Blitz is german for lightning! hehe :)

and the guy who wrote the page comments: "Mark's way of writing is already violent" :) hehe