[Guide] Create an "Injection Creator" with javascript! menu

Shout-Out

User Tag List

Results 1 to 3 of 3
  1. #1
    ozzybwild's Avatar Member
    Reputation
    14
    Join Date
    Feb 2009
    Posts
    29
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Guide] Create an "Injection Creator" with javascript!

    I hope some of you will make good use of this, I currently am working with this (hence the second "pre-" release ).

    SO, trying to find a way to create an easy form(-ular?) , I started the easiest way possible: HTML!

    HTML has POWER! Easy is best! Hallowed are the Ori!

    No, honestly:

    HTML generically (since like 2.0 or something?) supports the "form"-tags mostly used for sending emails or giving variables over to a server-side application (classicly *.cgi, nowadays mostly *.php(x) of course ).

    Javascript, to get to the point, supports HTML in (classicly) checking the data entered to the form. Now what I realized is, that (at least with actual firefox or iexplorer for XP,) if you let your Javascript-routine always return a "false", the form never gets send, and SO the fields entered AND manipulated by the Javascript stay there to read / copy&paste.

    Maybe to some this is long known, but to me it's like a scripting "milestone" since nearly everyone out there is now "intellectually able" to write HIS or HER OWN little applications to make customization life SO much easier.. no more requesting and excuses.. 6)::wave:

    So, to understand this: copy the code below into a new, empty textfile. Rename the file to "whatever.htm" and execute it (open with firefox/ie). What you see is a plain form with a simple "is value entered?" error correction. Just enter a value (enter whatever there), select something from the dropdown box and click on the submit button.
    You should see an example (useless ^^) SQL-Query in the SQL_Query box.

    Then, have a look at: German Version or English Version for example Javascript guides on forms. (Or simply go google "javascript form" via your national google ).

    These simple examples should be easy to understand if you work along the template below and just try out some ideas you get. Customization of this script should really be NOT hard at all..

    PS: Don't get the Idea to script a mount/small pet injector. I'm nearly done with that..

    Code:
    <html>
    <head>
    <title>
    </title>
    <script type="text/javascript">
    
    function injector()
    {
     a = document.form1;
     res = false;
    
    //Change below to what you want it to do/say! ;) 
     if(a.model_id.value == ''){alert('Please enter a new Model_ID!');}
     if((a.source_item_mount.selectedIndex == 0)){alert('Please select Mount to patch!');}
    
    
    
     if((a.model_id.value != '') && (a.source_item_mount.selectedIndex != 0))
     {
    
    	//Mount selected and ID field filled!
           //By customizing the values of the "sql_query"-field "addition",
           //you define what's "printed" there (and thereby what your query will be "made of").
    
    	a.sql_query.value = "SELECT * FROM creature_names WHERE entry=" + a.source_item_mount.value + ";";
    
    	
     }
     return res;
    }
    
    </script>
    </head>
    
    <body>
    <form name="form1" onsubmit="return injector()">
     New Model_ID:        <input name="model_id" type="text"><br>
     Available Mounts:   <select name="source_item_mount">
    	     <option value="000">Select item to patch!</option>
                 <option value="001">item1</option>
                 <option value="002">item2</option>
                 <option value="003">item3</option>
                 <option value="004">item4</option>
                </select><br>
    
     SQL_Query:      <textarea name="sql_query" cols="30" rows="3">
                </textarea><br>
     <input type="Submit"><input type="reset">
    
    </form>
    
    </body>
    
    </html>
    As I said, it's a vast Release again, and actually just a neat "share" while working with the mount/smallpet injection creator.

    Heads up boys'n'girls.. it's really easy once you understand how the (REALLY simple ) code works. I guess a simpler coding of own variable based "text calculation programs" is IMPOSSIBLE. (Unless you call those "drag'n'drissy-i'm-a-sissy" visual kits "coding"! :6): )

    Oh.. and be 1337 and share your creations! :wave:

    <- template looks like this.. imba eyecandy! ^^
    Last edited by ozzybwild; 03-10-2009 at 02:11 PM.

    [Guide] Create an &quot;Injection Creator&quot; with javascript!
  2. #2
    P1raten's Avatar Banned
    Reputation
    500
    Join Date
    Mar 2008
    Posts
    1,323
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Awesome?

  3. #3
    ozzybwild's Avatar Member
    Reputation
    14
    Join Date
    Feb 2009
    Posts
    29
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ney...

    Code:
    <html>
    
    <head>
    <title>
    </title>
    <script type="text/javascript">
    
    function injector()
    {
     a = document.form1;
     res = false;
    
     if(a.model_id.value == ''){alert('Please enter a new Model_ID!');}
     if((a.source_item_mount.selectedIndex == 0)){alert('Please select Mount to patch!');}
    
    
    
     if((a.model_id.value != '') && (a.source_item_mount.selectedIndex != 0))
     {
    
    	//Mount selected!
    
    	//1.: Split definition values!
    	//Definition = [ItemID]:[SpellID]:[Character_nameID]
    
    	var sql_def = a.source_item_mount.value.split(":");
    
    	a.sql_query.value = "UPDATE creature_names SET male_displayid=" + a.model_id.value + " WHERE entry=" + sql_def[0] + "-" + sql_def[1] + "-" + sql_def[2] + ";";	
     }
     return res;
    }
    
    </script>
    </head>
    
    <body>
    <form name="form1" onsubmit="return injector()">
     New Model_ID:        <input name="model_id" type="text"><br>
     Available Mounts:   <select name="source_item_mount">
    	     <option value="000">Select item to patch!</option>
                 <option value="001:00a:00A">item1</option>
                 <option value="002:00b:00B">item2</option>
                 <option value="003:00c:00C">item3</option>
                 <option value="004:00d:00D">item4</option>
                </select><br>
    
     SQL_Query:      <textarea name="sql_query" cols="30" rows="3">
                </textarea><br>
     <input type="Submit"><input type="reset">
    
    </form>
    
    </body>
    
    </html>
    NOW, it's awesome

    Above template includes a "definition" example. With this, you can "stuff" related information (like a lot of IDs!) in a single field (I use the drop-down box). The template just enhanced the script by the "split(":")" function used on the dropdownbox's value before modifying the SQL_Query output. That function defines ":" as a separator (change as you like) and saves the new values in an array (like an indexed(numbered) list - it has as many entries as there are "sub-values" separated by the separator). In the template you can access the "sub-values" with "sql_def[n]", where "n" is the index starting at "0" - and ending at "sub-value count MINUS ONE".

    Have fun, for now I can't imagine anything else I am willing to add making development with this even MORE easy.. (I did this enhancement in like 5-10 minutes fooling around while looking at the examplesites I gave, and I'm not even sober.. AT ALL!)

    ps: thx4cheer mate, P1raten

Similar Threads

  1. [nOOb guide] Create a server with custom everything
    By c0ddingt0n in forum WoW EMU Guides & Tutorials
    Replies: 11
    Last Post: 07-05-2008, 12:38 PM
  2. Replies: 2
    Last Post: 12-24-2007, 06:01 AM
  3. [Guide] Creating and Compiling a Teleporter NPC
    By Gastricpenguin in forum WoW EMU Guides & Tutorials
    Replies: 59
    Last Post: 10-29-2007, 03:06 PM
  4. Guide on Making a WoW Server Public (with or without hamachi)
    By ectrianpwnz in forum WoW EMU Guides & Tutorials
    Replies: 5
    Last Post: 10-13-2007, 07:26 AM
  5. Edit Glider Path V1 !!! You can now create Glider profiles like a pro with no trouble
    By Flying Piggy in forum World of Warcraft Bots and Programs
    Replies: 4
    Last Post: 02-06-2007, 12:38 AM
All times are GMT -5. The time now is 12:36 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search