|
||
|
|||||||
| Script Support Get support for modifying RunUO Scripts, or writing your own! |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Forum Expert
|
Ok, i was just curios and needed some help on what i can do with consoles!
Well i figured out how to make the console write lines: Code:
console.writeline ("text");
preferebley make it so i can ask a question and then a random anser comes up... Also how do i let the user write a line in for an answer?? If i knew this itd solve my problem hehe |
|
|
|
|
|
#2 (permalink) | |
|
Forum Expert
|
Quote:
roadmaster |
|
|
|
|
|
|
#5 (permalink) |
|
Forum Expert
|
what i mean by this is:
Code:
using System;
namespace EightBall
{
class MainClass
{
public static void Main(string[] args)
{
Console.WriteLine ("what is your question");
Console.ReadLine();
Console.get (answer);
}
}
}
Code:
Console.WriteLine ("what is your question");
Console.ReadLine();
get (answer);
|
|
|
|
|
|
#7 (permalink) |
|
Moderate
Join Date: Nov 2002
Location: USA
Posts: 6,598
|
Only the Admin will ever see the Console. It will only display on the pc that is actually running the server, not on client computers.
__________________
David Forum Moderator The RunUO.com Forum Moderator Team Forum Rules and Guidelines RunUO Forum Search Engine Download RunUO 2.0 RC2 |
|
|
|
|
|
#8 (permalink) |
|
Forum Expert
|
lol, well i am sorry but this is my first time trying to code an actuall program... so I just go by what makes just a little sense...
when i say Console.get (answer); i am saying the console should Write the answer on a line just like ud say Console.WriteLine("text"); |
|
|
|
|
|
#9 (permalink) |
|
Moderate
Join Date: Nov 2002
Location: USA
Posts: 6,598
|
Code:
string answer = Console.ReadLine();
__________________
David Forum Moderator The RunUO.com Forum Moderator Team Forum Rules and Guidelines RunUO Forum Search Engine Download RunUO 2.0 RC2 |
|
|
|
|
|
#11 (permalink) |
|
Forum Expert
|
thank you david and sorry phantom... i would have tested that if i was there
![]() any ways david as for CONSOLES uhm this script isnt for ruo hehe its just a program. i was told get good @ C then do RUO so thats what im trying to accomplish... and i wanted this to be my first program |
|
|
|
|
|
#15 (permalink) |
|
Forum Expert
|
And my point, he obviously meant C# instead of C. He wouldn't be writing code such as that if he were learning C, you know, after all, not a line of that code that he wrote would work in a C program.
On the other side, if he is trying to learn C and not C#, I agree, long ways off. ![]() |
|
|
|
|
|
#17 (permalink) |
|
Moderate
Join Date: Nov 2002
Location: USA
Posts: 6,598
|
The point being he is trying to learn. Phantom, isn't that what you get worked up about others not doing?
Storm ask your questions, if you get flamed report the post and I will take a look. (And no, not the same at all really. Most say C# is closer to java that it is to C, I never learned java though...)
__________________
David Forum Moderator The RunUO.com Forum Moderator Team Forum Rules and Guidelines RunUO Forum Search Engine Download RunUO 2.0 RC2 |
|
|
|
|
|
#20 (permalink) |
|
Forum Expert
|
I have received help from a friend of mine and his said this is the correct code:
Code:
using System;
namespace EightBall
{
class EightBall
{
[STAThread]
static void Main(string[] args)
{
Console.Write("What is your question? ");
string answer = Console.ReadLine();
Console.Write("The answer to your question > " + answer + " is ");
Random numb = new Random();
int ans = numb.Next(2);
switch(ans)
{
case 0: Console.WriteLine("yes");break;
case 1: Console.WriteLine("no");break;
}
}
}
}
Code:
random numb Code:
int ans = numb.next(2); well my question is why did he say Code:
= new random(); ![]() or is it just like alot of things in runuo u have to create them along with declaring them?? PS. your code Code:
utility.random |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|