Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - hansiec

1
RPG Maker Scripts / XP Irrlicht
November 05, 2012, 01:10:10 pm
XP Irrlicht


Version: 1.0

Description:

This is a port from Irrlicht to Rpg Maker XP, just like what DemonFire did except mine is open source (not the dll though)

Features As of Now:
3D models (.md2, .obj, ect.) Any models that Irrlicht can support by default
Model Textures (.png, .bmp, ect.) Any Texture that Irrlicht can support by default
Custom BG color (No explanation needed really)
Model Transformation (scaling,rotation,transformation)


Notes:
For now the only help you get is that of which is exampled in the Scene_Irrlicht
I shall in the next release add camera viewing and 2D GUIs
Do not use unless you have some scripting knowledge, otherwise you'll get lost easily
Yes, I know a second screen pops-up (The one is the old game window and the other renders Irrlicht, I'll try to fix this so only 1 window pops up)

Finally:
You can vouch that this is mine for 2 reasons 1 the build of mine is very much different than DemonFire's and secondly I added a dll function which the sole purpose is to return my username (Hansiec)

Downloads:
#1.0#

Credits:
Hansiec -- Creator of the DLL/Ruby Scripts
Irrlicht -- Creator of Irrlicht and the model (with the texture) used for the example
DemonFire -- Of course for giving me the idea for using Irrlicht with RMXP
2
Programming / Scripting / Web / Need help with Direct3D
October 13, 2012, 04:42:15 pm
Alright, so I'm working on a dll that renders Direct3D for rmxp, but my problem is when I try rendering it doesn't render anything.

This is written in c++

/*
*  XP 3D dll main
*  By: Hansiec
*  YOU ARE NOT ALLOWED TO MODIFY THIS EXCEPT FOR SELF-PURPOSES OR BUG FIXING!
*  ~~~ You have been warned... (Self purposes meaning no re-distributions at all unless it's for a fix of a bug/improvements)
*/

#pragma comment (lib, "d3dx9.lib")

// Exclude rarely-used stuff from Windows headers
#define WIN32_LEAN_AND_MEAN       

// Windows Header Files:
#include <windows.h>
#include <windowsx.h>

// C++ RunTime Header Files
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>

// DirectX Header Files
#include <d3d9.h>
#include <d3dx9.h>
#include "dll.h"

#define export extern "C" __declspec(dllexport)

// Variables
HWND hWnd;
int dll_version = 0;
LPDIRECT3DDEVICE9 p_dx_Device;
LPDIRECT3D9 p_dx_Object;
LPDIRECT3DDEVICE9 p_Device;
// Some usefull functions for setup.
export void init(int i){
  // Sets the Window handle that you must get from XP.
  hWnd = (HWND) i;

// Initialize some Direct 3D variables
p_dx_Object = Direct3DCreate9(D3D_SDK_VERSION);
if (p_dx_Object == NULL)
{
     // Only display if we do not have DirectX
     MessageBox(hWnd,"DirectX Runtime library not installed!","3DXP Error in: init()",MB_OK);
}

// initialize more variables
D3DPRESENT_PARAMETERS dx_PresParams;

// Device creation
ZeroMemory( &dx_PresParams, sizeof(dx_PresParams) );
dx_PresParams.Windowed = TRUE;
dx_PresParams.SwapEffect = D3DSWAPEFFECT_DISCARD;
dx_PresParams.BackBufferFormat = D3DFMT_UNKNOWN;

p_dx_Object->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &dx_PresParams, &p_dx_Device);

if (FAILED(p_dx_Object->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &dx_PresParams, &p_dx_Device)))
{
     if (FAILED(p_dx_Object->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_REF, hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &dx_PresParams, &p_dx_Device)))
     {
         MessageBox(hWnd,"Failed to create even the reference device!","3DXP Error in: init()",MB_OK);
     }
}
// finally we set our device.
//p_Device = InitializeDevice(hWnd);
//p_Device = p_dx_Object->AddRef(hWnd);
}

// Returns the owner of the DLL (Just for checks of theft)
export char* get_owner(){
  return "Hansiec";
}

// Returns the Direct 3D SDK version
export int get_version(){
  return D3D_SDK_VERSION;
}

// Checks the XP3D dll version
export int check_version(int version){
  return (int) version >= dll_version;
}

