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
➜ Converting LUA scripts to vbscript
|
Converting LUA scripts to vbscript
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Ashass
(50 posts) Bio
|
| Date
| Thu 25 Nov 2010 06:00 PM (UTC) 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="^\<(\d+)\/(\d+)hp\, (\d+)\/(\d+)m\, (\d+)\/(\d+)mv\, (.*)\> (?<hour>\d+)\:(?<minute>\d+)(am|pm)\."
regexp="y"
send_to="12"
sequence="100"
variable="health"
>
<send>if %<hour> ~= old_hour or
%<minute> ~= old_minute then
old_hour = %<hour>
old_minute = %<minute>
DoAfterNote (34, "TICK IN 7 SECONDS!") -- 7 seconds warning
end -- if</send>
</trigger>
</triggers>
Became
<triggers>
<trigger
enabled="y"
keep_evaluating="y"
match="^\<(\d+)\/(\d+)hp\, (\d+)\/(\d+)m\, (\d+)\/(\d+)mv\, (.*)\> (?<hour>\d+)\:(?<minute>\d+)(am|pm)\."
regexp="y"
send_to="12"
sequence="100"
variable="health"
>
<send>if (%<hour> <> old_hour OR %<minute> <> old_minute) then
old_hour = %<hour>
old_minute = %<minute>
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 >= 240) then
Send "y"
end -- if
if(percent < 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="<*/*hp, */*m, */*mv, *> *. *"
send_to="12"
sequence="100"
variable="health"
>
<send>percent = math.floor (%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</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 " & total
if(total >= 240) then
Send "y"
end if
if(percent < 240) then
Send ""
Send "n"
end if</send>
</trigger>
</triggers>
| | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Thu 25 Nov 2010 10:35 PM (UTC) |
| 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 | | Top |
|
| Posted by
| Ashass
(50 posts) Bio
|
| Date
| Reply #2 on Fri 26 Nov 2010 01:25 AM (UTC) |
| 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. | | 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.
15,804 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top