Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ VBscript ➜ Handling numerous speedwalks - and using a database

Handling numerous speedwalks - and using a database

It is now over 60 days since the last post. This thread is closed.     Refresh page


Pages: 1  2  3  4 

Posted by Shadowfyr   USA  (1,791 posts)  Bio
Date Reply #45 on Thu 12 Sep 2002 10:52 PM (UTC)

Amended on Thu 12 Sep 2002 10:53 PM (UTC) by Shadowfyr

Message
True Nick. I hadn't thought of using a single request, but then breaking it up like that would also tend to mean that you have to enter each record for the weapon's types seperately. Otherwise you are right back to 'will this form store all the values or only one?' problem he already has. Unless you can build a script in the form within Access, (paradox allows this, as does dBase, but where talking about an MS -we do it all for you, so it won't work right- product). lol Even if I had it installed I would probably not use it to design it as Magnum is doing, since I would have to rewrite most of the stuff the form does in vbscript anyway. And if that is the case, why do it the way Access would in the first place? ;)
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #46 on Fri 13 Sep 2002 01:58 AM (UTC)

Amended on Fri 13 Sep 2002 02:01 AM (UTC) by Nick Gammon

Message

Look, this is what I am talking about ...

Example of doing a form in Access

Near the bottom of the form is the sub-form which shows all records (any number) from the weapon/damage table. As you can see it is nice and visual, you can click on any one and delete it, or click on the new record symbol ">*" to add a new one. You just select them from the combo box. Nice and simple.

This example does not use any scripting.


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Shadowfyr   USA  (1,791 posts)  Bio
Date Reply #47 on Fri 13 Sep 2002 03:01 AM (UTC)
Message
Ok. That is nice. So you can test it in there. However I still stand by the statement that you end up having to produce the same result in vbscript, once you do have it working. It does not therefore benefit you to even try to do it inside Access itself, unless you really think you want to look at it when not inside mushclient. If all computers had two monitors and dual-head graphics cards, maybe it would be, since you could then drop Access on the second display, but for the purposes of using the database from mushclient on most computers, it is imho not necessarilly that helpful.

But that is just my personal opinion. ;)
Top

Posted by Magnum   Canada  (580 posts)  Bio
Date Reply #48 on Fri 13 Sep 2002 05:03 AM (UTC)
Message
Currently, all of my items are stored in an Excel spreadsheet. The one benefit to this, is that it visually looks very pretty.

I don't know how practical it is to write VBScript to both retrieve and create/modify data in a spreadsheet. I figured a database might be better. (MS Access, since I have it).

Naturally, the first step for me, is to get it all working right in Access. Later I will try and iteract with the database using MUSHclient scripts.

There are three main item types: Weapons, wearable/holdable items, and 'the rest'. I figured it would be sensible to put them all in ONE database, even though it would mean that some fields would be marked "Not applicable".

Eventually, it would be sweet to be able to use an alias to do an item search on pretty much any field.

A third option I considered, was just to provide a checkbox (Boolean) field for each damage type, and just check the ones that are appropriate. On the form, I might try and program it so that it would be impossible to have "Not applicable" checked while any damage type is checked. Shouldn't be too hard.

It's highly unlikely that any new damage types will ever be introduced. Even if they are, Access allows you to add a new field to an existing database, though it may take some hard drive thrashing time to get it done.

In respect to my original plan, I can see that I might have to abandon it, though I hate doing so without learning how to manage the problem. Part of the reason I took this project on was just to learn how to use Access. I still have a feeling there is a simple fix, but that no one seems to know what it is.

Anyway, with that proposition I just offered, I guess I now have three choices: Checkboxes, bit-map, or Nick's special lookup.

I'll mull it over a little while longer... see what you think of my idea, then maybe I'll take another stab at it soon.

Get my plugins here: http://www.magnumsworld.com/muds/

Constantly proving I don't know what I am doing...
Magnum.
Top

Posted by Magnum   Canada  (580 posts)  Bio
Date Reply #49 on Fri 13 Sep 2002 05:11 AM (UTC)
Message
Oops, I went back to look at page 3, and forgot there was a page 4.

That looks pretty good, Nick. I kind of wanted to display my own form window like you did, but only you can do that. :)

Are there any measures in place to keep me (the user) from selecting the same damage type twice within the sub-form? If it's not built in, I assume I can write VBS behind the scene's to error check. (Something you were wondering about Shadowfyr - Yes, it is possible). I have barely glanced at that though. This is my first time using Access. I haven't touched a database program since DBase IV, 15 years ago or so. (Ran under DOS).

Do you still feel this is a better method than the one I mentioned in my last post?

Thanks a ton for your assistance, Nick (and others). Much appreciated. :)

Get my plugins here: http://www.magnumsworld.com/muds/

