For those new to message boards please try to follow a few simple rules when posting your question.
Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
Keep the subject line brief, but descriptive. eg "File Serialization problem"
Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode "<" (and other HTML) characters when pasting" checkbox before pasting anything inside the PRE block, and make sure "Use HTML in this post" check box is checked.
Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
Please do not post links to your question into an unrelated forum such as the lounge. It will be deleted. Likewise, do not post the same question in more than one forum.
Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
No advertising or soliciting.
We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.
Imagine I have defined 3 variables as follow:
Then later in the program code I want to access the content of them by making their name.
/* In this section I want to concatenate the variable "i" to the string "x" and then show the content of it or even assign a new value to it.
Messagebox.show("x" + i.tosting());
/* The output will be: "x27". But I want to show the content of x27 variable, that is the word "Hi".
Don’t forget that I don’t want to use Array or Dictionary or List and so on. My goal is: to make a variable name and access to its content or assign it a new value like this:
*/"x" + i.tosting() = "New"; // x27 = "New";
What's the correct code in C#? Any idea?
Thank you in advance.
That's a very poor idea - you can do it using reflection, (but not for local variables since they are stack based, not heap) but that's like using a sledgehammer to crack a nut! It'll work, but that's a load of effort to go to just to break a thin shell...
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
I'm working on an adventure game and looking for some tips about coding the use of doors in rooms. I've got objects in rooms working fine, but trying to work out how to code for doors. Would you code for the door being an object in a room, but then the object is effectively in two rooms?
I'm assuming that this is more like a text adventure with pictures or a point and click type game.
Seems like you would just want treat the Room as an object with child objects. So the door that leads to Room B from From Room A would really only exist in Room A and the door in Room B that leads to Room A would be a different object. After all you are loading a new room when you leave one and go to the other.
If this is a 3D or 2D Iso type game then the labryinth would be one big room with smaller rooms inside and you just have to deal with the door allowing/blocking line of sight or fog of war.
Anyway, my thoughts, take it all with a grain of salt.
Jack of all trades, master of none, though often times better than master of one.
Hi It's a text adventure.
Thank You for your thoughts. As you mentioned, I too thought about creating a pair of objects for each door, and then putting them in their appropriate locations.I'll have a go with that method. Just wanted to see if this was a good way forward. Enjoying the codeproject site, lots of good programming ideas. Thanks for your reply - much appreciated.
No, I'd make "doors" a different class of "location attribute" - a "Direction" in which the player can move. That way, walking through a door is just the same as walking along a corridor - it moves you from "room 12: kitchen" to "room 24: dining room" just as walking north along a corridor takes you from "corridor 1: south end" to "corridor 2: north end". The opposite direction in the "new" room take you back to the previous (normally but adventure games have exceptions to that sometimes).
Sent from my Amstrad PC 1640 Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
Hello, I have the feeling this question can become a discussions because there is a lot of parameters that can be change and I don't know what to do.
I'm trying to setup a azure pipeline. I already did this in the past but with template and not for a .NET Core web application. It was easy because I could use a template. For some reason, here, I could not chose any template. The Azure Pipeline tool directly ask me to edit a yml file. Maybe because my repository is a local DevOps repository? I have no idea.
# ASP.NET Core
# Build and test ASP.NET Core projects targeting .NET Core.
# Add steps that run tests, create a NuGet package, deploy, and more:
# - script: dotnet build --configuration $(buildConfiguration)
# displayName: 'dotnet build $(buildConfiguration)'
\- task: DotNetCoreInstaller@0
version: '2.2.202' # replace thisvalue with the version that you need for your project
\- script: dotnet restore
\- task: DotNetCoreCLI@2
arguments: '--configuration Release' # Update this to match your need
# dothis after you've built your app, near the end of your pipeline in most cases
# for example, you do this before you deploy to an Azure web app on Windows
\- task: DotNetCoreCLI@2
arguments: '--configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory)'
# - task: PublishBuildArtifacts@1
# ArtifactName: 'drop'
Here is my result: All is success except
Task : .NET Core
Description : Build, test, package, or publish a dotnet application, or run a custom dotnet command. For package commands, supports NuGet.org and authenticated feeds like Package Management and MyGet.
Version : 2.150.1
Author : Microsoft Corporation
<h1>Help : <a href="https://go.microsoft.com/fwlink/?linkid=832194">More Information</a></h1>
##[error]No web project was found in the repository. Web projects are identified by presence of either a web.config file or wwwroot folder in the directory.
##[error]Project file(s) matching the specified pattern were not found.
[error]No web project was found in the repository. Web projects are identified by presence of either a web.config file or wwwroot folder in the directory. Also with .NET Core? Till now I can run my project locally with my Visual Studio whithout this config file. I don't get it.
PS: Can also someone tell me why the markdown is still active between my code tags? Impossible to display a correct verison of my yml file. # are transformed as title and - as list.
I HOPE this is the correct forum for this, apologize if it isn't i only joined 2 days ago so getting used to using this website.
So i'm learning C# myself by trying to make a small game, it won't be released but I will probably in the end use it as a class project next year. I'm starting now so I got plenty of time to learn basics and skills to prepare for next classes. So, I have a couple of questions I need to ask to clear things up and possibly maybe some links you can point me to, ideas OR even some demos I could use to teach myself, so I can learn what exactly i'm looking for, thanks.
Each game screen will be in the style of a form (no bigger than 10 forms) where I will add graphics etc, the player will be able to click certain objects to pick them up and in some cases pick more than one up. Think kinda like an hidden object type game where the player uses the mouse pointer to search around the screen for items and progress through the game.
1. I will make one form the item bag (called ItemsBag) so, how will I be able to pick up items on one form and have them display in the ItemsBag form?
2. Some items will be used for quests so stock pilling items will be a must, I'm also thinking a label to display amounts in stock with each time you click an item on one form it updates the amount on the ItemsBag form. Is there a tutorial for this type of stuff?
3. Talking to people (will only be a couple of people), I gather the use of a TextBox would be the best way to go with this and have the TextBox display different chat. I have the chat working so far where I click on a character and I get the first lot of talking sorted BUT how can I change text at different times? and also from a different form?
So say one person sends me to go pick something up in another form and I have it in my bag, it will change the text in that NPCs form. Is there some type of tutorial on how to do this? I'm thinking maybe in the NPCs TextBox code maybe something like having it check if I have the item(s) collected in the ItemsBag Form using IF statements, and check if amount is correct.. is that a correct way OR easiest way to go about this?
well i'm sure I will have plenty of more questions in the coming months as I learn, hopefully I haven't asked to much, I look forward to your replies, suggestions and help, thanks.
I'll take a look but I think it will be no good for me as I have to code completely in C# on its own and that's for Unity engine also i'll keep that link book marked though as I'd like to look into unity at a later date.
I can't think of a worse way to learn a language than to skip systematic study and go straight to trying to program some kind of game, with the idea (I assume) that you'll develop broad spectrum knowledge as you figure out what works ... for the game.
Now, if you have depth experience with other languages, with algorithms, with UI widget programming ... different story.
It's not a case of "hard work with no fun," either: there are very good books that will give you an overview, and many interesting programming challenges tailored for new students. Hands on experimentation while implementing these challenges will also give you ideas for your future game. Try: [^], or books by Jesse Liberty, and Chris Sells, or the Deitel textbook [^]. Search for the free book by Petzold.
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot
I am writing an app in which the user will - once only - input their file naming system for certain types of files. For example, they might save all project CAD models in the format
Project is the same for all projects, i.e. a literal
12345 is the project number (variable length)
- is required
Name is the project name (variable length)
- is required
Drawing is the drawing name
- is required
A - might be the version and is required to be an upper case alphabetic character.
Or their system may be something completely different.
Once set up the software can only save files which comply with the standard naming format.
Sounds like a job for regex.
It also sounds like someone might have done it before - extracted the regex pattern from a given string.
(I'm assuming that the initial setup would require each character to be tagged in some way)