Script's

Script's Semua yg berhubungan dengan Script...

  script Game Guardian aplikasi android
01/09/2020

script Game Guardian aplikasi android

HOW TO MAKE LUA SCRIPTS GAME GUARDIAN Starting from version 8.28.0 game guardian included a support for LUA scripts.We can now make lua scripts for literary any game we play.This guide will take you through the full scripting tutorial from scratch assuming you have NO previous programming knowledge....

27/11/2019

# blender script
# Mouse Look

# define main program
def main():

# set default values
Sensitivity = 0.0010
Invert = 1
Capped = False

# get controller
controller = bge.logic.getCurrentController()

# get the object this script is attached to
obj = controller.owner

# get the size of the game screen
gameScreen = gameWindow()

# get mouse movement
move = mouseMove(gameScreen, controller, obj)

# change mouse sensitivity?
sensitivity = mouseSen(Sensitivity, obj)

# invert mouse pitch?
invert = mousePitch(Invert, obj)

# upDown mouse capped?
capped = mouseCap(Capped, move, invert, obj)

# use mouse look
useMouseLook(controller, capped, move, invert, sensitivity)

# Center mouse in game window
centerCursor(controller, gameScreen)

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

# define game window
def gameWindow():

# get width and height of game window
width = bge.render.getWindowWidth()
height = bge.render.getWindowHeight()

return (width, height)

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

# define mouse movement function
def mouseMove(gameScreen, controller, obj):

# Get sensor named MouseLook
mouse = controller.sensors["MouseLook"]

# extract width and height from gameScreen
width = gameScreen[0]
height = gameScreen[1]

# distance moved from screen center
x = width/2 - mouse.position[0]
y = height/2 - mouse.position[1]

# initialize mouse so it doesn't jerk first time
if not 'mouseInit' in obj:
obj['mouseInit'] = True
x = 0
y = 0

# # # # # # # # # stops drifting on mac osx

# if sensor is deactivated don't move
if not mouse.positive:
x = 0
y = 0

# # # # # # # # # -- mac fix contributed by Pelle Johnsen

# return mouse movement
return (x, y)

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

# define Mouse Sensitivity
def mouseSen(sensitivity, obj):

# check so see if property named Adjust was added
if 'Adjust' in obj:

# Don't want Negative values
if obj['Adjust'] < 0.0:
obj['Adjust'] = 0.0

# adjust the sensitivity
sensitivity = obj['Adjust'] * sensitivity

# return sensitivity
return sensitivity

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

# define Invert mouse pitch
def mousePitch(invert, obj):

# check to see if property named Invert was added
if 'Invert'in obj:

# pitch to be inverted?
if obj['Invert'] == True:
invert = -1
else:
invert = 1

# return mouse pitch
return invert

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

# define Cap vertical mouselook
def mouseCap(capped, move, invert, obj):

# check to see if property named Cap was added
if 'Cap' in obj:

# import mathutils
import mathutils

# limit cap to 0 - 180 degrees
if obj['Cap'] > 180:
obj['Cap'] = 180
if obj['Cap'] < 0:
obj['Cap'] = 0

# get the orientation of the camera to parent
camOrient = obj.localOrientation

# get camera Z axis vector
camZ = [camOrient[0][2], camOrient[1][2], camOrient[2][2]]

# create a mathutils vector
vec1 = mathutils.Vector(camZ)

# get camera parent
camParent = obj.parent

# use Parent z axis
parentZ = [ 0.0, 0.0, 1.0]

# create a mathutils vector
vec2 = mathutils.Vector(parentZ)

# find angle in radians between two vectors
rads = mathutils.Vector.angle(vec2, vec1)

# convert to degrees (approximate)
angle = rads * ( 180.00 / 3.14)

# get amount to limit mouselook
capAngle = obj['Cap']

# get mouse up down movement
moveY = move[1] * invert

# check capped angle against against camera z-axis and mouse y movement
if (angle > (90 + capAngle/2) and moveY > 0) or (angle < (90 - capAngle/2) and moveY < 0) == True:

# no movement
capped = True

# return capped
return capped

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

# define useMouseLook
def useMouseLook(controller, capped, move, invert, sensitivity):