Constantly proving I don't know what I am doing...
Magnum.
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #50 on Fri 13 Sep 2002 05:23 AM (UTC)
Message
Quote:

Are there any measures in place to keep me (the user) from selecting the same damage type twice within the sub-form?


The combination of weapon/damage is the primary key, and you cannot have two primary keys the same, thus an attempt to add two of them will be rejected by Access.

You can have the modified database back if you want.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Magnum   Canada  (580 posts)  Bio
Date Reply #51 on Fri 13 Sep 2002 04:16 PM (UTC)
Message
Yes, please mail it back to me. :)

Get my plugins here: http://www.magnumsworld.com/muds/

Constantly proving I don't know what I am doing...
Magnum.
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #52 on Fri 13 Sep 2002 10:17 PM (UTC)
Message
OK, I emailed it to you. I did a query to show how you would get the list of weapon types back in a single query.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Ishnaf   Australia  (17 posts)  Bio
Date Reply #53 on Sun 29 Sep 2002 04:07 PM (UTC)
Message
Gday People.

I was wondering if i could get a copy of some of the files you used to create this project- I'm having similar sorts of trouble in my speedwalking project (see browsers and mushclient post). When I manage to get my program done i'll let everyone know...

egads!
Top

Posted by Magnum   Canada  (580 posts)  Bio
Date Reply #54 on Sun 29 Sep 2002 09:56 PM (UTC)
Message
I haven't actually returned to this project since recieving the file from Nick. It's rather low priority for me so there is no hurry, although pretty educational as well, so I probably will get around to it sooner or later.

Your E-mail address is private in your bio, so I can't mail it to you. Mine is private too, so you can't mail me....

Ok, download it here: http://www.MagnumsWorld.com/ftp/AODitems.zip

I can't guarantee the file will stay there long term.


Get my plugins here: http://www.magnumsworld.com/muds/

Constantly proving I don't know what I am doing...
Magnum.
Top

Posted by Ishnaf   Australia  (17 posts)  Bio
Date Reply #55 on Mon 30 Sep 2002 01:24 PM (UTC)

Amended on Mon 30 Sep 2002 01:29 PM (UTC) by Ishnaf

Message
Thanks for those files, but now i have yet another question:

I've been attempting to make an item database.... It gets the item info from the mud and stores it in variables, passes this to the active x control, and then *should* pass it into a database. I figure its probably my coding, and i know the problem is in the active X, but not what it is :P. Here it is (i've added comments in !signs)

Public theworld As World

Sub GetStuff(theworld As World)
Dim object, itemtype, itemis, forgelvl, diceno, dicesize, !etc!



object = theworld.GetVariable("Object")
itemtype = theworld.GetVariable("ItemType")

!This is supposed to make one big field out of several variables!
itemis = theworld.GetVariable("ItemIs") + _
theworld.GetVariable("Savingpara") + _
theworld.GetVariable("Savingspell") + _
theworld.GetVariable("Poison") + _
theworld.GetVariable("spell") + _
theworld.GetVariable("abilities") + _
theworld.GetVariable("capacity")

forgelvl = theworld.GetVariable("ForgeLvl")
diceno = theworld.GetVariable("DiceNo")
dicesize = theworld.GetVariable("DiceSize")
!and etc!


Dim db
Set db = CreateObject("ADODB.Connection")

' Open the connection
db.Open = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Program Files\MUSHclient\ishnaf\DBproject\newdatabase.mdb"

db.Execute "INSERT INTO Items (Item, ItemType, ItemIs, ForgeLevel, DiceNo, DiceSize, Weight, Value, Rent, ACApply, Armor, CON, INT, WIS, DEX, CHA, STR, Hitroll, Damroll, maxhit, maxmana, Uselevel, Age) VALUES (" & _
"""" & Item & """, " & _
"""" & itemtype & """, " & _
"""" & itemis & """, " & _
"""" & ForgeLevel & """, " & _
"""" & diceno & """, " & _
!"""" & all the other bits& """, " & _!
"""" & dicesize & """ );"

db.Close
Set db = Nothing
End Sub



Hope you can understand that :)

egads!
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #56 on Tue 01 Oct 2002 12:05 AM (UTC)
Message
Try doing it into a variable and displaying that. eg.

x = "INSERT INTO Items (Item ... blah blah ...
world.note x
db.Execute x

That way you can see if the SQL looks OK.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #57 on Thu 07 Nov 2002 02:26 AM (UTC)
Message

I have now written a lengthy plugin to demonstrate creating a database, creating a table, adding data, getting it back, deleting it, and general actions on it.

See Plugin that accesses a database


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


165,971 views.

This is page 4, subject is 4 pages long:  [Previous page]  1  2  3  4 

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.