|
08/04/2014, 22:38
|
#61
|
elite*gold: 58
Join Date: Jun 2011
Posts: 103
Received Thanks: 12
|
Quote:
Originally Posted by »FlutterShy™
pls no 
|
but I rly wanted to see something special in F# :c
this "let" there looks like var in c/#/++ or dim in VB.net
Code:
// ** GIVE THE VALUE A NAME **
// Integer and string.
let num = 10
let str = "F#"
let squareIt = fun n -> n * n
let squareIt2 n = n * n
// ** STORE THE VALUE IN A DATA STRUCTURE **
// Lists.
// Storing integers and strings.
let integerList = [ 1; 2; 3; 4; 5; 6; 7 ]
let stringList = [ "one"; "two"; "three" ]
// You cannot mix types in a list. The following declaration causes a
// type-mismatch compiler error.
//let failedList = [ 5; "six" ]
// In F#, functions can be stored in a list, as long as the functions
// have the same signature.
// Function doubleIt has the same signature as squareIt, declared previously.
//let squareIt = fun n -> n * n
let doubleIt = fun n -> 2 * n
// Functions squareIt and doubleIt can be stored together in a list.
let funList = [ squareIt; doubleIt ]
// Function squareIt cannot be stored in a list together with a function
// that has a different signature, such as the following body mass
// index (BMI) calculator.
let BMICalculator = fun ht wt ->
(float wt / float (squareIt ht)) * 703.0
// The following expression causes a type-mismatch compiler error.
//let failedFunList = [ squareIt; BMICalculator ]
// Tuples.
// Integers and strings.
let integerTuple = ( 1, -7 )
let stringTuple = ( "one", "two", "three" )
// A tuple does not require its elements to be of the same type.
let mixedTuple = ( 1, "two", 3.3 )
// Similarly, function elements in tuples can have different signatures.
let funTuple = ( squareIt, BMICalculator )
// Functions can be mixed with integers, strings, and other types in
// a tuple. Identifier num was declared previously.
//let num = 10
let moreMixedTuple = ( num, "two", 3.3, squareIt )
// You can pull a function out of a tuple and apply it. Both squareIt and num
// were defined previously.
let funAndArgTuple = (squareIt, num)
// The following expression applies squareIt to num, returns 100, and
// then displays 100.
System.Console.WriteLine((fst funAndArgTuple)(snd funAndArgTuple))
// Make a list of values instead of identifiers.
let funAndArgTuple2 = ((fun n -> n * n), 10)
// The following expression applies a squaring function to 10, returns
// 100, and then displays 100.
System.Console.WriteLine((fst funAndArgTuple2)(snd funAndArgTuple2))
// ** PASS THE VALUE AS AN ARGUMENT **
// An integer is passed to squareIt. Both squareIt and num are defined in
// previous examples.
//let num = 10
//let squareIt = fun n -> n * n
System.Console.WriteLine(squareIt num)
// String.
// Function repeatString concatenates a string with itself.
let repeatString = fun s -> s + s
// A string is passed to repeatString. HelloHello is returned and displayed.
let greeting = "Hello"
System.Console.WriteLine(repeatString greeting)
// Define the function, again using lambda expression syntax.
let applyIt = fun op arg -> op arg
// Send squareIt for the function, op, and num for the argument you want to
// apply squareIt to, arg. Both squareIt and num are defined in previous
// examples. The result returned and displayed is 100.
System.Console.WriteLine(applyIt squareIt num)
// The following expression shows the concise syntax for the previous function
// definition.
let applyIt2 op arg = op arg
// The following line also displays 100.
System.Console.WriteLine(applyIt2 squareIt num)
// List integerList was defined previously:
//let integerList = [ 1; 2; 3; 4; 5; 6; 7 ]
// You can send the function argument by name, if an appropriate function
// is available. The following expression uses squareIt.
let squareAll = List.map squareIt integerList
// The following line displays [1; 4; 9; 16; 25; 36; 49]
printfn "%A" squareAll
// Or you can define the action to apply to each list element inline.
// For example, no function that tests for even integers has been defined,
// so the following expression defines the appropriate function inline.
// The function returns true if n is even; otherwise it returns false.
let evenOrNot = List.map (fun n -> n % 2 = 0) integerList
// The following line displays [false; true; false; true; false; true; false]
printfn "%A" evenOrNot
// ** RETURN THE VALUE FROM A FUNCTION CALL **
// Function doubleIt is defined in a previous example.
//let doubleIt = fun n -> 2 * n
System.Console.WriteLine(doubleIt 3)
System.Console.WriteLine(squareIt 4)
// The following function call returns a string:
// str is defined in a previous section.
//let str = "F#"
let lowercase = str.ToLower()
System.Console.WriteLine((fun n -> n % 2 = 1) 15)
let checkFor item =
let functionToReturn = fun lst ->
List.exists (fun a -> a = item) lst
functionToReturn
// integerList and stringList were defined earlier.
//let integerList = [ 1; 2; 3; 4; 5; 6; 7 ]
//let stringList = [ "one"; "two"; "three" ]
// The returned function is given the name checkFor7.
let checkFor7 = checkFor 7
// The result displayed when checkFor7 is applied to integerList is True.
System.Console.WriteLine(checkFor7 integerList)
// The following code repeats the process for "seven" in stringList.
let checkForSeven = checkFor "seven"
// The result displayed is False.
System.Console.WriteLine(checkForSeven stringList)
// Function compose takes two arguments. Each argument is a function
// that takes one argument of the same type. The following declaration
// uses lambda expresson syntax.
let compose =
fun op1 op2 ->
fun n ->
op1 (op2 n)
// To clarify what you are returning, use a nested let expression:
let compose2 =
fun op1 op2 ->
// Use a let expression to build the function that will be returned.
let funToReturn = fun n ->
op1 (op2 n)
// Then just return it.
funToReturn
// Or, integrating the more concise syntax:
let compose3 op1 op2 =
let funToReturn = fun n ->
op1 (op2 n)
funToReturn
// Functions squareIt and doubleIt were defined in a previous example.
let doubleAndSquare = compose squareIt doubleIt
// The following expression doubles 3, squares 6, and returns and
// displays 36.
System.Console.WriteLine(doubleAndSquare 3)
let squareAndDouble = compose doubleIt squareIt
// The following expression squares 3, doubles 9, returns 18, and
// then displays 18.
System.Console.WriteLine(squareAndDouble 3)
let makeGame target =
// Build a lambda expression that is the function that plays the game.
let game = fun guess ->
if guess = target then
System.Console.WriteLine("You win!")
else
System.Console.WriteLine("Wrong. Try again.")
// Now just return it.
game
let playGame = makeGame 7
// Send in some guesses.
playGame 2
playGame 9
playGame 7
// Output:
// Wrong. Try again.
// Wrong. Try again.
// You win!
// The following game specifies a character instead of an integer for target.
let alphaGame = makeGame 'q'
alphaGame 'c'
alphaGame 'r'
alphaGame 'j'
alphaGame 'q'
// Output:
// Wrong. Try again.
// Wrong. Try again.
// Wrong. Try again.
// You win!
// ** CURRIED FUNCTIONS **
let compose4 op1 op2 n = op1 (op2 n)
let compose4curried =
fun op1 ->
fun op2 ->
fun n -> op1 (op2 n)
// Access one layer at a time.
System.Console.WriteLine(((compose4 doubleIt) squareIt) 3)
// Access as in the original compose examples, sending arguments for
// op1 and op2, then applying the resulting function to a value.
System.Console.WriteLine((compose4 doubleIt squareIt) 3)
// Access by sending all three arguments at the same time.
System.Console.WriteLine(compose4 doubleIt squareIt 3)
let doubleAndSquare4 = compose4 squareIt doubleIt
// The following expression returns and displays 36.
System.Console.WriteLine(doubleAndSquare4 3)
let squareAndDouble4 = compose4 doubleIt squareIt
// The following expression returns and displays 18.
System.Console.WriteLine(squareAndDouble4 3)
let makeGame2 target guess =
if guess = target then
System.Console.WriteLine("You win!")
else
System.Console.WriteLine("Wrong. Try again.")
let playGame2 = makeGame2 7
playGame2 2
playGame2 9
playGame2 7
let alphaGame2 = makeGame2 'q'
alphaGame2 'c'
alphaGame2 'r'
alphaGame2 'j'
alphaGame2 'q'
// ** IDENTIFIER AND FUNCTION DEFINITION ARE INTERCHANGEABLE **
let isNegative = fun n -> n < 0
// This example uses the names of the function argument and the integer
// argument. Identifier num is defined in a previous example.
//let num = 10
System.Console.WriteLine(applyIt isNegative num)
// This example substitutes the value that num is bound to for num, and the
// value that isNegative is bound to for isNegative.
System.Console.WriteLine(applyIt (fun n -> n < 0) 10)
System.Console.WriteLine((fun op arg -> op arg) (fun n -> n < 0) 10)
// ** FUNCTIONS ARE FIRST-CLASS VALUES IN F# **
//let squareIt = fun n -> n * n
let funTuple2 = ( BMICalculator, fun n -> n * n )
let increments = List.map (fun n -> n + 1) [ 1; 2; 3; 4; 5; 6; 7 ]
//let checkFor item =
// let functionToReturn = fun lst ->
// List.exists (fun a -> a = item) lst
// functionToReturn
|
|
|
08/05/2014, 11:05
|
#62
|
elite*gold: 46
Join Date: Oct 2010
Posts: 782
Received Thanks: 525
|
Quote:
Originally Posted by Piotreks34
but I rly wanted to see something special in F# :c
this "let" there looks like var in c/#/++ or dim in VB.net
|
Still no reason for using that language then just because of one keyword. Btw c and c++ don't support the var keyword. If you have the boost librarys you can use boost::any in c++ but it is not a build in feature of the c++ programming language and in c you can not use something like that and always need to declare the type. And c# has the let keyword aswell.
|
|
|
08/05/2014, 11:11
|
#63
|
elite*gold: 428
Join Date: Dec 2011
Posts: 2,722
Received Thanks: 2,035
|
I think that could be also usefull if you make something like this:
An application that make on the box a purple circle when detect them, but the circle must be on the darkorbit window not on another GUI like i saw in your videos (purple because there is nothing on darkorbit that is purple). Make this in c++ (cause i think is faster), not a dll, but an application!. This allow pixelbots to use your work more faster without recoding some part of the code  It would be usefull ^^
|
|
|
08/05/2014, 12:26
|
#64
|
elite*gold: 46
Join Date: Oct 2010
Posts: 782
Received Thanks: 525
|
Quote:
Originally Posted by fuso98
I think that could be also usefull if you make something like this:
An application that make on the box a purple circle when detect them, but the circle must be on the darkorbit window not on another GUI like i saw in your videos (purple because there is nothing on darkorbit that is purple). Make this in c++ (cause i think is faster), not a dll, but an application!. This allow pixelbots to use your work more faster without recoding some part of the code  It would be usefull ^^
|
Wtf you talking about ? How you gonna call functions from an application in your own code without much effort ? With a dll it's possible to do it without much effort but with an application it would be just stupid to do that. Also all people say c++ is faster. Yes it is when the code is good written. But even c++ code can run slow especially when invoked from another language.
|
|
|
08/05/2014, 12:33
|
#65
|
elite*gold: 428
Join Date: Dec 2011
Posts: 2,722
Received Thanks: 2,035
|
I mean like vbot and my old boxybot done with swf manager.
The SWF manger was not an extension of the bot, but a separated tool that modify swf on client size. I mean make something like that but he just need to write (with gdi or whatever) a purple circle so without calling functions from a dll the bot can detect faster the boxes.
|
|
|
08/05/2014, 15:12
|
#66
|
elite*gold: 0
Join Date: Jan 2011
Posts: 60
Received Thanks: 66
|
Quote:
Originally Posted by fuso98
I think that could be also usefull if you make something like this:
An application that make on the box a purple circle when detect them, but the circle must be on the darkorbit window not on another GUI like i saw in your videos (purple because there is nothing on darkorbit that is purple). Make this in c++ (cause i think is faster), not a dll, but an application!. This allow pixelbots to use your work more faster without recoding some part of the code  It would be usefull ^^
|
That doesn't seem very efficient. First my code detects a bonus box and puts a purple circle over it. Then your program detects that circle and find the coordinates. Detecting twice might be slower and more inefficient than using my framework alone.
|
|
|
08/05/2014, 21:28
|
#67
|
Moderator
elite*gold: 2072
Join Date: Mar 2013
Posts: 10,569
Received Thanks: 6,669
|
C++ would be very hard.
Python is the better way in my eyes.
If you want a really hard challenge:
Use  .
|
|
|
08/05/2014, 21:43
|
#68
|
elite*gold: 0
Join Date: Oct 2009
Posts: 283
Received Thanks: 92
|
made my day @Brainfuck LOL
|
|
|
08/05/2014, 22:00
|
#69
|
elite*gold: 1
Join Date: Oct 2013
Posts: 1,257
Received Thanks: 1,276
|
Quote:
Originally Posted by Dr.Plastik.'
C++ would be very hard.
Python is the better way in my eyes.
If you want a really hard challenge:
Use  .

