Torzans game code discussion
This topic was hijacked by some off-topic technical discussion, I have moved the discussion here so it could continue if needed:
Based on this post from Tozan:
I find batch script to be an interesting language. But lacks the execution speed. and also lacks a 3d engine, and lacks also the Transparency needed for Sprites and animation. In writing the game, I find i have to define alot of different variables. Because this game has a thousand level progressions in it, but its not just level progressions but also damage progressions, health progressions and random progressions. And I am wondering if there is an much easier shorter way to code all the progressions.
if %curlvl% EQU 2 set /a dmg=%random% %%100+10
if %curlvl% EQU 3 set /a dmg=%random% %%120+10
if %curlvl% EQU 4 set /a dmg=%random% %%140+10
if %curlvl% EQU 5 set /a dmg=%random% %%160+10 (ect.ect)
Money reward Progression:
if %curlvl% EQU 2 set maxmoney=1062
if %curlvl% EQU 3 set maxmoney=1168
if %curlvl% EQU 4 set maxmoney=1836
if %curlvl% EQU 5 set maxmoney=2080
ect.ect.
Experience given progression:
if %curlvl% EQU 1 set addxp=400
if %curlvl% EQU 2 set addxp=500
if %curlvl% EQU 3 set addxp=500
if %curlvl% EQU 4 set addxp=600
if %curlvl% EQU 5 set addxp=700
ect...
As for Godot, how do you get anything to render? I still can't get anything to display up in the viewports, I go into new resources and load the different resources in but nothing shows up on the 3d viewport. nothing renders. the program also has layout issues. Everything under resources is all put into one big long scroll menu and the smaller menus also have too many options, you can't dock the menus to customize them to suit your own needs and also the documention of the program, its advanced. couched deep in its own programming code so its not gonna suit all users.
I couldn't find any documentation to explain all the Godot script, nor did I see any scripting examples that I could load in to see how the scripts is actually structured........ Because if there's no install, (I didn't see the program unpack and install anything) or tell me where the program is being installed to, it just only creates a project directroy and if the program only just runs in memory, how can I find the godot script examples? Where are all the script demonstrations for this program?
So I can't find much solid structure in this program, its just a few things been slapped together to help in 3d modeling, and texturing, its a front end of some sort, dosen't look like a full game engine, its more like a 3d modeling resource helper. As for windows, half of windows does sit on a bunch of batch files.
Having all these many languages and formats, the growing list just makes things more complicated for those who don't know all of those languages and formats. Clear, concise documentation has to be written for each of them.
One of the advantages I had in doing the game in simple windows batch script, is that I could get it written very fast and get a rough idea of what the whole gameworld is goig to look like BEFORE trying to attempt to do this game inside a 3d engine., had I tried to write it in C+++, I would be here for YEARS trying to get the scripting all done in that language, that's why I didn't choose C++.
But I don't know how to go about creating this type of game on a 3d game engine because with a game like this I need the engine to draw sectors of it at a time when rendering (seamless backloading) as the whole game playing area is just too big for the engine to render it all at once but most 3d engines limit you as to how much area space you are allowed to render. So just like Red Faction Editor, I need to Daisy chain all the sectors through seamless loading. Or like they did in Morrowind to provide smooth seamless endless scrolling of all the game regions. I don't know how to set it up like that in a 3d game engine.
You'll soon see what I mean, by writing a huge game out in windows batch script. here's the map (NOT finished yet) for the Trolll Mountains Region and this is just one of three sectors for the region. These playing screens have been put roughly together to give an outline of what the sector will look like (that's why there are many copies of the player in the pictures. This is just to give is a rough look as to what the map will be like once its all been seamed.).
As this game is huge, has over 20 square miles to roam around i and i did this game because I like playing open world non linear outdoor rpg games..
Each one of these screens contain about 2 thousand lines of code each because of all the many different progressions variables that had to be defined to get the game to play out as a hack 'b' slash grinder progression level exploration game...
What a big difference this game would make if it could only scroll all its screens and have animated rigged models roaming around..
Boogle Reply:
Game engines (like Unity, Godot etc.) usually define a few concepts automatically, e.g.
1) a viewport concept.
i.e The current area could be HUGE! but the viewport automatically handles what should be visually displayed based on the player/camera position.
2) To code each area, these are often defined as scenes - only the current scene is displayed and processed.
So in fact automatically with the 2 options above you can have both MASSIVE game maps/areas plus MASSIVE scenes in a game engine automatically without having to worry about doing it yourself.
----------------
Also, for your progression code. WHY do you work this out each time?
I would have thought the time to do this is when you increment curlvl?
If you must work it out every time - then use a forumla to determine each variable instead of 1000's of lines of code.
Look at sites like this to have a look at the different formula possibilities:
stackoverflow.com
But as I said - just updating the variables each time you level up makes the most sense. 1 line required for each variable and only runs when you level up.
==============
Tozan Reply:
Thanks for helping me to understand it a little better, it Sounds interesting, I thought Games like Morrowind, and Sacred may have been done by using the camera viewport, to draw the screen , I knoq in the Red Editor they used portals brushes instead to tell the engine what to draw on the screen orwhat not to..
I didn't know how to write out the formulas in batch code, that's why I had to I had to do it 1 line at a time. So the updating for monster health, damage, player health and player damage go into the level up section of the code for defining all the level progressions. Okay but soemtimes if I have special progressions, i may have to keep those progressions in the actual screen area. I use the Random Dice for making the game just pick out a random number (not alwys based on the players current level), sometimes I need the computer to randomly pick an event and trigger it like picking certain foley sounds, or random enemy encounters after you visit a certain area you can revist and something different triggers off.
I also do this as well when the player dies, pick a random room in the game for the player to warp to. theres about 400 rooms now in the game.
I also needed to get the Overdrive progress bar to increase by 1 point for every monster killed to display the overdrive progress bar no matter where you are in the game so for every 260 or so kills the overdrive fills up the bar and then upgrades itself to a new more powerful overdrive, so there are up to 7 of these bar fill upgrades.... but I don't know how to write that out as a formula. and then just stick it in once place the computer always loops back to so everytime I kill something no matter what screen I'm on in the game the bar ticks up a notch..
And Things like Collecting Dragon Orbs I had to embed that code into all the screens that had the orbs scattered around, its only a very small piece of code of only just abt 5-6 lines long. so I didn't think that was a big deal to repeat that small piece of code on the screens where the orbs all are.
And because it was written in Batch code using the console to display the graphics in, I had to redraw an extra area the orbs were on one or when you had killed enemies so you could see thier corpses..
=============
Boogle Reply:
ok - I am certainly no DOS/BATCH expert - hardly touched it in the last 10 years...
But a few google searches and I could make it do what I was talking about!
Example test.bat file and result.txt file can be found here:
Dropbox link
Summary of the tests:
Setting variables using a forumla. (I tried to match your examples you provided above where I could).
Going to random room
Showing a for loop.
I cound't find any situation where you would need 1000's of lines of code for the examples you provided. If you really want to hard-code a bunch of values outside of what a formula can handle - then dump those unique values into arrays or something rather than 1000's of lines of code. For loops would have also done the job.
Here is a link for some List/Array example use:
stackoverflow.com
Good luck!
==================
Tozan Reply:
I don't actually know where to put the overdrive code in the game just yet, because the code at the moment is in every single screen to make sure that the game is forced to keeps on redrawing the progress bar of the overdrive when I move from screen to screen killing off the monsters manually..
So I got the overdrive code going, problem is, I need to know where in the game to put it, so that it affects every single screen in the game but not force me to have to copy it off into every game screen. So it has to go in a place where game values are being updated continually but I don't know where in the code that acutally is. `
This is the code to cycle the bitmaps for the 1st overdrive.. The 1st overdrive is complicated because it cycles alot of bitmaps so the 1st overdrive takes up 260 lines of code..
if %killcount% EQU 20 insertbmp /p:"lines.bmp" /x:1290 /y:60 /z:80 && sound play barup.wav && sound play barup2.wav
if %killcount% EQU 21 insertbmp /p:"lines.bmp" /x:1290 /y:60 /z:80 && sound play barup.wav && sound play barup2.wav
if %killcount% EQU 22 insertbmp /p:"plasmard.bmp" /x:1215 /y:20 /z:90 && sound play powerup.wav
if %killcount% EQU 22 insertbmp /p:"lines.bmp" /x:1290 /y:60 /z:80 && sound play barup.wav && sound play barup2.wav
if %killcount% EQU 23 insertbmp /p:"lines.bmp" /x:1290 /y:60 /z:80 && sound play barup.wav && sound play barup2.wav
if %killcount% EQU 24 insertbmp /p:"lines.bmp" /x:1290 /y:60 /z:80 && sound play barup.wav && sound play barup2.wav
if %killcount% EQU 24 insertbmp /p:"plasmared.bmp" /x:1215 /y:20 /z:90 && sound play powerup.wav
if %killcount% EQU 25 insertbmp /p:"lines.bmp" /x:1290 /y:60 /z:80 && sound play barup.wav && sound play barup2.wav
if %killcount% EQU 25 insertbmp /p:"plasmaredb.bmp" /x:1215 /y:20 /z:90 && sound play powerup.wav
if %killcount% EQU 26 insertbmp /p:"lines.bmp" /x:1290 /y:60 /z:80 && sound play barup.wav && sound play barup2.wav
if %killcount% EQU 26 insertbmp /p:"plasmaor.bmp" /x:1215 /y:20 /z:90 && sound play powerup.wav
if %killcount% EQU 27 insertbmp /p:"lines.bmp" /x:1290 /y:60 /z:80 && sound play barup.wav && sound play barup2.wav
if %killcount% EQU 27 insertbmp /p:"plasblu.bmp" /x:1215 /y:20 /z:90
if %killcount% EQU 28 insertbmp /p:"lines.bmp" /x:1290 /y:60 /z:80 && sound play barup.wav && sound play barup2.wav
if %killcount% EQU 29 insertbmp /p:"lines.bmp" /x:1290 /y:60 /z:80 && sound play barup.wav && sound play barup2.wav
if %killcount% EQU30 insertbmp /p:"plasmagreen.bmp" /x:1215 /y:20 /z:90 && sound play full.wav
Once you gone through the first 20 cycles. Lines.bmp changes to drawing Linesa.bmp. and that goes al the way up to linesw.bmp for every 20 cycles you go through, so 260 monster killcounts later the bar is all full and then just like Rachet 'n' clank the weapon automatically upgrades.
I had to code it that way for the 1st overdrive because of cycling through all these different plasma color changes as you increase the killcount. But the 2nd overdrive won't have all those color changes. but just use the only line progress bar to show the overdrive is slowing increasing.
so I might have to write the second overdrive like this:
if %killcount% EQU 260 if %killcount% LEQ 270 insertbmp /p:"linesblank.bmp" /x:1290 /y:60 /z:80 && Rem draw the 1st Bar animation only if the value equals 260 but is not greater than 270)
if %killcount% EQU 270 if %killcount% LEQ 280 insertbmp /p:"linesb.bmp" /x:1290 /y:60 /z:80 && em display the 2nd Bar Animation if the value equals 270 but is not greater than 280).
So it would take up only 26 lines of code instead of taking up 260 lines just to redraw the bar animations for every single killcount value..
Ok - now that I have moved this conversation here, I will reply to your latest post (last section of the post above).
There is 2 ways I can tackle your questions,
1) Try to help you with what you are currently highlighting as coding issues.
or
2) Try to help you put together a better game 'éngine' concept - but this would require a major code re-write.
So... Here is Help 1) to this question: "I don't actually know where to put the overdrive code in the game just yet, because the code at the moment is in every single screen".
Although Batch Scripting doesn't have functions - you can easily create your own code that will act very similar to a function.
I have put together some example code called funcEg.bat in the same Dropbox location as before:
Code basically does this:
Calls a common 'function' before going to a random 'room'.
You can see the output below - you will see the room number changing - but the common code is always run even though it only exists in 1 place, not in every room.
ouput:
==================================================================
= TEST FUNCTION - LICENCE: WTFPL ( http://www.wtfpl.net/ )
==================================================================
Going to room: 3
Doing some common code in my ... 'function'.
I am in room 3, do some stuff
NAVIGATION: I daisy chained all my screens up together to allow non-linear screen movement through them. Its only when the player dies, do I make the game pick out a screen at random to warp the player off into. but you do not move in this game in a a fixed linear fashion with heavily scripted invisible nanny boundaries all around the playing area (like MAss Effect 3 had to hold your hand all the time on so you could not even fall off and hurt yourself in that game and only when people are shooting at you or throwing things at you you take damage) but in this game, you move instead in a non-linear fashion so you CAN fall off ledges and stuff and indeed hurt your health, so you can go almost anywhere in the game into almost any area, but if you fall off something and die, well you gt randomly warped to a different area and you get to keep your current stats, so its an open world rpg turn-based game. But its the type of game that really needs a proper 3d engine to make it all come to life. And No nanny barriers to stop you from exploring or hurting yourself.....
Here's how I coded it.
:zordimension
rem WARPING defeated player to any location in the Game to start again.
set /a room=%random% %%390+1
if %room%==1 goto boat
if %room%==2 goto mgarden
if %room%==3 goto shadowland
if %room%==4 goto secretarea1
up to 390 rooms ect, ect,
I also set the game up so it picks out monsters out at random depending on your current difficulty level to warp the player off into as well, only put this in some screens areas...
The progression code I used.: The higher up the levels you go, the more stronger monsters appear. I didn't just code this so the same monsters keep increasing their HP each time you level up, no I had put in new enemy encounters into it as well.
So when you vist the same area again. Sometimes I also use also a Random Dice counter for the computer to put something in the area to make it show up after a certain number of visits. . So it dosen't just appear at a certain difficulty level,but appears depening on how many times that you enter the area. such as like putting a bonus health item, or treasure chest item. or a monster ambush, oect or maybe a secret warp gate to a hidden area..
Monster Progressions:
if %curlvl% EQU 2 goto forlighthouse - lighthouse screen shows 1 grizzly bear on it.
if %curlvl% EQU 10 goto forlightbear level 10 appears with 2 grizzly bears on it.
if %curlvl% EQU 20 goto forightrock level 20 shows a troll and a turtle.
if %curlvl% EQU 40 goto forlightroll two trolls appear at level 40
if %curlvl% EQU 50 goto fordragon - a dragon mini boss appears at level 50
The bottom line is that this game really needs a proper game engine for these kind ideas and concepts I have in mind for the game to all come to life, I didn't want the game to be all linear and heavily scripted but I can only do just so much with the windows console, because its not a game engine and I cannot build a proper game engine with it, for batch allowed me to view all the game environment when I move through the screens and test all the progressions and random stuff I have in it yes, but theres no walking, no scrolling, nobody is falling down in real time, there's no monsters chasing you all around the place, or detecting how far you are from them before thet start chasing you, so the game works, but is the static environment that lets it down just moving through a whole bunch of pretty pictures therefore forcing the game to be reduced all down to old school turn-based battles like the old final fantasy games..
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.
This idea of dumping the names down inside an array sounds good. BUT...
BigRoomsArray('boat', 'mgarden' ...)
randNumber = rand(390)+1
goto BigRoomsArray[randNum]
This array code does not even work in batch.
I just get back only a ton of 'is not recognized' errors.
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.
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.
Right.
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.
Um I see so since I don't understand yet how to write in these string arrays to use in my own code in batch format because I need the workaround for batch because its batch and not the other programming languages.. Or why don't I just program the rest of the dam game, and just tweak it all later. Surely I can convert some of the batch to some other language.
Now my coach is a national level coach and at this level we are taught pure truth at the world class level so we can progress alot more quickly. if the coach just taught watered-down rubbish to us then we would not learn anything quickly and be forever learning but never coming to a knowledge of the truth..
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 it worked didn't it. even if it was well slow in execution speed.
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 - I would like you to finish it, but I think you are harming your ability to learn to program.
It was fun to try to do the game yes, but I wasn't looking for perfection. I was just looking only to get the basics to work like the overdrives, the progressions, and the mounts, put in little quests and then tweak it all later..
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.
Finish the game off in just the next couple of days? I'm only up to region seven, there's still Snowy Peaks Region to make, the Dragon Region. and the Hotlands. I still haven't quite finished the Trollmountains region yet.
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
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.
I found the array code for the batch language format. All that is needed now is to get the array to pick out a name from the list at random and then just make the goto jumps.
@echo off
setlocal enabledelayedexpansion enableextensions
set i=-1
for %%f in (sea, wildera, mgarden, shadowland, secretarea1, gianttree, undeadzom,shutdown2, gianttree3,boat, boxer, easto, oasisb, trollm, bonesc, swampba, biglakem, mlakeast, laddera, ladb, hatchebs, hachty, eeye, spiderbossb, darkwda) do (
set /a i=!i!+1
set names[!i!]=%%f
)
set lastindex=!i!
for /L %%f in (0,1,!lastindex!) do (
echo !names[%%f]!
)
This code works to display everything that's found inside the array using the for /L loop statement.
Now if I change echo to goto !names[%%f]! inside the for /L loop code then it jumps into the first name that's found in the array 'SEA' and executes that codeblock, but it will not jump randomly into the other names so How do I get the computer to pick out a name at random that's inside an array?
I know how to pass the array off to the goto command because it read the first name correctly,
but I don't know how to set this up with the set /a spin=%random% %%?? to get it to read the names that are found inside in the array and just randomly pick one of those names and just goto jump to it.
its not easy to try to code because you have to get it to somehow randomize the names that are found inside the array. i don't know...
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.
Ther's a bug in the message board text editor on this site, it keeps on switching the text edit mode off everytime I hit the enter key and this really starting to get annoying because the only way I can get the editor to allow me to type anything is to have to save the message and then re-edit it.
for /L %%f in (0,1,!lastindex!) do (
set /a spin=%random% %%r20+1
for /L %%f in (0,1,!lastindex!) do (
IF %%f == %rand% == True goto !names[%%f]!
)
goto !names{%%f]!
)
goto array
Well this code didn't work. The line I'm having alot of problems with is the set /a spin=%random% (%%????%) line because as I told you before, i don't know how to set this line up to work with the array
so I tried set /a spin=%random% %%f - result: Missing operator error.
so i tried set /a spin=%random% %[!names[%%f]% result: the system cannot find 519459519495194
Its obviously this language is way beyond your capacity since you told already me you can't do it, I've tried and I can't do it either...its too hard.... the batch language is just too advanced..... Need to find an advanced batch programmer.
All I get is a 1001 ways instead of producing system errors.
the result I got was this.
So I cannot get it to work, 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..
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.
Well no you misunderstood my words, 90% of the problem has already been solved, there's just 10% left that hasn't. But what displeases me is your attitude to learnng, you expect people to solve everything themselves and this a selfish attitude to have, because I been taught i my church that we serve one another and help one anothr, not turn others away if they need help.
When I have a problem I can't solve on my own, I seek help from others, not expect to be told to just edcuate myself which is an insult to my intelligence..Because I have beem taught to belive that other people are teachers and so you go to them to trry to get answers from them to things you need to know..
This is where you approach to learning is different to mine. You expect people to solve their own problem and give them the false 'Harden up' philoosphy and I expect people to give me the answers to solving the problem if they know the answer and people who know the answer and refuse to share their knowledge i will judge them to be unhelpful.
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.
Well the case of the array is very simple. I don't know where the piece of this puzzle fits in so of course I am not going to know where to correctly place the piece of the puzzle. because I've not seen what the finish puzzle looks like to know where this piece has to go and how it fits into the rest of the picture. So here I am trying to jam in the piece and finding that its the wrong shape because i'm holding it the wrong way around and no matter how much i try to force the piece in to try to get it to fit, it just wont' fit and the computer coughs up errors to tell me that piece is not going to fit. So I cannot complete the puzzle until i know where that piece actually fits in and if you don't fit it in right, errors will result. So Its like doing a puzzle. and its really frustrating that you want to complete the puzzle but can't because you don't know how the piece fits.
In telling me to go by my own experience to figure out how it fits myelf, You fail to realize this one truth, that its not experience that's the best teacher, but it is correct example that is the best teacher. that is the best way to learn.
I learn by watcing others show me the correct example.
Experience is not always the best teache because experience is not based on correct principles but on trial and error.
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.
I did ask for some help elsewhere on another site to try to solve this array problem and did receive the following answer when I posted about the problem, 'Nope, i got nothing.' so truck out there, so i did try to help myself by asking around. You say I've been rude to you, no you msunderstood, I have spoken mainly about the problem I'm having with trying to set up the array for I learn by example.
Give a man a fish, and he eats for a day.
Teach a man to fish, and he's all, "Where's my fish, asshole?"
Boogle has given you very clear advice on how to approach the problem. He doesn't know the exact syntax for your exact situation, no, but that's not because of any deficiency on his part - it's because you are using the most godawful language possible for what you're trying to do. It's impressive what you've managed in spite of your self-imposed Batch shackles, but what you're asking would be trivial in literally any other language.
My project: Bits & Bots
Yes, Boogle did try to help but i needed the correct syntax for this difficult language I'm using and not many people know it because they using those more modern languages. Well I asked another guy on another site and he don't know how to do that one either So to answer I find batch to be good for doing only some things with it, average for doing others, and either weak, or just absolutely abysmal for trying to do other stuff.that without third party programs are outside its limits because batch language dosen't have very much of a bone by the looks of things, so to me batch was more like Old Mother Hubbard who has no goodies in her cupboard so you have to dig around to look for all the goodies because her cupboard has gone bust...
Pity Batch aint like magic pockets where you get lollies and candy and cakes all thown out to you all the time all coming out of a magical whirlwind....
The batch language I find it to be unstable but it somehow seems to work, but so much can go wrong with the code if its just one little tiny thing that is missing then it crashes or gives errors.
But there's a neat little program called batchcodefix and that helped me to get rid of most of the errors to make the code stay stable..
The batch game was just an experiement to see what the game would look like because I wanted to roam all around all the game regions first before thinking of shifting this game into a 3d engine.
So the batch gave me a basic rough outline of a game engine. I didnt want this type of game to be only shackeled to just turn-based or stuck forever in the quagmire of batch... The batch was useful for me because i could script it all very fast with that language but the disadvantage is that it would be an open world turn-based engine, not an open world real time interactive engine like with the proper 3d game engines today.
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.
set /a spin=%random% %%5 (double percentages for the value).
then set the code as this
that was the missing piece I didn't know about.
Thank you Boogle.
I removed the second loop and changed your code to this:
set /a spin=%random% %%20 (double percentages for the formula)
then I set the rest of it to this
if %%f EQU %spin% goto !names{%%F]!
Thank you for showing me the rest of the formula for this array Boogle, i know it seems basic stuff to you but it wasn't basic stuff for me, it was actually pretty hard for me to try to grasp the batch syntax of it because i didn't know the syntax of the batch language that I was programming in because no documentation came with the batch language on my computer and that's why I had trouble knowing how to write the formulas out I can look more into this to see what else it can do with the monsters and other stuff so thanks for giving me a starting point with the array, its amazing just how the array just jumps randomly off into the screens now.
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.
Your explanations are very helpful. I don't yet know how many names I can dump into it. don't know what the limit an array can handle.
Writing a graphics intensive game with bash/bat script is an interesting challenge.
I would suggest using Linux's ImageMagic to output graphics and animations. It has blitting capabiities coupled with some cool effects out of the box. ImageMagic also provides `display` command, which puts generated graphics on screen. You can probably modify it to also grab user input.
no, I think it's being written in Windows Batch script. Bash would be a big step up, but Tozan likes a challenge ;)
https://withthelove.itch.io/