The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
Inspired by witch the codehoney asking about our ugliest code I looked up some of my earliest code.
I was just getting started and wanted to experiment a bit with inheritance.
So I decided to make a (turn based) Final Fantasy like battle game
It's VB so you're warned... (awesome pictures at the bottom)
Somehow I thought BaseMonster was a good idea (especially notice how I check if the type of Me (this) is not of a specific derived type).
The BackgroundWorker is also pretty neat!
Private m_Name AsStringPrivate m_Level AsIntegerPrivate m_HP AsIntegerPrivate m_CurrentHP AsIntegerPrivate m_MP AsIntegerPrivate m_CurrentMP AsIntegerPrivate m_Strength AsIntegerPrivate m_CurrentStrength AsIntegerPrivate m_Defence AsIntegerPrivate m_CurrentDefence AsIntegerPrivate m_Magic AsIntegerPrivate m_CurrentMagic AsIntegerPrivate m_MagicDef AsIntegerPrivate m_CurrentMagicDef AsIntegerPrivate m_Speed AsIntegerPrivate m_CurrentSpeed AsIntegerPrivate m_Image As Bitmap
PublicEvent Charging(ByVal sender As BaseCharacters.BaseMonster, ByVal e As System.ComponentModel.ProgressChangedEventArgs)
PublicEvent TurnStarted(ByVal sender As BaseCharacters.BaseMonster, ByVal e As System.EventArgs)
PublicEvent TurnEnded(ByVal sender As BaseCharacters.BaseMonster, ByVal e As System.EventArgs)
PublicEvent Killed(ByVal sender As BaseCharacters.BaseMonster, ByVal e As System.EventArgs)
PrivateWithEvents m_Bgw As System.ComponentModel.BackgroundWorker
IfNotTypeOfMeIs BaseHumanoid Then
EndIfEndSub'''<summary>''' This sub must be used to set the properties Name, Level, HP, MP,
''' Strength, Defence, Magic, MagicDefence and Speed of the new Monster.
Me.CurrentHP = Me.HP
Me.CurrentMP = Me.MP
Me.CurrentStrength = Me.Strength
Me.CurrentDefense = Me.Defense
Me.CurrentMagic = Me.Magic
Me.CurrentMagicDef = Me.MagicDef
Me.CurrentSpeed = Me.Speed
EndSubPublicSub Me_TurnEnded(ByVal sender As BaseCharacters.BaseMonster, ByVal e As System.EventArgs) HandlesMe.TurnEnded
EndSub' A lot of properties for the m_Fields after this point...
The BaseDefence is just a bunch of properties that indicate elemental defence.
#Region "Magic Defense"
Private m_AstralDef As DefenceDefinition.DefenceEnum = DefenceDefinition.DefenceEnum.Normal
Private m_DarkDef As DefenceDefinition.DefenceEnum = DefenceDefinition.DefenceEnum.Normal
Private m_EarthDef As DefenceDefinition.DefenceEnum = DefenceDefinition.DefenceEnum.Normal
Private m_FireDef As DefenceDefinition.DefenceEnum = DefenceDefinition.DefenceEnum.Normal
Private m_GravityDef As DefenceDefinition.DefenceEnum = DefenceDefinition.DefenceEnum.Normal
Private m_HealingDef As DefenceDefinition.DefenceEnum = DefenceDefinition.DefenceEnum.FullAbsorb
Private m_HolyDef As DefenceDefinition.DefenceEnum = DefenceDefinition.DefenceEnum.Normal
Private m_IceDef As DefenceDefinition.DefenceEnum = DefenceDefinition.DefenceEnum.Normal
Private m_LightningDef As DefenceDefinition.DefenceEnum = DefenceDefinition.DefenceEnum.Normal
Private m_PoisonDef As DefenceDefinition.DefenceEnum = DefenceDefinition.DefenceEnum.Normal
Private m_WaterDef As DefenceDefinition.DefenceEnum = DefenceDefinition.DefenceEnum.Normal
Private m_WindDef As DefenceDefinition.DefenceEnum = DefenceDefinition.DefenceEnum.Normal
PublicProperty AstralDef() As DefenceDefinition.DefenceEnum
EndGetSet(ByVal value As DefenceDefinition.DefenceEnum)
m_AstralDef = value
A BaseHumanoid is a monster of sorts and unless I'm Barrett from Final Fantasy VII I don't think my main hand is actually a weapon
Private m_OffHand As IOffHand
Private m_MainHand As BaseWeapon
Private m_Magic AsNew List(Of BaseSpell)
' Does nothing.' This sub is replaced with SetHumanProperties. EndSub'''<summary>''' This sub must be used to set the properties Name, Level, HP, MP,
''' Strength, Defence, Magic, MagicDefence, Speed, MainHand and OffHand of the new Humanoid.
PublicReadOnlyProperty GetMagic() As List(Of BaseSpell)
Time to define my Hero!
PublicSubNew(ByVal name AsString)
Me.Name = name
Me.Level = 10Me.Strength = 10Me.HP = 100Me.MP = 10Me.Defense = 10Me.Magic = 10Me.MagicDef = 10Me.Speed = 4Me.Image = My.Resources.super_hero
Me.MainHand = New HealingStaff
Me.AddMagic = New IceWhisper
'Me.AddMagic = New FireBreathEndSubEndClass
PublicFunction GetMonster() As BaseCharacters.BaseMonster Implements ILandscape.GetMonster
Dim random AsNew Random
Dim i AsInteger = random.Next(0, 2)
EndSelectEndFunctionPublicReadOnlyProperty BackGround() As System.Drawing.Bitmap Implements ILandscape.BackGround
VB.NET, not even VB 1 through 6
Although my very first code was in VB4, some 25 years ago (when I was 7 or 8).
I remember writing a quiz in WinForms with questions like "What is this? [image]" and then answers like "dog, cat, whale".
I kept the score and after 10 questions you'd get a (correct) score.
My dad was so proud he even told his customers about it (who'd later become my customers too)
After that I wouldn't write another letter of code for about 20 years and then I wrote the RPG code (the quiz code has long been gone)
Nowadays, my code just glues all kinds of (Azure) services together.
Adventures in 3d design: a continuing frustration.
I'm trying to design something - fairly complex, it's a lid for my Sous vide tank - in Fusion 360, and I'm getting the hang of things, I think. But ... I'd like to check my measurements (and in particular the internal radii) before I even think of buying a 3D printer, much let commiting to actual ABS / PLA.
So ... I'll print a one-to-one paper version of the drawing so far and lay it on the physical object. Easy!
Except Fusion 360 doesn't have a "print to paper" option, even for sketches. You can "Print to 3D" really easily, but not to paper.
It does have a "image" creation which asks for dpi, so I'll try that. Load it into Paintshop Pro for printing and ... it's not to scale, or even close.
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!
inspired by Bill Woodruff's prev message (and just in case others have the same)
stupid new Android phone kept on losing my calendar entries (old phone was fine for years)
I'd duly re-create the entries, and after some random interval later would disappear again.
today resolved to try and fix it.
(and yes, sync -> google calendar is enabled, entries showed up multiple in gcalendar, but lost from phone)
searching the google (and others): lot's of people same problem (since some android update...)
lots of the same stupid advice (just like microsoft forums): enable sync, confirm on gcalendar, click sync now - you know, all the simpleton textbook responses that never fixes sh*t.
....finally a single reference to another article on something else
turns out in: app permissions -> storage -> calendar: it was disabled. (why??)
so adding entries was fine; and the random lossage? reboot / shut down for sure, but also more often: just because.
[irony]They know better what we need than us. [/irony]
Everytime someone in the family got an update in the last times, something stop working as it used to and I had to get through the full settings again to put the switches as they were, at least the ones I remember / recognise again (it wouldn't be the first time I don't find a setting because it was renamed / moved to other place)
It pisses me off to unexpected limits.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
The problem here is that the operating system needs to protect 80 year old grandmothers, your kids, your lawyer, the scientists in your office building while annoying most of the software engineers and power users.
Disabling the ":controlled access" setting, and re-booting: now, i can write to the file.
i had not thought of a possible Win Defender change as the demon at work, here; my long-term sub to EmsiSoft AV just expired, and i guess Win Defeater took over. Interesting i didn't see any Google hits mentioning Win Defender in my searching.
Also, interesting, the Desktop folder i am using still shows up as readonly, and undoing that setting does not persist: it goes back to readonly
Please come to Chiang Mai, and let me take you for a bowl of the famous northern Thai noodles called kao soi (your choice of beef, chicken, or fish; it's customarily a halal dish, so no pork in the really old establishment i go to)
«One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali
Last Visit: 12-Nov-19 11:20 Last Update: 12-Nov-19 11:20