# get up/down movement
if capped == True:
upDown = 0
else:
upDown = move[1] * sensitivity * invert

# get left/right movement
leftRight = move[0] * sensitivity * invert

# Get the actuators
act_LeftRight = controller.actuators["LeftRight"]
act_UpDown = controller.actuators["UpDown"]

# set the values
act_LeftRight.dRot = [ 0.0, 0.0, leftRight]
act_LeftRight.useLocalDRot = False

act_UpDown.dRot = [ upDown, 0.0, 0.0]
act_UpDown.useLocalDRot = True

# Use the actuators
controller.activate(act_LeftRight)
controller.activate(act_UpDown)

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

# define center mouse cursor
def centerCursor(controller, gameScreen):

# extract width and height from gameScreen
width = gameScreen[0]
height = gameScreen[1]

# Get sensor named MouseLook
mouse = controller.sensors["MouseLook"]

# get cursor position
pos = mouse.position

# if cursor needs to be centered
if pos != [int(width/2), int(height/2)]:

# Center mouse in game window
bge.render.setMousePosition(int(width/2), int(height/2))

# already centered. Turn off actuators
else:
# Get the actuators
act_LeftRight = controller.actuators["LeftRight"]
act_UpDown = controller.actuators["UpDown"]

# turn off the actuators
controller.deactivate(act_LeftRight)
controller.deactivate(act_UpDown)

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

GameLogic
import bge

# Run program
main()

24/10/2018

//java script's face detect

package cameracapture;

import java.awt.Graphics;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import javax.imageio.ImageIO;
import javax.swing.JFileChooser;
import javax.swing.UIManager;
import javax.swing.filechooser.FileNameExtensionFilter;

import org.opencv.core.Mat;
import org.opencv.core.MatOfByte;
import org.opencv.highgui.Highgui;
import org.opencv.highgui.VideoCapture;
import org.opencv.core.Core;

/**
*
* SOHAM GANDHI
*/
public class CamCap extends javax.swing.JFrame
{

private DaemonThread myThread = null;
int count = 0;
VideoCapture webSource = null;

Mat frame = new Mat();
MatOfByte mem = new MatOfByte();

String File_path="";

class DaemonThread implements Runnable
{
protected volatile boolean runnable = false;


public void run()
{
synchronized(this)
{
while(runnable)
{
if(webSource.grab())
{
try
{
webSource.retrieve(frame);
Highgui.imencode(".bmp", frame, mem);
Image im = ImageIO.read(new ByteArrayInputStream(mem.toArray()));

BufferedImage buff = (BufferedImage) im;
Graphics g=jPanel1.getGraphics();

if (g.drawImage(buff, 0, 0, getWidth(), getHeight() -150 , 0, 0, buff.getWidth(), buff.getHeight(), null))

if(runnable == false)
{
System.out.println("Going to wait()");
this.wait();
}
}
catch(Exception ex)
{
System.out.println("Error");
}
}
}
}
}
}

/** Creates new form CamCap */
public CamCap() {
initComponents();
}

/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
("unchecked")
//
private void initComponents() {

jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jPanel1 = new javax.swing.JPanel();
jPanel2 = new javax.swing.JPanel();
jComboBox1 = new javax.swing.JComboBox();
jButton3 = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Capture");
setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
setResizable(false);
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosed(java.awt.event.WindowEvent evt) {
formWindowClosed(evt);
}
public void windowClosing(java.awt.event.WindowEvent evt) {
formWindowClosing(evt);
}
});

jButton1.setFont(new java.awt.Font("Cambria", 0, 18));
jButton1.setText("Start");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});

jButton2.setFont(new java.awt.Font("Cambria", 0, 18));
jButton2.setText("Stop");
jButton2.setEnabled(false);
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});

jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
jPanel1.setPreferredSize(new java.awt.Dimension(320, 240));

javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 323, Short.MAX_VALUE)
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 236, Short.MAX_VALUE)
);

jPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder());
jPanel2.setAlignmentX(0.1F);
jPanel2.setAlignmentY(0.1F);

jComboBox1.setFont(new java.awt.Font("Calibri", 0, 16));
jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "From We**am", "From File" }));
jComboBox1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jComboBox1ActionPerformed(evt);
}
});