|
Ook! would be better !
 !
|
|
|
08/06/2014, 03:34
|
#70
|
elite*gold: 0
Join Date: Jan 2011
Posts: 60
Received Thanks: 66
|
Quote:
Originally Posted by wojtzek
I have core i5 4670k, 8gb ram ddr3, radeon r9 280, screen 1600x900
I think i am getting like 1-5 fps.
|
I found the issue. Its the way I take screenshots. GDK+ libraries are what i use, and this is VERY fast on linux. However GDK is 10 times slower on windows. I will try to fix this before releasing the code. Thanks for telling me about this problem
EDIT:
FIXED! Windows version now gets 12 FPS.
|
|
|
08/06/2014, 21:16
|
#73
|
elite*gold: 0
Join Date: Sep 2011
Posts: 417
Received Thanks: 237
|
Hello, from Seafight section. Would this be a good alternative for Seafight bot's as Bigpoint is going to change some things in Seafight to let our lovely 'Custom Client' stop working.
|
|
|
08/06/2014, 21:20
|
#74
|
elite*gold: 0
Join Date: Jan 2011
Posts: 60
Received Thanks: 66
|
Quote:
Originally Posted by Cheating-nl
Hello, from Seafight section. Would this be a good alternative for Seafight bot's as Bigpoint is going to change some things in Seafight to let our lovely 'Custom Client' stop working.
|
This could be used for any game that involves 2d graphics. So yes seafight is compatible with this framework
|
|
|
Similar Threads
|
Need help making a botting framework
07/10/2014 - DarkOrbit - 17 Replies
Hello guys, Im working on a bot framework (for windows, mac, and linux :) ) that you can easily use to detect complex objects in darkorbit and any other game. It also has some anti cheat functions that you can tweak. This is where my question arises.
I know that darkorbit detects the pattern between clicks to find bots, is there any other ways that DO detects cheats? I need to implement this into my framework and I could find almost nothing online about this.
EDIT:
Here is my work so...
|
All times are GMT +2. The time now is 18:11.
|
|