Al-Santoro
New Member
- Jan 20, 2011
- 29
- 5
Introduction:
Right, I've never made a little tutorial about "C# Coding" before, but this is a little simple tutorial for the ones who had trouble with C#. Now, let's start?
Finding the Coding Location
Before doing anything, you must first download Microsoft C#.
--- [Link will be posted here, after I found the site]. ---
Now, you'll need to start off with a little basic Emulator, I recommend using Rasta's for a head start. After you've done that, open up the files and click on "Holograph Emulator.csproj."
After you've open that, go to Source >> Virtual >> Users >> virtualuser.cs.
The Basics
Now, if you like being very organized with your codings, I suggest doing this:
This is used to organize codes, so it won't be too messy..
Now, let's say that we're doing a drunk command, we'll need to first start off doing this:
Right, now if you would like to add some effect into it, such as losing HP & Credits, you'll need to add this:
Add this code right after you've named your code with case "CODEHERE":
Now, it's time for the tricky part. [For all of you, of course]. Since some of you want effects into your command, add this part right under the following snippet I just posted.
So, your outcome should be:
Hold on, you're not finished first, you'll have to add at least some text in it, if you don't then, skip this step.. [Recommended not to, so it wouldn't confuse you].
If you want, you could also make the user lose credits! It's simple, just add this in:
Now, if you want your user to say something, you may wanna add this..
If you want the user to shout, you may wanna add this then:
If you want the user to whisper to themself, add this: [This is different]:
Now, if you'd like to add a mission to it, then add this:
Now, in order for the mission to be shown, add this:
It's now time to end the code. Input this:
Now, let's put this all together.
This is the complete tutorial of how to add an easy command such as this. If you want, you could review other commands and learn from that. ;]
Right, I've never made a little tutorial about "C# Coding" before, but this is a little simple tutorial for the ones who had trouble with C#. Now, let's start?
Finding the Coding Location
Before doing anything, you must first download Microsoft C#.
--- [Link will be posted here, after I found the site]. ---
Now, you'll need to start off with a little basic Emulator, I recommend using Rasta's for a head start. After you've done that, open up the files and click on "Holograph Emulator.csproj."
After you've open that, go to Source >> Virtual >> Users >> virtualuser.cs.
The Basics
Now, if you like being very organized with your codings, I suggest doing this:
Code:
#region :<code name here>
Now, let's say that we're doing a drunk command, we'll need to first start off doing this:
Code:
#region :drunk // For Organization.
case "drunk": // You need this part in order to name the code, of course.
case "drinking": // You can give it more names if you want.
Right, now if you would like to add some effect into it, such as losing HP & Credits, you'll need to add this:
Code:
{
using(DatabaseClient dbClient = Eucalypt.dbManager.GetClient())
{
Now, it's time for the tricky part. [For all of you, of course]. Since some of you want effects into your command, add this part right under the following snippet I just posted.
Code:
dbClient.runQuery("UPDATE user SET health = health = -'[B]INPUT ANY HP YOU WANT TO BE TAKEN AWAY HERE[/B]' WHERE name = '" + _Username + "'");
So, your outcome should be:
Code:
#region :drunk
case "drunk":
case "drinking":
{
using(DatabaseClient dbClient = Eucalypt.dbManager.GetClient())
{
dbClient.runQuery("UPDATE user SET health = health = '25' WHERE name =
'" + _Username + "'");
Hold on, you're not finished first, you'll have to add at least some text in it, if you don't then, skip this step.. [Recommended not to, so it wouldn't confuse you].
If you want, you could also make the user lose credits! It's simple, just add this in:
Code:
dbClient.runQuery("UPDATE user SET credits = credits = '[B]THE AMOUNT OF CREDITS YOU WANT THE USER TO LOSE HERE[/B]' WHERE name = '" + _Username + "'");
Now, if you want your user to say something, you may wanna add this..
Code:
Room.sendSaying(roomUser, "TEXT HERE");
Code:
Room.sendShouting(roomUser, "TEXT HERE");
Code:
Room.sendWhisper(roomUser, _Username, "TEXT HERE!");
Code:
_Mission = "YOUR MISSION HERE.";
Code:
refreshAppearance( false, true, true);
It's now time to end the code. Input this:
Code:
}
}
break;
#endregion
Now, let's put this all together.
Code:
#region :drunk
case "drunk":
case "drinking":
{
using(DatabaseClient dbClient = Eucalypt.dbManager.GetClient())
{
dbClient.runQuery("UPDATE user SET health = health = - '25' WHERE name =
'" + _Username + "'");
dbClient.runQuery("UPDATE user SET credits = credits = - '50' WHERE name = '" + _Username + "'");
Room.sendSaying(roomUser, "*Opens up a can of beer and gets drunk*");
sendData("BK" + "You're now drunk!"); [B]//Forgot to add this, this is for the little popup message that you could add. (Optional).[/B]
_Mission = "[Drunk] This user is drinking to much beer.";
refreshAppearance( false, true, true);
}
}
break;
#endregion
This is the complete tutorial of how to add an easy command such as this. If you want, you could review other commands and learn from that. ;]