Debug: Database connection successful Something for the Fans of Old D&D / Not So Free Chat / New Mars Forums

New Mars Forums

Official discussion forum of The Mars Society and MarsNews.com

You are not logged in.

Announcement

Announcement: This forum has successfully made it through the upgraded. Please login.

#1 2005-08-07 23:00:53

srmeaney
Member
From: 18 tiwi gdns rd, TIWI NT 0810
Registered: 2005-03-18
Posts: 976

Re: Something for the Fans of Old D&D

'dungeons and dragons character generator
'for microsoft quickbasic for macintosh
'by srmeaney 1992
start:
    clear
    textsize(18)
    locate 4,2:print "dungeons & dragons"
    textsize(14)
    locate 4,1:print "character generator"
    randomize timer
    dim ability(6)
    dim class(7)
    dim ability$(6)
    dim class$(7)
    gosub prepstat
    gosub prepclass
    gosub genstat
    gosub genrest
    gosub optclass
    gosub stats
    gosub selectclass
    window close(3)
    gosub hometown
    gosub adjusthp
    gosub charactersheet
    gosub ending
end

adjusthp:
    n=5
    gosub abilitybonus
    hpbonus=abonus
    hp=hitpoints+hpbonus
    if hp<1 then hp=1
return

abilitybonus:
    select case ability(n)
    case 3
        abonus=-3
    case 4 to 5
        abonus=-2
    case 6 to 8
        abonus=-1
    case 9 to 12
        abonus=0
    case 13 to 15
        abonus=1
    case 16 to 17
        abonus=2
    case 18
        abonus=3
    end select
return

ending:
    button 1,1,"end the program",(400,10)-(600,30),1
    button 2,1,"print character sheet",(400,40)-(600,60),1
    button 3,1,"generate new character",(400,70)-(600,90),1
    while dialog(0)<>1:wend
    pushed=dialog(1)
    if pushed=1 then end
    if pushed=2 then gosub printer:goto ending
    if pushed=3 then goto skip
skip:
    button close(1)
    button close(2)
    button close(3)
    close window(4)
    goto start
return

charactersheet:
    window 4,"charactersheet",(10,50)-(630,470),5
    print
    textsize(18):print tab(2)"class:" class$(classchosen)
    print
    textsize(14):print tab(2)"alignment:"alignment$;tab(18)"hitpoints:";hp
    print
    for quik=1 to 6
        print ability$(quik),ability(quik)
    next quik
    print
    print tab(2)"starting gold:"gold
    print
    print tab(2)"character background"
    print
    print tab(2) "age:"age
    print tab(2) "family social standing:";social$;tab(40)"family origin:";family$
    print tab(2) "hometown";town$
    textsize(12): print
    print tab(25)"click on character sheet to continue"
    while mouse(0)<>1:wend
return

stats:
    window 3,"raw statistics",(10,50)-(630,470),5
    print
    textsize(18):textfont(27):print tab(2) "Dungeons & Dragons"
    textsize(18):textfont(27):print tab(2) "Character Generator"
    print
    for pik=1 to 6
        print tab(2)ability$(pik),ability(pik)
    next pik
    print
    print tab(2)"starting gold:"gold
    for time=1 to 5
        print
    next time
    textsize(14):print tab(16)"click mouse to continue"
    while mouse(0)<>1:wend
return

printer:
    open "lpt1:"for output as #1
        print #1,
        print #1, tab(2)"class:"class$(classchosen)
        print #1,
        print #1, tab(2)"alignment:"alignment$;tab(18)"hitpoints:";hp
        print #1,
        print #1, "abilities"
        for pik=1 to 6
            print #1, print tab(2)ability$(pik),ability(pik)
        next pik
        print #1,  tab(2)"starting gold:",gold
        print #1,
        print #1,  tab(2)"character background"
        print #1
        print #1, tab(2) "age:"age
        print #1, tab(2) "family social standing:";social$; tab(40)"family 
origin:";family$
        print #1, tab(2) "hometown";town$
    close #1
return