jButton3.setFont(new java.awt.Font("Calibri", 0, 18));
jButton3.setText("...");
jButton3.setEnabled(false);
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});

jLabel1.setFont(new java.awt.Font("Calibri", 0, 16));
jLabel1.setText("Capture Method:");

javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton3))
.addContainerGap(13, Short.MAX_VALUE))
);

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jPanel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, 174, Short.MAX_VALUE))
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 327, Short.MAX_VALUE))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(6, 6, 6)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton1)
.addComponent(jButton2))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);

pack();
}//

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

if ( (jButton1.getText()).equals("Start") )
{
if (jComboBox1.getSelectedItem().equals("From We**am"))
{
webSource =new VideoCapture(0);
}
else
webSource =new VideoCapture(File_path);

myThread = new DaemonThread();
Thread t = new Thread(myThread);
t.setDaemon(true);
myThread.runnable = true;
t.start();

jButton1.setEnabled(false);
jButton2.setEnabled(true);
jComboBox1.setEnabled(false);
}
}

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {

if ( (jButton2.getText()).equals("Stop") )
{
myThread.runnable = false;
jButton2.setEnabled(false);
jButton1.setEnabled(true);
jComboBox1.setEnabled(true);
webSource.release();
}
}

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
JFileChooser chooser = new JFileChooser();
FileNameExtensionFilter filter = new FileNameExtensionFilter("AVI","avi");
chooser.setFileFilter(filter);
int returnVal = chooser.showOpenDialog(this);
if(returnVal == JFileChooser.APPROVE_OPTION)
{
File_path=chooser.getSelectedFile().getPath();
jButton1.setEnabled(true);
}
else
File_path="";
}

private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if(jComboBox1.getSelectedItem().equals("From File"))
{
jButton3.setEnabled(true);
jButton1.setEnabled(false);
}
else
{
jButton3.setEnabled(false);
jButton1.setEnabled(true);
}
}

private void formWindowClosed(java.awt.event.WindowEvent evt) {
// TODO add your handling code here:


}

private void formWindowClosing(java.awt.event.WindowEvent evt) {
// TODO add your handling code here:
if (myThread == null) {
}
else
if (myThread.runnable)
{
myThread.runnable = false;
webSource.release();
}
}

/**
* args the command line arguments
*/
public static void main(String args[]) {
//System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
//System.loadLibrary("opencv-248");
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {

CamCap.setDefaultLookAndFeelDecorated(true);
try
{
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
}
catch (Exception ex)
{
System.out.println("Failed loading L&F: ");
System.out.println(ex);
System.out.println("Loading default Look & Feel Manager!");
}

new CamCap().setVisible(true);
}
});

}

// Variables declaration - do not modify
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JComboBox jComboBox1;
private javax.swing.JLabel jLabel1;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
// End of variables declaration

}

16/04/2017

Cell
import appuifw
def all_perms(elements):
>if len(elements)>return elements
>else:
>>tmp=[]
>>for perm in all_perms(elements[1:]):
>>>for i in range(len(elements)):
>>>>tmp.append(perm[:i]+elements[0:1]+perm
[i:])
>return tmp
word=appuifw.query(u'','text','aku')
if not word is None:
>a=all_perms(word)
>for i in a: print i

16/04/2017

# wavtoznd.py
# by
# Watt-Soft (Book)
# Anggota
# Sarman

import struct, zut, os, appuifw
import TopWindow,sys,e32
from graphics import*

sys.setdefaultencoding('utf-8')

mydir=os.path.dirname(appuifw.app.full_name())+'\\'

def put(x,p=u'e://',y=0):
global path
p = (y and appuifw.query(unicode("ÐÑÑÑ"), "text",unicode(p))) or p
p = p[-1] != '/' and p+'/' or p
fo=open(mydir+'dir',x and 'r' or 'w')
path = (x and fo.read() ) or fo.write(p) or p
fo.close()
return 1

os.path.exists(mydir+'dir') and put(1) or put(0)

app_lock = e32.Ao_lock()
z=zut.sound()

