Mostrar Mensajes

Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.

Mensajes - Wadk

706
Preguntas y respuestas / Re: encriptar archivos .ini
Marzo 03, 2010, 05:37:18 PM
La segunda descarga que puso Hackware la hice yo hace mucho tiempo y no funciona correctamente a veces... me disculpo por eso.

Ac? te dejo un script que te va a servir:
/*
**********************************************
************File Encryption System************
**********Written by: Kevin Haroldsen*********
**********************************************

Use this to encrypt/decrypt a file using XOR encryption.
It can be used to prevent editing of save files, or for other things.


Arguments:

The First Argument is the file you want to encrypt. Use a full path.
Make sure it is a string.

The Second Argument is the encryption key. It must be a string.
It can be as long as you want. Longer is more secure.


How it works:
The script generates a key based on the key you provide and the game id.
It then goes through the file and encrypts each byte using xor encryption,
rotating through the key. By rotating through the key, two identical letters next
to each other will not be look the same when encrypted. Sometimes the file is encrypted
enough that it is interpreted as Japanese in notepad- seeing it as Unicode.


How XOR encryption works:

XOR is a logic gate. The are 8 logic gates-AND,OR,XOR,YES,NAND,NOR,NXOR,and NOT.

When you enter values into a logic gate, it returns a value. All return either 0 or 1.
0 or 1 can mean No or Yes, False or True, or some others.

XOR generally allows you to input two values. If those values are the same, it will output 0.
Otherwise it will output 1.

Here is a truth table for XOR:
____________________
|Input1|Input2|Output|
|______|______|______|
|   0  |   0  |   0  |
|______|______|______|
|   1  |   0  |   1  |
|______|______|______|
|   0  |   1  |   1  |
|______|______|______|
|   1  |   1  |   0  |
|______|______|______|

This is simple boolean XOR.

Binary XOR uses boolean XOR to edit its values. With binary xor, it's almost like it's an operand like
addition or multiplication.

First of all, binary is a base 2 number system only using 0 and 1. It is what computers use.
Counting from 0 from 5 is
0
1
10
11
100
101
This is the binary system. With computers, a bit is a 0 or a 1. a byte is a group of 8 bits.

Binary XOR edits a whole byte of data.
The number 106 is 01101010
The number 203 is 11001011

So... 106 xor 203 is:

    0   1   1   0   1   0   1   0
    |   |   |   |   |   |   |   |
   \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
xor 1   1   0   0   1   0   1   1
    -------------------------------
    1   0   1   0   0   0   0   1
   
10100001 is 161.
So, 106 xor 203 is 161.

Each letter or number in a text file is a byte. For example, the letter Q is 1010001.
So if you xor 1010001 (Q)  with 1001011 (K), you get 11010, which is a right arrow mark.
Now if you xor 11010 with 1001011 (K), you get 1010001, which is Q. So, you can encrypt and decrypt with a key.
   



NOTE:
Files encrypted with this will only be correctly decrypted with the same game- or at least with the
same game id.

Written January 6th 2010
*/

//define all variables
var file,read,keypos,key;

if !file_exists(argument0) then return (-1);

//define all variables.
keypos=0;
key=argument1
read=0
file=0

keypos=0;//make sure you are at the beginning of the key.

file=file_bin_open(argument0,2);//open the file, using basic binary functions

file_bin_seek(file,0);//make sure you are at the start of the file

//This is where you actually encrypt the file. Notice the actual encryption is only a few lines long.
repeat(file_bin_size(file))
{
    read=file_bin_read_byte(file);//read the chosen byte. Doing so will also advance to the next byte.
   
    file_bin_seek(file,file_bin_position(file)-1);//go to the byte before, returning to the byte that you just read.
   
    file_bin_write_byte(file,read ^ ord(string_char_at(key,keypos)));//write the encrypted byte where a byte was previously.It will advance to the next byte
    keypos+=1;//go to the next character in the key to encrypt with.
    if keypos>string_length(key) then keypos=1;
};

file_bin_close(file);//close the binary file when finished.

return (1);//returns 1 to confirm it worked.

El primer argumento es el nombre del archivo a encriptar y el segundo un "password". Para decriptar el archivo s?lo ten?s que usar la funci?n otra vez con el mismo password. Dale cr?dito al creador, Kevin Haroldsen.
Tambi?n en el script se explica c?mo funciona exactamente la encripci?n.
708
?Los inis? Claro, la extensi?n de un archivo no le cambia nada internamente, pero se supone que los inis son para tener todo mas ordenado, y para ser usados con las funciones espec?ficas para inis, como ini_open.
En un ini tendr?as esto por ejemplo:
[puntuacion_facil]
1=100
1n=Pablo
2=80
2n=Jose
3=60
3n=Pedro
[puntuacion_dificil]
1=140
1n=Maxi
2=120
2n=Maria
3=100
3n=Pablo

y si quer?s leer nada m?s las puntuaciones de la secci?n dificil, es f?cil hacerlo con las funciones para inis.
Pero no es muy recomendable usar inis para puntuaciones porque pueden ser editados f?cilmente. M?s que nada se usan para la configuraci?n del juego.
709
Cita de: pucara en Marzo 02, 2010, 08:42:20 PM
CitarLo que uno pueda hacerlo s?lo, deber?a hacerlo s?lo. No hay que llenar el foro de preguntas simples que se podr?an responder mirando el manual,
Que yo sepa, no creo que yo sea un usuario que "llena el foro" de preguntas simples.
Nunca dije eso (y "llenar el foro" es claramente una exageraci?n).