genrest:
    gold=10*(int((18-3+1)*rnd+3))
    align=int((6-1+1)*rnd+1)
    select case align
        case 1 to 3
            alignment$="Lawful"
        case 4 to 5
            alignment$="neutral"
        case 6
            alignment$="chaotic"
    end select
    age=13+(int((6-1+1)*rnd+1))
return

genstat:
    for stat=1 to 6
        ability(stat)=int((18-3+1)*rnd+3)
    next stat
return

optclass:
    class(2)=2                'fighter option always open
    if ability(2)>8 then class(3)=2        'if int>8 magicuser possible
    if ability(3)>8 then class(3)=2        'if wis>8 cleric possible
    if ability(4)>8 then class(3)=2        'if dex>8 thief possible
    if ability(2)>8 then class(3)=2        'if int>8 elf possible
    if ability(5)>12 then class(3)=2    'if con>12 dwarf possible
    if ability(4)>8 and ability(5)>8 then class(7)=2 'if dex & con>8 then halfling possible
return

prepclass:
    class$(1)="cleric"
    class$(2)="fighter"
    class$(3)="magicuser"
    class$(4)="thief"
    class$(5)="elf"
    class$(6)="dwarf"
    class$(7)="halfling"
return

prepstat:
    ability$(1)="strength"
    ability$(2)="intelligence"
    ability$(3)="wisdom"
    ability$(4)="dexterity"
    ability$(5)="constitution"
    ability$(6)="charisma"
return

selectclass:
window 2,"selectclass",(475,50)-(625,470),5
for range =1 to 7
if class(range)=2
    then button range,1,class$(range),(20,20+(40*range))-(120,60+(40*range))
next range
while dialog(0)<>1:wend
classchosen=dialog(1)
window close(2)
select case classchosen
    case 1 'cleric selected
        hitpoints=int((6-1+1)*rnd+1)
        gosub socialhuman
        gosub familyhuman
    case 2 'fighter selected
        hitpoints=int((8-1+1)*rnd+1)
        gosub socialhuman
        gosub familyhuman
    case 3 'magicuser selected
        hitpoints=int((4-1+1)*rnd+1)
        gosub socialhuman
        gosub familyhuman
    case 4 'thief selected
        hitpoints=int((4-1+1)*rnd+1)
        gosub socialhuman
        gosub familyhuman
    case 5 'elf selected
        hitpoints=int((6-1+1)*rnd+1)
        gosub socialelf
        gosub familyelf
    case 6 'dwarf selected
        hitpoints=int((8-1+1)*rnd+1)
        gosub socialdwarf
        gosub family$="clan stronghollow"
    case 7 'halfling selected
        hitpoints=int((6-1+1)*rnd+1)
        gosub socialhin
        family$="five Shires"
    end select
return

socialhuman:
    social=int((100-1+1)*rnd+1)
    select case social
        case 1 to 30
            social$="penniless"
        case 31 to 60
            social$="struggling"
        case 61 to 75
            social$="comfortable"
        case 76 to 85
            social$="wealthy/untitled"
        case 86 to 95
            social$="wealthy/titled"
        case 96 to 97
            social$="very wealthy/untitled"
        case 98 to 99
            social$="very wealthy/titled"
        case 100
            social$=royal family
    end select
return

familyhuman:
    family=(int(social/2))+int((100-1+1)*rnd+1)
    select case family
    case 1 to 30
        family$="traladaran"
    case 31 to 90
        family$="mixed heritage"
    case 91 to 150
        family$="thyatian"
    end select
    if social$="royal family" then family$="thyatian"
return