so=z.load_znd(mydir+'win.znd')
do=z.load_znd(mydir+'din.znd')
er=z.load_znd(mydir+'er.znd')

img=Image.new((176,208))

def handle_redraw(rect):
canvas.blit(img)

class Buf:
def __init__(self):
self.buf=[]

buf=Buf()

class Top:
def __init__(self):
self.win=TopWindow.TopWindow()
self.win.size = (170,40)
self.win.position = (3,40)
self.win.shadow = 2
self.win.corner_type = 'corner1'
self.top = Image.new((170,40))
self.t=0; self.p=1
self.vis()

def pause(self,x):
self.p=x
if self.p and self.t: self.win.show()
else: self.win.hide()

def vis(self):
self.top.rectangle((0,0,170,40),0,fill=0x007700)
self.top.rectangle((10,15,160,35),0,fill=0xffffff)
self.top.text((62,12),unicode('ÐÑогÑеÑÑ'),0xffffff)
self.win.add_image(self.top,(0,0))
self.pause(self.p)

def progress(self,p):
self.win.remove_image(self.top)
self.vis()
x=(159-11)*p/100+11
self.top.rectangle((11,16,x+2,20),fill=0x9999ff)
self.top.rectangle((11,20,x+2,34),fill=0x2222dd)
self.win.add_image(self.top, (0,0))
e32.ao_yield()
if p>98: self.win.hide();self.t=0
return 0

def note(self,text,x=1):
self.win.remove_image(self.top)
self.t=1; self.vis()
self.top.rectangle((0,0,170,40),0,fill=x and 0x007700 or 0xaa0000)

for t,y in zip(text,[13,25,37]):
self.top.text((84- img.measure_text(t, font=u'LatinBold12')[1]/2,y),unicode(t),0xffffff,u'LatinBold12')

self.win.add_image(self.top, (0,0))
x and z.play_znd(do) or not x and z.play_znd(er)
e32.ao_sleep(3)
self.win.hide(); self.t=0

top_w=Top()
appuifw.app.focus=top_w.pause

def format_w(f):
fo=open(mydir+'formatw','r')
format=fo.read()
fo.close()
format=eval(format)
top_w.note(['ФоÑмаÑ',format[f]+' ',' ÐеподдеÑживаеÑÑÑ'],0)

# ÑпÑавление
class Use:
def __init__(self,fm):
self.mar_r=0; self.mar_l=-1
self.xr=0; self.xl=175
self.key=0; self.pix_xr=0
self.pix_xl=0; self.trig=1
self.list=[]; self.un=0
self.name=fm.split('/')[-1][-20:]

self.fm=fm; self.open_s(fm)
self.func=lambda e,xt: ((e==63496 and (xt0)) and -1)

def trigger(self):
self.trig=~self.trig+2
self.key=0; self.linact()

def tobuf(self,c=0):
a=self.choice()
buf.buf=self.num[a[0]:a[1]]
if c:
self.undo(a[0],a[0],self.num[a[0]:a[1]])
self.num=self.num[:a[0]]+self.num[a[1]:]
self.graph(0)
tab.tab(self.name)
self.foot(); self.key=0

# ÐгÑаниÑиÑели
def line(self,e='xl',x=0):
if self.trig: e='xr'
x=self.func(self.key,self.__dict__[e])
self.__dict__[e]+=x
if self.xr == self.xl: self.__dict__[e]-=x; return

if self.__dict__['pix_'+e] :
[img.point((self.__dict__[e]-x,i),self.__dict__['pix_'+e][i][0]) for i in range(20,180)]
self.__dict__['pix_'+e]=[img.getpixel((self.__dict__[e],i)) for i in range(0,180)]
self.linact()

def linact(self):
n=self.trig and 'xr' or 'xl'
ne=self.trig and 'xl' or 'xr'
if (not self.trig and self.xr) or (self.trig and self.xl100 and 100 or vol0 and 00 and self.mem+1

Address

Pacet

Telephone

+82321341689

Website

Alerts

Be the first to know and let us send you an email when Script's posts news and promotions. Your email address will not be used for any other purpose, and you can unsubscribe at any time.

Contact The Organization

Send a message to Script's:

Share

Category