// Renders a frame
export int render(){
   HRESULT hr;
   struct D3DVERTEX {float x, y, z, rhw; DWORD color;} vertices[3];
  vertices[0].x = 50;
  vertices[0].y = 50;
  vertices[0].z = 0;
  vertices[0].rhw = 1.0f;
  vertices[0].color = 0x00ff00;



  vertices[1].x = 250;
  vertices[1].y = 50;
  vertices[1].z = 0;
  vertices[1].rhw = 1.0f;
  vertices[1].color = 0x0000ff;



  vertices[2].x = 50;
  vertices[2].y = 250;
  vertices[2].z = 0;
  vertices[2].rhw = 1.0f;
  vertices[2].color = 0xff0000;
  LPDIRECT3DVERTEXBUFFER9 pVertexObject = NULL;
  void *pVertexBuffer = NULL;
  if(FAILED(p_dx_Device->CreateVertexBuffer(3*sizeof(D3DVERTEX), 0,
          D3DFVF_XYZRHW|D3DFVF_DIFFUSE, D3DPOOL_DEFAULT, &pVertexObject, NULL)))
   return(0);
   if(FAILED(pVertexObject->Lock(0, 3*sizeof(D3DVERTEX), &pVertexBuffer, 0)))
   return(0);
   memcpy(pVertexBuffer, vertices, 3*sizeof(D3DVERTEX));
   pVertexObject->Unlock();
   
  p_dx_Device->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
  p_dx_Device->BeginScene();
  p_dx_Device->SetStreamSource(0, pVertexObject, 0, sizeof(D3DVERTEX));
  p_dx_Device->SetFVF(D3DFVF_XYZRHW|D3DFVF_DIFFUSE);
  p_dx_Device->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 1);
  p_dx_Device->EndScene();
}



also, dll.h contains nothing of importance so this is not needed to post. (actually I think I can remove it since it serves no purpose at all.)
3
New Projects / [Game Maker 8 Pro] Castle Forge 3D
May 27, 2012, 04:35:54 pm
CASTLE FORGE



Intro:
Castle Forge is a minecraft classic (Yes another one....) like game I have decided to make with Game Maker Pro 8. It's graphics are not amazing yet but it's free and has got a few good things.

Gameplay:
The gameplay is mostly sandbox but I will be adding things such as sidequests you can do for the more rare items, each block has a custom 'rarity','mine time',and height it can appear on, grass only apears on the top 3 layers of the map while stone is anywhere under that.

