Remove all ad content simply by registering an account.

Author Topic:  PWR's PRGRSS - Learning C#  (Read 9347 times)

0 Members and 1 Guest are viewing this topic.

PWRBTTN

  • Legendary Member
  • *****
  • Posts: 1172
  • Professional Expert, Comrade
    • View Profile
  • Xbox: PWRBTTN
  • Steam: PWRBTTN
Re: PWR's PRGRSS - Learning C#
« Reply #140 on: March 15, 2016, 10:15:57 PM »
So, I suppose "check" and "examine" could be synonymous. So, if I set it up so that "bag", "i" and/or "inventory" were... uh... items, then that would fix it? I don't want "bag" to show up in my inventory if "bag" is an item. Also, "pick up" is another two word command. How would I fix that?

What about Items with two words? Like Fuel Tank.
« Last Edit: March 15, 2016, 10:21:41 PM by PWRBTTN »
/snail       /snail    /snail         /snail /snail      /snail   /snail                /snail        

Craig

  • Developer
  • Extreme Member
  • ******
  • Posts: 6655
  • Dig Deep
    • View Profile
    • Twitter
  • Steam: tota1miner
Re: PWR's PRGRSS - Learning C#
« Reply #141 on: March 16, 2016, 12:05:56 AM »
Yep, check/examine can be merged into one command. Most MUD's use 'Look' I think.

I changed Pick up to Pickup. Most MUD's would use 'Take'.

If you want to handle item names with spaces, you're probably going to have abandon the provided Split method and roll your own, to handle surrounding names in quotes like "Fuel Tank"

No don't make bag or inventory as items, just handle them separately in the check or examine command/method.

e.g.

if (args[1] == "bag" || args[1] == "i" || args[1] == "inventory")
{
   // check bag
}
else
{
// check item (args[1])
}

PWRBTTN

  • Legendary Member
  • *****
  • Posts: 1172
  • Professional Expert, Comrade
    • View Profile
  • Xbox: PWRBTTN
  • Steam: PWRBTTN
Re: PWR's PRGRSS - Learning C#
« Reply #142 on: March 16, 2016, 01:38:35 AM »
Yep, check/examine can be merged into one command. Most MUD's use 'Look' I think.
No. Look and Examine are generally different. Look describes what you see in a room. Examine describes the specified item. Some do combine them, but as far as I'm aware, MUD players prefer them seperate.
/snail       /snail    /snail         /snail /snail      /snail   /snail                /snail        

PWRBTTN

  • Legendary Member
  • *****
  • Posts: 1172
  • Professional Expert, Comrade
    • View Profile
  • Xbox: PWRBTTN
  • Steam: PWRBTTN
Re: PWR's PRGRSS - Learning C#
« Reply #143 on: March 18, 2016, 06:55:52 AM »
I've decided I'll just go the more traditional route and use "Inventory" instead of examine bag, check bag, or what have you.
/snail       /snail    /snail         /snail /snail      /snail   /snail                /snail        

PWRBTTN

  • Legendary Member
  • *****
  • Posts: 1172
  • Professional Expert, Comrade
    • View Profile
  • Xbox: PWRBTTN
  • Steam: PWRBTTN
Re: PWR's PRGRSS - Learning C#
« Reply #144 on: March 18, 2016, 07:49:41 AM »
So for Examine to work, I imagine it'll need to be something along the lines of...