Cuando habl? del manual traducido me refer?a a esto: http://www.comunidadgm.org/manual_GM/Index.php

Tu respuesta a mi post me dio a entender que no le?ste el link que te d?, si lo hiciste y no te sirvi?, lo hubieras dicho.

Citar
Y si no te parece adecuada la pregunta, no contestes ya que nadie te obliga. Pero no saltes tratando a los dem?s como mocosos irresponsables que no leen el manual. Porque sencillamente NO acepto que lo hagas de esa forma.
Nunca dije que no me pareciera adecuada, y nunca trat? a nadie como "mocoso irresponsable que no lee el manual", simplemente dije "Checa el manual". No veo mucho parecido entre esas dos cosas.
710
Mi c?digo siempre obtiene un poste a usar, porque s?lo busca entre los que est?n en el piso. El tuyo no se ejecuta si el poste m?s cercano no est? en el piso. Si lo que quer?s es eso, entonces us? el tuyo que seguro es m?s r?pido y menos complicado.
711
Cita de: pucara en Marzo 02, 2010, 10:34:53 AM
Cita de: Wadk en Marzo 02, 2010, 01:27:53 AM
Checa el manual.

El foro que yo sepa est? para preguntar, si, seg?n tu criterio, hay que hacerlo todo solo, ?sto no tendr?a raz?n de ser.
A ver si aprendemos que un ejemplo vale m?s que mil manuales.
Lo que uno pueda hacerlo s?lo, deber?a hacerlo s?lo. No hay que llenar el foro de preguntas simples que se podr?an responder mirando el manual, que tambi?n, para algo est?, para algo lo hicieron, y para algo la comunidad se tom? la molestia de traducirlo y hostearlo (hace ya bastante tiempo).

?No te qued? claro como se usan los archivos INI despu?s de leer el manual? Yo recuerdo perfectamente que aprend? a usarlos s?lo leyendo el manual, pero si algo no te queda claro, ah? ven?s y pregunt?s.
712
S?, s? es lo que buscabas >:(. XD
Te dejo un ejemplo adjunto.
Modific?s la vida con arriba y abajo.
713
As?:
i=0;
j[0]=0;
with(poste){
if!(esta_en_el_piso){j[i]=id;
instance_deactivate_object(id);
i+=1;
}
}
k=i;
poste_var=instance_nearest(x,y,poste);
for(i=0;i<k;i+=1){instance_activate_object(j[i]);}

listo=!(poste.x-x=0);

if listo=false
{
if (poste.x)-x>=-25 and (poste.x)-x<=0
  {
  if keyboard_check(vk_up) and place_meeting(x,y+1,piso)
   x=max(x-5,poste.x);
  }
 
if (poste.x)-x<=25 and (poste.x)-x>=0
  {
  if keyboard_check(vk_up) and place_meeting(x,y+1,piso)
   x=min(x+5,poste.x);
  }
}

Cuidado porque si el c?digo se ejecuta y no hay ning?n poste en la room podr?a tirar error. Y fijate en cambiar donde dice "esta_en_el_piso" por una funci?n o variable que indique si el poste est? en el piso.
714
Creo que con draw_sprite_part se puede, busc? en el manual.
716
Pod?s desactivar todos los postes que no est?n en contacto con el piso antes de ejecutar el c?digo y activarlos despu?s.
717
Bueh, te dejo una soluci?n un poco m?s corta:
view_xview=min(view_xview,room_width-view_hview-640);
Pod?s poner el c?digo en un if para que los 640 pixeles se puedan ver luego (cuando actives una variable o algo).
Si no te funciona bien intent? ponerlo en End Step o en Draw.
718
Preguntas y respuestas / Re: acercarse a un a objeto
Marzo 01, 2010, 05:40:13 AM
Pon? al principio:
poste_var=instance_nearest(x,y,poste);
y despu?s reemplaz? la palabra "poste" por "poste_var" en el resto del c?digo.
719
Preguntas y respuestas / Re: acercarse a un a objeto
Marzo 01, 2010, 02:42:42 AM
Prob? as?:
listo=!(poste.x-x=0);

if listo=false
{
if (poste.x)-x>=-25 and (poste.x)-x<=0
  {
  if keyboard_check(vk_up) and place_meeting(x,y+1,piso)
   x=max(x-5,poste.x);
  }
 
if (poste.x)-x<=25 and (poste.x)-x>=0
  {
  if keyboard_check(vk_up) and place_meeting(x,y+1,piso)
   x=min(x+5,poste.x);
  }
}
720
Preguntas y respuestas / Re: acercarse a un a objeto
Febrero 28, 2010, 11:54:33 PM
Debe ser por el origen del sprite del poste. Intent? con poste.x-10 o algo as? hasta que quede bien.

Por cierto, las primeras 4 l?neas de tu c?digo se pueden redondear a lo siguiente:
listo=!(poste.x-x=0);
prob? vas a ver que hace exactamente lo mismo.