Warning to anyone looking at the html, marquee tag is depricated and you can't remove the gap at start or between - to do it properly you need to use javascript.
I only did it like this because it was so quick. :)
i.e. look at your post that I pasted into the very first post of this topic:
I took your syntax: if %curlvl% EQU 2 set /a dmg=%random% %%100+10
I understood what it did and used it as part of my examples.
UPDATE:
BTW, you cannot remove the 2nd loop - although doing so looks more like normal array usage - you can't do this in Batch - otherwise it will always return the first value in the array.
This is exactly why it might be best not to use this code atm while you don't understand it.
It is also an example of how much easier it would be if you were learning how to use arrays in a different language.
lol MoikMellah, I wasn't going to help Tozan anymore - but you have made me laugh and put me in a good mood so will give Tozan his fish.
Tozan, this seriously only took me a couple of minutes to take your original Array example and apply the Pseudocode I gave you.
WARNING: I also suggest that maybe you should NOT use this as you clearly don't understand this code - if you use this and later you change something that stops it working, you will NOT have the knowledge to fix it.
Despite my warning, I have dropped the example into the same Dropbox link. File is called arrayEg.bat.
output: file generates stuff like this:
C:\Apps\test>arrayEg
random number picked: 2
Do stuff for the room mgarden... using random number 2
C:\Apps\test>arrayEg
random number picked: 4
Do stuff for the room secretarea1... using random number 4
C:\Apps\test>arrayEg
random number picked: 3
Do stuff for the room shadowland... using random number 3
Let this be the end of this topic. You have the fish, go eat.
Ok - you are editing your old comments so much that my posts no longer even reference things you originally sent in a previous post.
Have a look through my earlier posts, I have put in time to help you, made working batch files with examples you can use - I was trying to help you, yet you then post comments like this: "But what displeases me is your attitude to learnng, you expect people to solve everything themselves and this a selfish attitude to have"
It is time we moved on from this topic - it is perfectly fine to continue the way you were without trying to implement an array concept in Batch Script.
You could even use one of my earlier examples to do a similar thing via using a room_# name convention.
Good luck with your project - I do not wish to help further though.
Sorry, this is pretty basic stuff - So I am trying to encourage you to learn these basics - learning this does take a bit of time at first - but once you know it, you will know how arrays and loops work for ALL languages.
Also, it is EASIER to learn these concepts with other languages because you will be using actual arrays and functions instead creating 'the next best thing' in batch script.
I am not going to spend my time producing the exact Batch Script especially if you are not willing to learn it yourself, and when you say things like the following: "Obviously from what you're telling me. its too hard for you as well, since its also out of your league because you also can't do it".
I actually gave you a valid pseudocode example, but you have changed your code from your example. I.e. You have moved the 2nd for loop inside the 1st for loop (this won't work as the 1st for loop creates the 'array').
I know you are getting frustrated and feel I am 'withholding' information from you - but I am not your paid 'world class' coach - nor am I trying to boost my ego - I am simply trying to help you understand how this stuff works.
Yes I could easily get this to work, but your comments are rude (many of your rude comments you have since removed) and you do not inspire me to help you further.
Without researching and looking at just your code above - the easiest way would be to SET your random number as you do now, then use it in an IF inside the 2nd for loop.
i.e.:
SET /A rand=[insert random number code]
for /L %%f in (0,1,!lastindex!) do (
[PUT YOUR IF %%f == %rand% here] == True Then goto !names[%%f]!
)
Again, I don't know Batch Script code - and I am not going to look up the correct syntax.
Pseudocode is an informal high-level description of the operating principle of a computer program or other algorithm. It uses the structural conventions of a programming language, but is intended for human reading rather than machine reading.
I only gave you pseudocode - not batch code examples - I have previously provided links to websites that describe how to make arrays/lists in Batch Script. I am only trying to give you some suggestions - not tell you how to code - learning to code is an ongoing process - you should always be researching and learning - Google is a great resource. :) In my opinion - you should not use Batch Script to learn how to code. BUT I would be keen for you to finish your project - even if you REDUCE the size and scope of the project. It looks like you have achieved some nice results even though you are only just learning. Finishing a project is important - but perhaps reduce your goals for this Batch Script game - If you take a long time to finish this project I think you will be harming/hindering your ability to learn to program. I.E. Getting me to show you how to create Batch Script work-arounds for normal common development functions is NOT the way to learn imo. Take this last bit of advice or leave it, but I feel you should work out HOW you can finish your game in the next couple of days - e.g. reduce the size - scope, goals or whatever. Get it done - show it to people. Ignore any negative comments that are not constructive. Then start a new project in either a game engine - or a popular language - that way you will be well supported by an active helpful community - do plenty of tutorials and enjoy the learning process.
I believe that you have the tanacity to make games - you just need to learn more - to learn more, do lots of small projects - things that only take a few days at most to complete.
Although I agree that a proper game engine is the way to go - there are more compact ways of writing your code - and until you understand these concepts you will repeat your same mistakes in other languages/engines.
A game engine doesn't force you to create good code. :)
e.g. There are 2 ways to compact your 390 line random room warp code.
Options 1: Dump all the names into an array or list and do something like this instead (pseudo-code):
BigRoomsArray('boat', 'mgarden' ...)
randNumber = rand(390)+1
goto BigRoomsArray[randNumber]
Option 2: Make generic goto room names e.g. room_1, room_2 etc. ( and describe them with REM comments instead) and do the following:
randNumber = rand(390)+1
goto room_[randNumber]
You can do exactly the same as the above for your monsters as well.
So instead of 100's of lines of code, you are now only using a few.
I didn't realise this image was already designed to be animated - just scroll them - looks much better. :)
(no need to flip)
https://jsfiddle.net/ezh5e6pj/2/
------- BELOW = OLD -------------
Not sure what animation you want - but you could flip the image horizontally in your game - then scroll them together.
I put this quick jsfiddle together to show the effect - this is a super quick demonstration of the effect only and uses just plain html.
https://jsfiddle.net/ezh5e6pj/
Warning to anyone looking at the html, marquee tag is depricated and you can't remove the gap at start or between - to do it properly you need to use javascript.
I only did it like this because it was so quick. :)
hrm, I got that code from you.
i.e. look at your post that I pasted into the very first post of this topic:
I took your syntax: if %curlvl% EQU 2 set /a dmg=%random% %%100+10
I understood what it did and used it as part of my examples.
UPDATE:
BTW, you cannot remove the 2nd loop - although doing so looks more like normal array usage - you can't do this in Batch - otherwise it will always return the first value in the array.
This is exactly why it might be best not to use this code atm while you don't understand it.
It is also an example of how much easier it would be if you were learning how to use arrays in a different language.
lol MoikMellah, I wasn't going to help Tozan anymore - but you have made me laugh and put me in a good mood so will give Tozan his fish.
Tozan, this seriously only took me a couple of minutes to take your original Array example and apply the Pseudocode I gave you.
WARNING: I also suggest that maybe you should NOT use this as you clearly don't understand this code - if you use this and later you change something that stops it working, you will NOT have the knowledge to fix it.
Despite my warning, I have dropped the example into the same Dropbox link. File is called arrayEg.bat.
output: file generates stuff like this:
C:\Apps\test>arrayEg
random number picked: 2
Do stuff for the room mgarden... using random number 2
C:\Apps\test>arrayEg
random number picked: 4
Do stuff for the room secretarea1... using random number 4
C:\Apps\test>arrayEg
random number picked: 3
Do stuff for the room shadowland... using random number 3
Let this be the end of this topic. You have the fish, go eat.
Ok - you are editing your old comments so much that my posts no longer even reference things you originally sent in a previous post.
Have a look through my earlier posts, I have put in time to help you, made working batch files with examples you can use - I was trying to help you, yet you then post comments like this: "But what displeases me is your attitude to learnng, you expect people to solve everything themselves and this a selfish attitude to have"
It is time we moved on from this topic - it is perfectly fine to continue the way you were without trying to implement an array concept in Batch Script.
You could even use one of my earlier examples to do a similar thing via using a room_# name convention.
Good luck with your project - I do not wish to help further though.
No it isn't just 1 line.
You MOVED the entire 2nd for loop inside the first for loop and you did this because you didn't understand how it works.
Sorry, this is pretty basic stuff - So I am trying to encourage you to learn these basics - learning this does take a bit of time at first - but once you know it, you will know how arrays and loops work for ALL languages.
Also, it is EASIER to learn these concepts with other languages because you will be using actual arrays and functions instead creating 'the next best thing' in batch script.
I am not going to spend my time producing the exact Batch Script especially if you are not willing to learn it yourself, and when you say things like the following: "Obviously from what you're telling me. its too hard for you as well, since its also out of your league because you also can't do it".
I actually gave you a valid pseudocode example, but you have changed your code from your example. I.e. You have moved the 2nd for loop inside the 1st for loop (this won't work as the 1st for loop creates the 'array').
I know you are getting frustrated and feel I am 'withholding' information from you - but I am not your paid 'world class' coach - nor am I trying to boost my ego - I am simply trying to help you understand how this stuff works.
Yes I could easily get this to work, but your comments are rude (many of your rude comments you have since removed) and you do not inspire me to help you further.
Without researching and looking at just your code above - the easiest way would be to SET your random number as you do now, then use it in an IF inside the 2nd for loop.
i.e.:
SET /A rand=[insert random number code]
for /L %%f in (0,1,!lastindex!) do (
[PUT YOUR IF %%f == %rand% here] == True Then goto !names[%%f]!
)
Again, I don't know Batch Script code - and I am not going to look up the correct syntax.
I am not a batch script programmer.
Those batch script examples I created for you - was me using google to find examples, then put together concise examples to show you.
I am sorry that when I suggest that you should look at these websites instead of me - you take this as me withhold information from you.
Also, I would not compare programming to a sport - You are not learning how to have the best serve or be the fittest or predict the next play/stroke.
Programming is more like art. You learn how to use tools, the understanding of how they work allows you to use them in new and exciting ways.
Good luck with your project.
Pseudocode is an informal high-level description of the operating principle of a computer program or other algorithm. It uses the structural conventions of a programming language, but is intended for human reading rather than machine reading.
I only gave you pseudocode - not batch code examples - I have previously provided links to websites that describe how to make arrays/lists in Batch Script.
I am only trying to give you some suggestions - not tell you how to code - learning to code is an ongoing process - you should always be researching and learning - Google is a great resource. :)
In my opinion - you should not use Batch Script to learn how to code.
BUT I would be keen for you to finish your project - even if you REDUCE the size and scope of the project.
It looks like you have achieved some nice results even though you are only just learning.
Finishing a project is important - but perhaps reduce your goals for this Batch Script game - If you take a long time to finish this project I think you will be harming/hindering your ability to learn to program.
I.E. Getting me to show you how to create Batch Script work-arounds for normal common development functions is NOT the way to learn imo.
Take this last bit of advice or leave it, but I feel you should work out HOW you can finish your game in the next couple of days - e.g. reduce the size - scope, goals or whatever.
Get it done - show it to people. Ignore any negative comments that are not constructive.
Then start a new project in either a game engine - or a popular language - that way you will be well supported by an active helpful community - do plenty of tutorials and enjoy the learning process.
I believe that you have the tanacity to make games - you just need to learn more - to learn more, do lots of small projects - things that only take a few days at most to complete.
Although I agree that a proper game engine is the way to go - there are more compact ways of writing your code - and until you understand these concepts you will repeat your same mistakes in other languages/engines.
A game engine doesn't force you to create good code. :)
e.g. There are 2 ways to compact your 390 line random room warp code.
Options 1: Dump all the names into an array or list and do something like this instead (pseudo-code):
BigRoomsArray('boat', 'mgarden' ...)
randNumber = rand(390)+1
goto BigRoomsArray[randNumber]
Option 2: Make generic goto room names e.g. room_1, room_2 etc. ( and describe them with REM comments instead) and do the following:
randNumber = rand(390)+1
goto room_[randNumber]
You can do exactly the same as the above for your monsters as well.
So instead of 100's of lines of code, you are now only using a few.
Pages