[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  VBscript
. . -> [Subject]  Converting LUA scripts to vbscript

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?
(New message)
Subject: Converting LUA scripts to vbscript
Name:
Your forum user name.
Register forum user name
Password:
Your forum password.
Forgotten password?
Message:
Message to be posted (in English, please).
Forum codes:
Check this if your message uses 'forum codes' or templates (auto-detected for new posts).
Forum codes Templates

Save this message ...


Subject review (reverse sequence)

Posted by Ashass   (50 posts)  [Biography] bio
Date Fri 26 Nov 2010 01:25 AM (UTC)  quote  ]
Message
It's more of a proof of concept project, I am familiar with VBA which is pretty much vbscript, granted, it's not my language of choice, but oh well. the ODBC connection to MSSQL is to see just how far I can take things for storage, automation, and integration [to web services]

Also going to see about connecting a local ASP page to an external MySQL database to see if I can go from my client->local database->local website->external website->external database [just to see what I can integrate with]

One of the next few thing's I'm going to be doing, is taking an ASP page and making a GUI representation of certain things, such as fights, spells cast on me [durations left], maps of areas, etc. that can be up next to your mud window to see graphically what normally you have to do score/inventory/map etc.

Just poking the boundaries to see when things break, then when they break, see if there is a way to fix it or work around it to do what I want.

Would be much harder to do this with LUA script [for me, anyway] - because in addition to not knowing the language very well, it doesn't integrate as cleanly as vbscript does into a large slew of different projects.
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Thu 25 Nov 2010 10:35 PM (UTC)  quote  ]
Message
OK, good. Although the original post asked how to convert from Lua to VBscript to resolve problems with MSSQL.

Personally I prefer Lua, and if you have problems with the ODBC SQL I would try to resolve those.

Also, if this is a single-user database, you might consider using SQLite3, which is built into MUSHclient, so you don't need to have external database engines around.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Ashass   (50 posts)  [Biography] bio
Date Thu 25 Nov 2010 06:00 PM (UTC)  quote  ]

Amended on Thu 25 Nov 2010 09:34 PM (UTC) by Ashass

Message
[ALL ISSUES RESOLVED - topic can be closed]

<triggers>
  <trigger
   keep_evaluating="y"
   match="^\&lt;(\d+)\/(\d+)hp\, (\d+)\/(\d+)m\, (\d+)\/(\d+)mv\, (.*)\&gt; (?&lt;hour&gt;\d+)\:(?&lt;minute&gt;\d+)(am|pm)\."
   regexp="y"
   send_to="12"
   sequence="100"
   variable="health"
  >
  <send>if %&lt;hour&gt; ~= old_hour or
%&lt;minute&gt; ~= old_minute then
old_hour = %&lt;hour&gt;
old_minute = %&lt;minute&gt;
DoAfterNote (34, "TICK IN 7 SECONDS!") -- 7 seconds warning
end -- if</send>
  </trigger>
</triggers>


Became

 <triggers>
  <trigger
   enabled="y"
   keep_evaluating="y"
   match="^\&lt;(\d+)\/(\d+)hp\, (\d+)\/(\d+)m\, (\d+)\/(\d+)mv\, (.*)\&gt; (?&lt;hour&gt;\d+)\:(?&lt;minute&gt;\d+)(am|pm)\."
   regexp="y"
   send_to="12"
   sequence="100"
   variable="health"
  >
  <send>if (%&lt;hour&gt; &lt;&gt; old_hour OR %&lt;minute&gt; &lt;&gt; old_minute) then
old_hour = %&lt;hour&gt;
old_minute = %&lt;minute&gt;
world.DoAfterNote 34, "TICK IN 7 SECONDS!" '7 seconds warning
end if</send>
  </trigger>
</triggers>




========================

<triggers>
  <trigger
   expand_variables="y"
   match="*[Str: *  Int: *  Wis: *  Dex: *  Con: *]"
   send_to="12"
   sequence="100"
  >
  <send>percent = math.floor (%2+%3+%4+%5+%6)
Note ("You rolled ", percent)
if(percent &gt;= 240) then
  Send "y"
end -- if

if(percent &lt; 240) then
  Send ""
  Send "n"
end -- if</send>
  </trigger>
</triggers>


became


Dim percent 
percent = (%1/%2 * 100)

if(percent >= 100) then
Note "You are in excellent condition."
end if

if(percent < 100 and percent >= 90) then
Note "You have a few scratches."
end if

if(percent < 90 and percent >= 75) then
Note "You have some small wounds and bruises"
end if

if(percent < 75 and percent >= 50) then
Note "You have quite a few wounds"
end if

if(percent < 50 and percent >= 30) then
Note "You have some big & nasty wounds"
end if

if(percent < 30 and percent >= 15) then
Note "You are pretty hurt"
end if

if(percent < 15 and percent > 0) then
Note "You are in awful condition"
end if

if(percent = 0) then
Note "You are dead!"
end if


=======================================

<triggers>
  <trigger
   expand_variables="y"
   keep_evaluating="y"
   match="&lt;*/*hp, */*m, */*mv, *&gt; *. *"
   send_to="12"
   sequence="100"
   variable="health"
  >
  <send>percent = math.floor (%1/%2 * 100)

if(percent &gt;= 100) then
Note "You are in excellent condition."
end -- if

if(percent &lt; 100 and percent &gt;= 90) then
Note "You have a few scratches."
end -- if

if(percent &lt; 90 and percent &gt;= 75) then
Note "You have some small wounds and bruises"
end -- if

if(percent &lt; 75 and percent &gt;= 50) then
Note "You have quite a few wounds"
end -- if

if(percent &lt; 50 and percent &gt;= 30) then
Note "You have some big &amp; nasty wounds"
end -- if

if(percent &lt; 30 and percent &gt;= 15) then
Note "You are pretty hurt"
end -- if

if(percent &lt; 15 and percent &gt; 0) then
Note "You are in awful condition"
end -- if

if(percent == 0) then
Note "You are dead!"
end -- if</send>
  </trigger>
</triggers>


Became


<triggers>
  <trigger
   enabled="y"
   expand_variables="y"
   match="*[Str: *  Int: *  Wis: *  Dex: *  Con: *]"
   send_to="12"
   sequence="100"
  >
  <send>total = %2+%3+%4+%5+%6
Note "You rolled " &amp; total
if(total &gt;= 240) then
  Send "y"
end if

if(percent &lt; 240) then
  Send ""
  Send "n"
end if</send>
  </trigger>
</triggers>
[Go to top] 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.


1,235 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]