Features:
-- 3D (yes I include this as 3D because not many games are)
-- Amazing "Random" maps (maps are made through a seed)
-- Shows current status of various things (current block/amount of that block/current block mining progress)
-- Pretty good (won't say amazing) random dungeons (again relies on the seed)
-- Custom Random seed
-- Custom Map size (currently small/medium/large but this will change to completely custom by choosing the x/y/z size from scratch)
Features which will be added:
-- Day/Night system
-- Zombies! (you just gotta love them)
-- Allies (Cpu's that goes killing enemies/giving you items)
-- better dungeon structures
-- water/lava blocks (yes these will be slightly difficult)
-- Health system (will be added before or with zombies)
-- Better saving/loading
-- Better menus (instead of the popups giving you 3 options.)

Screenshots/Videos:

Spoiler: ShowHide





















Credits:
Hansiec -- Most of work
Laruens (and whoever else worked on the block engine) -- Block Engine

HELP WANTED:
Show me proof of work if you wish to help.
Main things I need:
Sprites for living things (best way I can put this really)
Sprites for "objects" (trees/houses/structures) (these are made very weirdly so if you want to do this PM me and I'll give you a layout of how this works A.K.A image)
New Block Textures (self explanitory) (these must be 16x16 sized you can put them all in one image I don't mind seperating them myself.)
I otherwise need:
Scripting with the programming language GML (Game Maker Language)


Release:
Current release: Version 1.1 Beta
Note: The current version doesn't have all the current features they will be included in the next release!
Download here: http://sandbox.yoyogames.com/games/198969-castle-forge
4
INTRO

This script is used to generate random maps like minecraft's maps (not as good + it's 2d (of course))


CALL WITH: kfRandomMap(landscape,seed)
Features
Easy to use (in my opinion)
Customize-able landscapes (tiles/ratio)
Customize-able structures (tile,x/y)
Generation Progress Bar
Place events alongside of structures

Demo: http://www.mediafire.com/?36mwbvhh3skoczp

Credits
Hansiec - Maker of the script
Poe - Wraptile (THIS IS NEEDED OR YOU CAN'T USE THIS!)
SephirothSpawn - Event Spawner

Warnings
This script was ONLY TESTED WITH BLIZZ ABS! (should work with other systems as well but this is a warning)
When using Blizz Abs the movement permissions don't update (this isn't my fault....)
5
New Projects / Castle forge
May 05, 2012, 09:39:48 am
Intro:
_______________________________________________________________________________________________________________________
My first attempt at releasing a game with XP so I hope you enjoy it :D

Game Play:
_______________________________________________________________________________________________________________________
Much like Minecraft and this game: http://forum.chaos-project.com/index.php/topic,11339.0.html I have also generated a map editing game

Single player but you can share your maps you created with others. (I'll be setting up a chat system for people to chat with.)

Features:
_______________________________________________________________________________________________________________________
Day/Night system
Blizz ABS
Auto generating maps for endless linked maps (like minecraft again except completely blank) Saves work
A small gui to show you your current block/amount of it
Auto generating monsters at night
Mouse point tile drawing
Able to share your maps with other people.
recent log
enemies drop more resources
crafting

Screen shots/Videos:
______________________________________________________________________________________________________________________
http://www.youtube.com/watch?v=HRuBSTMfxg4&feature=youtu.be

video showing the basics

Known issues:
_______________________________________________________________________________________________________________________
Glitch when removing a tile a position 0/0
You don't reclaim tiles when deleting them


Release:
_______________________________________________________________________________________________________________________
Demo: http://www.mediafire.com/?zgty1aeneiy6616

Credits:
_______________________________________________________________________________________________________________________
Hansiec - creator/scripter/mapper
Wizered67 - inspiring me to make my own version of this/pointing me to wraptile
Blizzard - Blizz-ABS
Poe - wrap tile
Game_Guy - Item storage


I NEED SPRITERS FOR THIS PROJECT
DECIDED TO USE BLIZZ ABS!
6
Script Requests / 2 tile related scripts
May 04, 2012, 01:50:19 pm
Alright I'm no good with tiles but I need 2 scripts:

1. Auto tile converter
When editing tiles in-game (using $game_map.data[x,y,floor]=tile id) when an autotile it doesn't convert it into the correct pieces I got no clue how it works so if someone can point me to one it'll be helpful.

2. Tile viewer
In-game single tile viewer from the map's tileset (like showing tile #2 at position x/y in a small image somewhere on the screen)

Any help would be helpful : D
7
Script Troubleshooting / Mouse input help
March 26, 2012, 07:12:52 pm
Right so I got this mouse input script, it works fine UNTIL I try this:


def MouseOnChar(event)
  character = get_character(event)
  x=character.screen_x
  y=character.screen_y
  area1 = Input.mouse_in_area?(x-16, y-16, x, y)
  if Input.trigger?(Input::MOUSE_PRIMARY) and area1
    $game_variables[1] = event
    $game_map.need_refresh = true
    # Continue
    return true
  end
end


alright that's supposed to get the character's X/Y position on the map and let's you click them to change variable # 1 to it's event number my problem is it goes WAAAAAAAAAAAY off of position....

a picture is easier to show...



the black x is the area where the mouse is the red traingle things are the areas which it should be activated in nowhere else...

The mouse input script:


#=============================================================================
# *** AWorks Input Module: Mouse Plugin(AIM:M)
#=============================================================================
# Created by AWorks
# Version: 1.00
# Last Modification: 26/01/2009 (day/month/year)
# Compatible with RMXP & RMVX
#=============================================================================
#==== Description ====
# This script adds mouse input detecting proccess to the Input module.
#=============================================================================
#==== Requeriments ====
# * ALibrary (AWorks Library)
#   - Version: 1.03
# * AIM (AWorks Input Module)
#   - Version: 3.00
#=============================================================================
#==== Version History ====
# * Version 1.00
#   - Creation of the script
#=============================================================================
#==== Features ====
# * Configuration
#   - @mouse_double_click_time
#     Sets up the max amount of frames that may occur between the first and
#     second click of a double-click. If nil, it will be used computer default.
#   - @mouse_double_click_pix
#     Sets up the max area in pixels that may have the cursor coordinates
#     between the first click and the second click of a double-click. By default
#     is 4.
#   - @mouse_drag_pix
#     Sets up the amount of pixels the cursor has to move between the dragging
#     proccess starts. Its default is 4.
#
# * Input.mouse_doubleclick?([vk])
#   - Determines whether the key vk is being double clicked. Only works with
#     mouse keys. If vk is not given, it will be the mouse primary button.
#
# * Input.mouse_in_screen?
#   - Returns TRUE if the mouse cursor is on the game screen.
#
# * Input.mouse_pos
#   - Returns both X and Y cursor coordinates in an Array. If the cursor is not
#     over the game screen, their values are nil.
#
# * Input.mouse_x?
#   - Returns the X cursor coordinate of the game screen. If the cursor is not
#     over the game screen, it returns nil.
#
# * Input.mouse_y?
#   - Returns the Y cursor coordinate of the game screen. If the cursor is not
#     over the game screen, it returns  nil.
#
# * Input.mouse_dragging?
#   - Returns TRUE if the player is dragging.
#
# * Input.mouse_drag_rect?
#   - Returns the drag rectangle area in a Rect object.
#
# * Input.mouse_drag_coor?
#   - Returns the drag rectangle area in an Array.
#
# * Input.mouse_in_area?(x, y, width, height)
#   - Returns true if the cursor is over the given area.
#
# * Input.mouse_in_area?(rect)
#   - Returns true if the cursor is over the given rect area.
#
# * Input.mouse_visible=(flag)
#   - Shows or hides the cursor.
#
# * Input.mouse_visible?
#   - Returns TRUE if the cursor is visible.
#=============================================================================
#==== Notes ====
# * There is some difference between the mouse left and right button and the
#   mouse primary and second button. The first ones refers always to the
#   physical left and right keys of a mouse, but the second ones may vary
#   depending on the user's settings. If the Swap Buttons Flag is activated
#   the primary and secondary buttons are swapped, but the left and right
#   buttons stay the same. This script detects this Swap Buttons Flag, and
#   assigns the real values to the MOUSE_PRIMARY and MOUSE_SECONDARY constants,
#   which belongs to the Input module. So, insteand of using Keys::MOUSE_LEFT
#   and Keys::MOUSE_RIGHT, use Input::MOUSE_PRIMARY and Input::MOUSE_SECONDARY
#   respectively.
#=============================================================================

#=============================================================================
# ** Module Input
#=============================================================================
module Input
  #---------------------------------------------------------------------------
  # * Configuration
  #---------------------------------------------------------------------------
  @mouse_double_click_time = nil
  @mouse_double_click_pix = 4
  @mouse_drag_pix = 4
  #---------------------------------------------------------------------------
  # * Variables declaration
  #---------------------------------------------------------------------------
  MOUSE_SWAP_BUTTONS = AWorks.get_mouse_swap_buttons_flag
  MOUSE_PRIMARY = 1 + MOUSE_SWAP_BUTTONS
  MOUSE_SECONDARY = 2 - MOUSE_SWAP_BUTTONS
  @mouse_pos = [0, 0]
  @mouse_drag = [false, 0, 0, 0, 0, 0, 0]
  @mouse_doubleclick = [nil, false, false, false, false, false]
  if @mouse_double_click_time.nil?
    @mouse_double_click_time = Graphics.frame_rate *
    (AWorks::API::GetDoubleClickTime.call / 10) / 100
  end
  #---------------------------------------------------------------------------
  # * Initialize Mouse Input
  #---------------------------------------------------------------------------
  AWorks::API::InputMouseIni.call(@mouse_pos.object_id, @mouse_drag.object_id,
    @mouse_doubleclick.object_id)
  AWorks::API::InputMouseConfig.call(MOUSE_SWAP_BUTTONS, @mouse_drag_pix,
    @mouse_double_click_time, @mouse_double_click_pix)
  #---------------------------------------------------------------------------
  # * Updates mouse configuration
  #---------------------------------------------------------------------------
  def Input.update_mouse_configuration
    @mouse_double_click_time = Graphics.frame_rate *
      (AWorks::API::GetDoubleClickTime.call / 10) / 100
    AWorks::API::InputMouseConfig.call(MOUSE_SWAP_BUTTONS, @mouse_drag_pix,
    @mouse_double_click_time, @mouse_double_click_pix)
  end
  #---------------------------------------------------------------------------
  # * Mouse double click?
  #---------------------------------------------------------------------------
  def Input.mouse_doubleclick?(vk = MOUSE_PRIMARY)
    @mouse_doubleclick[vk]
  end
  #---------------------------------------------------------------------------
  # * Mouse in screen?
  #---------------------------------------------------------------------------
  def Input.mouse_in_screen?
    !@mouse_pos[0].nil?
  end
  #---------------------------------------------------------------------------
  # * Get Mouse Pos
  #---------------------------------------------------------------------------
  def Input.mouse_pos
    @mouse_pos
  end
  #---------------------------------------------------------------------------
  # * Mouse X Coordinate
  #---------------------------------------------------------------------------
  def Input.mouse_x?
    @mouse_pos[0]
  end
  #---------------------------------------------------------------------------
  # * Mouse Y Coordinate
  #---------------------------------------------------------------------------
  def Input.mouse_y?
    @mouse_pos[1]
  end
  #---------------------------------------------------------------------------
  # * Mouse Dragging?
  #---------------------------------------------------------------------------
  def Input.mouse_dragging?
    @mouse_drag[0].nil? ? false : @mouse_drag[0]
  end
  #---------------------------------------------------------------------------
  # * Mouse Drag Rect
  #---------------------------------------------------------------------------
  def Input.mouse_drag_rect?
    Rect.new(*@mouse_drag[3, 4]) if @mouse_drag[0]
  end
  #---------------------------------------------------------------------------
  # * Mouse Drag Coordinates
  #---------------------------------------------------------------------------
  def Input.mouse_drag_coor?
    @mouse_drag[3, 4] if @mouse_drag[0]
  end
  #---------------------------------------------------------------------------
  # * Mouse in Area?
  #---------------------------------------------------------------------------
  def Input.mouse_in_area?(*args)
    return false if @mouse_pos[0].nil?
    if args[0].is_a?(Rect)
      @mouse_pos[0] >= args[0].x and
      @mouse_pos[1] >= args[0].y and
      @mouse_pos[0] <= args[0].x + args[0].width and
      @mouse_pos[1] <= args[0].y + args[0].height
    else
      @mouse_pos[0] >= args[0] and
      @mouse_pos[1] >= args[1] and
      @mouse_pos[0] <= args[0] + args[2] and
      @mouse_pos[1] <= args[1] + args[3]
    end
  end
  #---------------------------------------------------------------------------
  # * Change mouse visibility
  #---------------------------------------------------------------------------
  def Input.mouse_visible=(flag)
    val, result = flag ? 1 : 0, nil
    until result == (val - 1)
      result = AWorks::API::ShowCursor.call(val)
    end
  end
  #---------------------------------------------------------------------------
  # * Mouse visible?
  #---------------------------------------------------------------------------
  def Input.mouse_visible?
    AWorks::API::ShowCursor.call(1)
    AWorks::API::ShowCursor.call(0) >= 0
  end
end



any help here?
8
Ok so an example is just better to use:

let's say I have an app(myapp.exe)(placed into /apps)
and I use an FTP to upload it to mydomain.com
and I type in 'mydomain.com/apps/myapp.exe' will it load my application or will it result in something else?
9
Script Troubleshooting / MySQL Help please!
February 06, 2012, 04:57:56 pm
Right so I got this public mySQL script, and I don't know how to use it....

In anycase I didn't find anyhing like this I know there is a commands list but still.....

Spoiler: ShowHide
#===============================================================================
#                               Net::Mysql
#    29-05-2010           www.rpgmakervx-fr.com                 Rgss1&2  v.1
#                                par berka                  
#-------------------------------------------------------------------------------
# This script is free to use. Do not post anywhere without my permission.
# Credits needed.
#-------------------------------------------------------------------------------
# Warning: if your game is cracked and decrypted, your mysql login will be
# available!
# Do not use with a database containing personal information.
# Your mysql host should accept external connections.
# Check with it for remote SSH access to your database.
#-------------------------------------------------------------------------------
# This script allows interractions with a mysql database directly in the game.
# It requires a file "libmysql.dll" in the game folder.
#-------------------------------------------------------------------------------
# Attention: en cas de décryptage de votre jeu, vos identifiants mysql seront
# accessibles!
# Ne pas utiliser de base de donnée contenant des informations personnelles.
# Votre hébergeur Mysql doit accepter les connexions mysql externes.
# Vérifiez auprès de lui que vous avec un accès distant SSH à votre base de
# données.
#-------------------------------------------------------------------------------
# Ce script permet d'interragir avec une base de données mysql directement via
# le jeu.
# Il nécessite un fichier "libmysql.dll" à placer dans le dossier du jeu.
#-------------------------------------------------------------------------------
# md5() support
# Mysql functions:
#   - Net::Mysql.new([host,user,pass,base,port]) : return : mysql connection handle
#   - @mysql.close : return : bool
#   - @mysql.list_tables([filter]) : return : ["table1", "table2"]
#   - @mysql.select_db(base_name) : return : true if the db exists or false
#   - @mysql.query("query",ret=false) : return : if ret = true : rows else result handle
#   - @mysql.get_fields([handle result]) : return : ["field1", "field2"]
#   - @mysql.get_rows([handle result]) : return : [["l1 row1", "l1 row2"], ["l2 row1", "l2 row2"]]
#   - @mysql.fetch_assoc : return : {"field" => ["row1", "row2"] }
#   - @mysql.num_rows([handle result]) : return : integer
# Html functions:
#   - "string".to_ruby : return : true, false, nil, Integer, Float, self, etc.
#   - "<berka>".htmlspecialchars : return : "&lr;berka&gt;"
#   - "<berka>".urlencode : return : "%3Cberka%3E"
#   - "%3Cberka%3E".urldecode : return : "<berka>"
#-------------------------------------------------------------------------------
# SQL queries samples
# "SELECT * FROM table"
# "INSERT INTO table (fields) VALUES (values)"
# "INSERT INTO table SET field = value WHERE field = value"
# "UPDATE table SET field = value WHERE field = value"
#-------------------------------------------------------------------------------
# Sample :
# @mysql = Net::Mysql.new
# @mysql.query("SELECT * FROM `members`)
# res = @mysql.fetch_assoc
# => {:id=>["1","2"], :nom=>["berka","rgss"], :age=>["19",""]}
#======================================================================

module Berka
 module Mysql
   Host = "127.0.0.1"                         # mysql server(local : 127.0.0.1)
   User = ""                                  # mysql user
   Pass = ""                                  # mysql password
   Base = "rgss"                              # base name
   Port = 3306                                # server port (default: 3306)
   Err_Con = "Mysql:\nUnable to connect to the database"
   Err_Req = "Mysql:\nUnable to send the query"
 end

 module Html
   Spec_Char=["$","&","+",",","/",";",":","=","@","?"," ","<",">","#","%","{",
              "}","|","\\","^","~","[","]","`"]
 end
end



class Numeric
 def copymem(len)
   # move memory to convert c structs to ruby objects
   Win32API.new("kernel32", "RtlMoveMemory", "ppl", "").call(buf="\0"*len,self,len);buf
 end
end



class String
 def to_ruby
   # detect if the string is a md5 hash
   return self if self=~/^[a-f0-9]{32}$/
   # converts syntax of a string to ruby controls
   eval(self)rescue self
 end

 def htmlspecialchars
   # converts special chars to html compatibles chars (ASCII)
   {"&"=>"&amp;",'"'=>"&quot;","'"=>"'","<"=>"&lr;",">"=>"&gt;"}.each_pair{|k,v|self.gsub!(k,v)}
   self
 end

 def urlencode
   # converts special char of url
   o="";self.scan(/./).each{|c|c="%"+c.unpack('H*')[0]if Berka::Html::Spec_Char.include?(c);o<<c};o
 end

 def urldecode
   # converts encoded special char of url to normal chars
   self.gsub!(/\%(\w\w)/){|c|c.gsub!("%","").hex.chr}
 end
end



module Net
 class Mysql
   MI=Win32API.new("libmysql.dll","mysql_init","l","l")
   MC=Win32API.new("libmysql.dll","mysql_close","l","l")
   MQ=Win32API.new("libmysql.dll","mysql_query","lp","l")
   MLT=Win32API.new("libmysql.dll","mysql_list_tables","lp","l")
   MFL=Win32API.new("libmysql.dll","mysql_fetch_lengths","p","l")
   MFR=Win32API.new("libmysql.dll","mysql_fetch_row","p","l")
   MNF=Win32API.new("libmysql.dll","mysql_num_fields","p","l")
   MFC=Win32API.new("libmysql.dll","mysql_field_count","p","l")
   MSR=Win32API.new("libmysql.dll","mysql_store_result","l","l")
   MRC=Win32API.new("libmysql.dll","mysql_real_connect","lpppplpl","l")
   MNR=Win32API.new("libmysql.dll","mysql_num_rows","p","l")
   MFFD=Win32API.new("libmysql.dll","mysql_fetch_field_direct","pi","l")
   MFRE=Win32API.new("libmysql.dll","mysql_free_result","p","l")
   MSDB=Win32API.new("libmysql.dll","mysql_select_db","p","l")
   attr_reader :handle

   def initialize(h=Berka::Mysql::Host,u=Berka::Mysql::User,p=Berka::Mysql::Pass,
                  b=Berka::Mysql::Base,po=Berka::Mysql::Port)
     # @handle : handle of mysql initialization
     @handle=MI.call(0)
     # establishes the mysql connection
     (print(Berka::Mysql::Err_Con))if MRC.call(@handle,h,u,p,b,po,nil,0)==0
     # returns: handle
     @handle
   end

   def close
     # closes the current connection
     MC.call(@handle)
   end

   def select_db(base)
     # selects a current database
     MSDB.call(base)==true
   end

   def list_tables(m="")
     # lists tables request -> fetch the result -> to ruby string
     l=MFR.call(MLT.call(@my,m)).copymem(1024)
     # splits the string to array -> list of tables
     l.scan(/\t(\w+)\0/).flatten
   end

   def query(req,ret=false)
     # sends the query (msg error)
     (return print(Berka::Mysql::Err_Req+req))if !MQ.call(@handle,req)
     # previous results are released
     MFRE.call(@result)if @result
     # gets the results from the query -> c struct handle
     @result=MSR.call(@handle)
     ret ? get_rows(@result) : @result
   end

   # Proc: gets the name of the field (cstruct) -> to ruby string of handles -> to ruby string
   # returns the fieldname or nil if the field is not found.
   ReadField=Proc.new{|r,i,of|MFFD.call(r,i).copymem(1024).unpack("iissi")[0].copymem(of).delete!("\0")}

   def get_fields(res=nil)
     # if a result handle is provided
     r=res.nil? ? @result : res
     # gets the number of fields, offset: 8bytes-2 (cf. loop)
     nf,ch,of=MFC.call(@handle),[],6
     # each field: if the fieldname is not found: increase the offset of bytes.
     nf.times{|i|a=ReadField.call(r,i,of+=2)until a
       # add to the fields array
       ch<<a
       # reinitialize the offset for the next iteration
       of=6}
     # returns an array of fields
     ch
   end

   def get_rows(res=nil)
     # if a result handle is provided
     r=res.nil? ? @result : res
     # nr: number of rows, nf: number of fields
     nr,nf,en=MNR.call(r),MNF.call(r),[]
     # each row:
     nr.times{|i|
      # gets each row: c struct -> to ruby string -> to array (handles)
      c=MFR.call(r).copymem(4).unpack("i")[0]
      # gets each field length: c struct -> to ruby string -> to array (handles)
      tf=MFL.call(r).copymem(4*nf).unpack("i*")
      # size of field: offset of each field
      sf=tf.inject(0){|n,i|n+i}
      # handle of row -> to string (offset) -> to array
      en<<c.copymem(sf+nf).split("\0")
      }
      # returns each row as an array
     en
   end

   def num_rows(res=nil)
     # if a result handle is provided
     r=res.nil? ? @result : res
     # returns: number of rows
     MNR.call(r)
   end

   def fetch_assoc(to_ruby=false)
     # gets rows and fields
     h,f,r={},get_fields,get_rows
     # each field: read the rows and store them to an hash : h[:field]=[rows]
     # rows are converted to ruby objects if to_ruby == true
     f.each_with_index{|fi,i|t=[];r.each{|l|t<<l[i]};h[fi.to_sym]=(to_ruby ? t.map!{|o|o.to_ruby if o} : t)}
     h
   end
 end
end


10
So I'm just making sure this works with normal XP projects cause I'm using one that can do this


File.open(filenamehere,"wb"){|f|
       f.write("Hello")
       f.write("hi")
       f.write("Test")
       f.write("bye")
       }

File.open(filenamehere,"rb"){|f|
      hello=f.read(5)
       hi=f.read(2)
      test= f.read(4)
       bye=f.read(3)
       }


Would that work?
11
Right I tried downloading it (yes it works) but I got no admin rights to remove the N Titles error, Is there another way to go straight to the Trial screen (where it shows you to enter product key), anyways that would be helpful. (I'm not asking for a crack just asking if there is another way)