socialelf:
    social=int((100-1+1)
    select case social
        case 1 to 90
            social$="common"
        case 91 to 100
            social$="lord"
    end select
return

familyelf:
    family=int((100-1+1)*rnd+1)
    select case family
        case 1 to 95
            family$="clan callarii"
        case 96 to 100
            family$="clan vyalia"
    end select
return

socialdwarf:
    social=int((100-1+1)*rnd+1)
    select case social
        case 1 to 30
            social$="struggling"
        case 31 to 60
            social$="comfortable"
        case 61 to 95
            social$="wealthy"
        case 96 to 97
            social$="very wealthy"
        case 98 to 100
            social$="ruling"
    end select
return

socialhin:
    social=int((100-1+1)*rnd+1)
    select case social
        case 1 to 20
            social$="penniless"
        case 21 to 50
            social$="struggling"
        case 51 to 95
            social$="comfortable"
        case 96 to 100
            social$="very wealthy"
    end select
return

hometown:
    if social$="royal family" then town$="specularum":goto jump
    if class$(classchosen)="dwarf" then town$="highforge":goto jump
    socialbonus=0
    if class$(classchosen)="halfling" then socialbonus=3
    if class$(classchosen)="elf" then socialbonus=3
    if social$="comfortable" then social bonus=2
    if social$="wealthy/titled" then social bonus=4
    if social$="very wealthy/titled" then social bonus=6
    if social$="wealthy/untitled" then social bonus=4
    if social$="very wealthy/untitled" then social bonus=6
    classbonus=0
    if class$(classchosen)="cleric" then classbonus=2
    if class$(classchosen)="magicuser" then classbonus=4
    town=(socialbonus+classbonus+int((20-1+1)*rnd+1))
    select case town
        case 1 to 3
            town$="fort doom (black eagle barony)"
        case 4
            town$="verge"
        case 5
            town$="sulescu"
        case 6
            town$="rugalov"
        case 7
            town$="marlinev"
        case 8
            town$="rifllian"
        case 9
            town$="vorloi"
        case 10
            town$="dmitrov"
        case 11
            town$="luln"
        case 12
            town$="threshold"
        case 13
            town$="penhaligon"
        case 14 to 16
            town$="kelvin"
        case 17 to 30
            town$="specularum"
    end select
    jump:
return

Offline

Like button can go here

#2 2005-08-08 00:53:57

Josh Cryer
Moderator
Registered: 2001-09-29
Posts: 3,830

Re: Something for the Fans of Old D&D

That code is evil and could probably be written in 50% less lines. Heh

The extensive use of GOTO is fun.


Some useful links while MER are active. [url=http://marsrovers.jpl.nasa.gov/home/index.html]Offical site[/url] [url=http://www.nasa.gov/multimedia/nasatv/MM_NTV_Web.html]NASA TV[/url] [url=http://www.jpl.nasa.gov/mer2004/]JPL MER2004[/url] [url=http://www.spaceflightnow.com/mars/mera/statustextonly.html]Text feed[/url]
--------
The amount of solar radiation reaching the surface of the earth totals some 3.9 million exajoules a year.

Offline

Like button can go here

#3 2005-08-08 17:09:57

srmeaney
Member
From: 18 tiwi gdns rd, TIWI NT 0810
Registered: 2005-03-18
Posts: 976

Re: Something for the Fans of Old D&D

That code is evil and could probably be written in 50% less lines. Heh

The extensive use of GOTO is fun.

What use of GOTO?


Oh! I get it , you're one of those people!


"Get back you C++ worshiper!" Waves Basic Programmers mannual menacingly.

Offline

Like button can go here

#4 2005-08-08 18:04:38

John Creighton
Member
From: Nova Scotia, Canada
Registered: 2001-09-04
Posts: 2,401
Website

Re: Something for the Fans of Old D&D

srmeaney wrote:

"Get back you C++ worshiper!" Waves Basic Programmers mannual menacingly.

Basic is really just an uglier less functional version of c. The languages really aren’t drastically that different. And Goto is a real primitive version of a loop or a funciton call.


Dig into the [url=http://child-civilization.blogspot.com/2006/12/political-grab-bag.html]political grab bag[/url] at [url=http://child-civilization.blogspot.com/]Child Civilization[/url]

Offline

Like button can go here

#5 2005-08-09 03:42:14

srmeaney
Member
From: 18 tiwi gdns rd, TIWI NT 0810
Registered: 2005-03-18
Posts: 976

Re: Something for the Fans of Old D&D

Basic is really just an uglier less functional version of c. The languages really aren’t drastically that different. And Goto is a real primitive version of a loop or a funciton call.

Ekk! Heretic! Run!


All right (feeling suspiciously brainwashed by evil C++ Cultist) you may rewrite the above program in C, but only if you retain a "windows" or "Macintosh-windows" interface.


also, how is the Mars game progressing?

Offline

Like button can go here

#6 2005-08-09 18:27:08

John Creighton
Member
From: Nova Scotia, Canada
Registered: 2001-09-04
Posts: 2,401
Website

Re: Something for the Fans of Old D&D

Basic is really just an uglier less functional version of c. The languages really aren’t drastically that different. And Goto is a real primitive version of a loop or a funciton call.

Ekk! Heretic! Run!


All right (feeling suspiciously brainwashed by evil C++ Cultist) you may rewrite the above program in C, but only if you retain a "windows" or "Macintosh-windows" interface.


also, how is the Mars game progressing?

Nah, I would be more interested in creating a c function that can call your basic function. I am not one to reinvent the wheel, unless I have a learning objective in mind. As for C I am really not such a fan of it either but it does look better then basic and is easy enough to translate into assembly manually that it is well suited for writing hardware.

I would use C if speed is my concern otherwise I would prefer to use java and for most stuff I do I would prefer to use something higher level MATLAB or MAPLE. I think java looks slightly better then c. I do think there is room for a lot of improvement in computer languages.

As for the game I haven’t really done much with it. I have been modifying an army system game similar to kings of chaos but that has nothing to do with mars. You can see the modifications I did to it here:
http://www.ipbgaming.com/forum/index.php?showtopic=343
(note that my user name on that forum is s243a.)

I really don’t have the time to take on a project like this by myself. I have been working on my thesis more lately so I have had less time lately to work on the game in that other link. I would be willing to help though if anyone wanted to start working on a game either for these boards or some other message boards. I think we could get something simple up quickly and keep building from there.


Dig into the [url=http://child-civilization.blogspot.com/2006/12/political-grab-bag.html]political grab bag[/url] at [url=http://child-civilization.blogspot.com/]Child Civilization[/url]

Offline

Like button can go here

#7 2005-08-10 05:55:54

srmeaney
Member
From: 18 tiwi gdns rd, TIWI NT 0810
Registered: 2005-03-18
Posts: 976

Re: Something for the Fans of Old D&D

I think java looks slightly better then c. I do think there is room for a lot of improvement in computer languages.

they all need to be brought up to a Mac Basic interface standard as minimum.

Offline

Like button can go here

#8 2005-08-10 21:01:06

John Creighton
Member
From: Nova Scotia, Canada
Registered: 2001-09-04
Posts: 2,401
Website

Re: Something for the Fans of Old D&D

I think java looks slightly better then c. I do think there is room for a lot of improvement in computer languages.

they all need to be brought up to a Mac Basic interface standard as minimum.

And what do you mean by that?


Dig into the [url=http://child-civilization.blogspot.com/2006/12/political-grab-bag.html]political grab bag[/url] at [url=http://child-civilization.blogspot.com/]Child Civilization[/url]

Offline

Like button can go here

#9 2005-08-11 18:46:20

srmeaney
Member
From: 18 tiwi gdns rd, TIWI NT 0810
Registered: 2005-03-18
Posts: 976

Re: Something for the Fans of Old D&D

I think java looks slightly better then c. I do think there is room for a lot of improvement in computer languages.

they all need to be brought up to a Mac Basic interface standard as minimum.

And what do you mean by that?

If C had had the visual simplicity of Mac Basic, when I was learning programming, I'd be into C. Unfortunately the codeset was primitive and restricting.

Offline

Like button can go here

#10 2005-08-11 22:52:15

John Creighton
Member
From: Nova Scotia, Canada
Registered: 2001-09-04
Posts: 2,401
Website

Re: Something for the Fans of Old D&D

If C had had the visual simplicity of Mac Basic, when I was learning programming, I'd be into C. Unfortunately the codeset was primitive and restricting.

Yeah, I don't think I'd recommend c as a first language, mostly because pointers can be confusing for beginners but I definitely would teach it over the quick basic you presented. I would recommend Java for a first language although because c is more low level some would recommend c over java as first language because it would make the programmer think more like the computer. They may consider Java too abstract. Java also isn't used very much in engineering and c is used a lot in hardware programming. If you are looking for a nice easy way to do get started with GUIs I suppose visual basic could be alright and it would be at least useful for windows programmers. However, the visual method of producing GUIs can actually be more work in larger projects

I do find visual basic ugly but not as ugly as quick basic you presented so I still put c in the lead. I've looked at lisp and Haskel and prolog. Haskel is way too advanced for beginners and prolog is even harder to grasp. Lisp has the advantage of being a higher level language, it has aspects of function programming and it is the only language to implement all of the recommendations for object oriented programming.

Lisp seems like a very good choice to me for a first language but I haven't really done much of it. I have read a book on perl and done some programming in php and they seem to have a week object oriented model but are very handy for string processing and databases.

It seems that all languages are lacking in some respect but you have the freedom to use what language best suits the task you are doing. I find my self using C, MATLAB, PHP, and Visual Basic the most. Despite Java being easy and pretty I haven't found much use for it because it really isn't the best tool for any particular task I do.

I use C to program hardware, MATLAB for numeric work, Visual Basic to write macros for word and excel and PHP to interact with databases and message boards. I'm sure I'll find a use for Java yet but that doesn't mean it is not a good language to teach programming. However I think lisp would probably be better and hope to learn it someday.

P.S. I am sure you could find a good integrated development environment for c to make it easier to program in. However, before deciding what langue is best for you must decide what you want to do with it. Also don't be afraid of trying a new language you will find that most of what you can do in quick basic you can do in other languages and the learning curve will be a lot less steep then you think.


Dig into the [url=http://child-civilization.blogspot.com/2006/12/political-grab-bag.html]political grab bag[/url] at [url=http://child-civilization.blogspot.com/]Child Civilization[/url]

Offline

Like button can go here

#11 2005-08-15 20:19:55

Josh Cryer
Moderator
Registered: 2001-09-29
Posts: 3,830

Re: Something for the Fans of Old D&D

Scheme is one of the better languages to get started on in my opinion, one of the best books on computer programming is SICP.

Another fun language to start with is Logo.

Ocaml or any of the ML languages are fun, too.


Some useful links while MER are active. [url=http://marsrovers.jpl.nasa.gov/home/index.html]Offical site[/url] [url=http://www.nasa.gov/multimedia/nasatv/MM_NTV_Web.html]NASA TV[/url] [url=http://www.jpl.nasa.gov/mer2004/]JPL MER2004[/url] [url=http://www.spaceflightnow.com/mars/mera/statustextonly.html]Text feed[/url]
--------
The amount of solar radiation reaching the surface of the earth totals some 3.9 million exajoules a year.

Offline

Like button can go here

#12 2005-08-15 20:32:28

John Creighton
Member
From: Nova Scotia, Canada
Registered: 2001-09-04
Posts: 2,401
Website

Re: Something for the Fans of Old D&D

Scheme is one of the better languages to get started on in my opinion, one of the best books on computer programming is SICP.

Another fun language to start with is Logo.

Ocaml or any of the ML languages are fun, too.

Scheme is basically a simplified lisp so I agree that it is a great place to start for beginners. I have tried the functional programming language Haskell and found it rather challenging and if Ocaml is the simmilar I question if it might be too difficult for a first computer language. However, perhaps the challenge will be well worth the results in terms of a deeper understanding of programming concepts. Logo I haven’t tried.


Dig into the [url=http://child-civilization.blogspot.com/2006/12/political-grab-bag.html]political grab bag[/url] at [url=http://child-civilization.blogspot.com/]Child Civilization[/url]

Offline

Like button can go here

Board footer

Powered by FluxBB