void CommandExamine (string[] args)
{
     Console.WriteLine
     {
           /* Check to see what the player wants to examine, if anything. Otherwise, describe the room.

           Then see if the player has or is in the same room with the item. If not, then say "You cannot see that"

           If the previous conditions have been met, describe the item.
           */
     {
     Console.WriteLine
}

... I realise the actual important part isn't code, but I'm trying to clarify whether or not I have the idea down, or if I should do it different. I hope that makes sense
/snail       /snail    /snail         /snail /snail      /snail   /snail                /snail        

PWRBTTN

  • Legendary Member
  • *****
  • Posts: 1172
  • Professional Expert, Comrade
    • View Profile
  • Xbox: PWRBTTN
  • Steam: PWRBTTN
Re: PWR's PRGRSS - Learning C#
« Reply #145 on: March 19, 2016, 10:19:38 AM »
My laptop is acting nuts, and I didn't do anything... Well... I did download Windows 10, but... I don't know if that's the cause. Until I get it back in decent order, I'm going to try and work an old, old, old, old, old, old, old PC with Windows 95. Visual Studio should work on it, right? I mean... Microsoft is crazy about their software having backwards compatibility, right? Guess I can only try...
/snail       /snail    /snail         /snail /snail      /snail   /snail                /snail        

Dryym

  • Supreme Member
  • *****
  • Posts: 4336
  • What's yours is mine. ~TM's Resident Master Thief~
    • View Profile
  • Xbox: dryym
Re: PWR's PRGRSS - Learning C#
« Reply #146 on: March 19, 2016, 10:53:02 AM »
Are you planning on having an advanced system with the commands like Zork did?

For example "Hit Troll with Sword" And "Hit the Troll with the Elven Sword" are both valid options.

And some funny things such as "Eat the Troll" returning "I don't think the troll would agree with you."

Creator of the term "Deathmine "
Jared [19|Oct 07:12 PM]: "It changes everything" Dryym

PWRBTTN

  • Legendary Member
  • *****
  • Posts: 1172
  • Professional Expert, Comrade
    • View Profile
  • Xbox: PWRBTTN
  • Steam: PWRBTTN
Re: PWR's PRGRSS - Learning C#
« Reply #147 on: March 19, 2016, 10:57:04 AM »
Are you planning on having an advanced system with the commands like Zork did?

For example "Hit Troll with Sword" And "Hit the Troll with the Elven Sword" are both valid options.

And some funny things such as "Eat the Troll" returning "I don't think the troll would agree with you."
The humour is definitely a goal. In fact, in the wise words of my favourite YouTuber,"The greatest adventures always have buckets."... so that's another goal.

As for complex word parsing, no. If you've been following along, you'll see I can't use but one space in a single string of text. So, maybe eventually... but not at this stage...
/snail       /snail    /snail         /snail /snail      /snail   /snail                /snail        

Craig

  • Developer
  • Extreme Member
  • ******
  • Posts: 6655
  • Dig Deep
    • View Profile
    • Twitter
  • Steam: tota1miner
Re: PWR's PRGRSS - Learning C#
« Reply #148 on: March 21, 2016, 08:03:29 AM »
So for Examine to work, I imagine it'll need to be something along the lines of...

void CommandExamine (string[] args)
{
     Console.WriteLine
     {
           /* Check to see what the player wants to examine, if anything. Otherwise, describe the room.

           Then see if the player has or is in the same room with the item. If not, then say "You cannot see that"

           If the previous conditions have been met, describe the item.
           */
     {
     Console.WriteLine
}

... I realise the actual important part isn't code, but I'm trying to clarify whether or not I have the idea down, or if I should do it different. I hope that makes sense
Yes I guess you could do something like that:

Code: [Select]
void CommandExamine(string[] args)
{
     Console.WriteLine
     {
         item = GetItem(args)
         if (item)
         {
            if (IsItemInRoom(item))
            {
               Console.WriteLine("Details about item.")
            }
            else
            {
               Console.WriteLine("This item is not in the room.")
            }
         }
         else
         {
            Console.WriteLine("Item not found.")
            Console.WriteLine("Details about room.")
         }
     }
     Console.WriteLine
}

My honest opinion is that a MUD is too advanced for you at this time in your learning, and you'd be better off working on simpler programs, until you get a better feel for how to do things. A MUD requires complex text parsing, which is not easy, even for advanced programmers. It requires advanced database management, again not easy. Writing a good MUD would test the skills of most advanced programmers.
« Last Edit: March 21, 2016, 08:07:50 AM by Craig »

PWRBTTN

  • Legendary Member
  • *****
  • Posts: 1172
  • Professional Expert, Comrade
    • View Profile
  • Xbox: PWRBTTN
  • Steam: PWRBTTN
Re: PWR's PRGRSS - Learning C#
« Reply #149 on: March 21, 2016, 12:35:00 PM »
Well, I'm not really planning on working on a MUD yet. Multiplayer seems just way too hard for a beginner. For now, the simple text based game like IMPA here should be the kind of project that is fitting for a first good learning project. It seems to use a good portion of the tools I have been learning and have yet to learn in C#. After it's finished, I will keep it as what would mostly be a reference field guide as to what different commands and tools are used for and how. I hope that made sense.

In any case, is there anything you think I may be missing as far as how items should work? Like... I was thinking alternate descriptions would make sense to have, for in case you do something to the item, but I don't know. I'm not sure if that'll be necessary.

On that note, though, I should say that I have been having problems with my desktop. So, since my laptop is weirding out, too, I can't do much in the ways of anything with it. On top of that, a huge predicament I have found myself in will in less than a month keep me from having internet access (among other things) for... who knows how long. It may be a long time, or it may be a week. I do have to say, though, in the low, low, low chance I don't get to come back to the community, I have to say I enjoyed my run. I don't want to go into detail publicly. If anyone is curious, I don't mind sharing over PM. I will give a good bye on the first day of my leave, though. So don't worry about me just disappearing.

Sorry for the rambling. Just had a lot to get out.
/snail       /snail    /snail         /snail /snail      /snail   /snail                /snail