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

Gammon Forum

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

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  VBscript
. . -> [Subject]  need help
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

need help

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


Posted by Crea3644   (13 posts)  [Biography] bio
Date Sun 04 Jun 2006 03:48 PM (UTC)
Message
Hi, Making a char roller script for Realms of Despair
Here is what I got so far but cannot get it completed and am getting flustered
If anyone could help me out it would be appreciated, thanks

<triggers>
<trigger
enabled="y"
group="Stats"
match="Charisma * *"
name="Cha"
send_to="9"
sequence="100"
variable="Cha"
>
<send>%1</send>
</trigger>
<trigger
enabled="y"
group="Stats"
match="Constitution * *"
name="Con"
send_to="9"
sequence="100"
variable="Con"
>
<send>%1</send>
</trigger>
<trigger
enabled="y"
group="Stats"
match="Dexterity * *"
name="Dex"
send_to="9"
sequence="100"
variable="Dex"
>
<send>%1</send>
</trigger>
<trigger
enabled="y"
group="Stats"
match="Intelligence * *"
name="Int"
send_to="9"
sequence="100"
variable="Int"
>
<send>%1</send>
</trigger>
<trigger
enabled="y"
group="Stats"
match="Luck * *"
name="Lck"
send_to="9"
sequence="100"
variable="Lck"
>
<send>%1</send>
</trigger>
<trigger
enabled="y"
group="Stats"
match="Strength * *"
name="Str"
send_to="9"
sequence="100"
variable="Str"
>
<send>%1</send>
</trigger>
<trigger
enabled="y"
group="Stats"
match="Wisdom * *"
name="Wis"
send_to="9"
sequence="100"
variable="Wis"
>
<send>%1</send>
</trigger>
<trigger
enabled="y"
group="Stats"
match="Your character's base stats have been rerolled..."
name="Start"
sequence="100"
>
</trigger>
</triggers>

<aliases>
<alias
name="Wanted_Cha"
match="SetCha *"
enabled="y"
echo_alias="y"
group="Stats"
variable="ZCha"
omit_from_command_history="y"
send_to="9"
ignore_case="y"
sequence="100"
>
<send>%1</send>
</alias>
<alias
name="Wanted_Con"
match="SetCon *"
enabled="y"
echo_alias="y"
group="Stats"
variable="ZCon"
omit_from_command_history="y"
send_to="9"
ignore_case="y"
sequence="100"
>
<send>%1</send>
</alias>
<alias
name="Wanted_Dex"
match="SetDex *"
enabled="y"
echo_alias="y"
group="Stats"
variable="ZDex"
omit_from_command_history="y"
send_to="9"
ignore_case="y"
sequence="100"
>
<send>%1</send>
</alias>
<alias
name="Wanted_Int"
match="SetInt *"
enabled="y"
echo_alias="y"
group="Stats"
variable="ZInt"
omit_from_command_history="y"
send_to="9"
ignore_case="y"
sequence="100"
>
<send>%1</send>
</alias>
<alias
name="Wanted_Lck"
match="SetLck *"
enabled="y"
echo_alias="y"
group="Stats"
variable="ZLck"
omit_from_command_history="y"
send_to="9"
ignore_case="y"
sequence="100"
>
<send>%1</send>
</alias>
<alias
name="Wanted_Str"
match="SetStr *"
enabled="y"
echo_alias="y"
group="Stats"
variable="ZStr"
omit_from_command_history="y"
send_to="9"
ignore_case="y"
sequence="100"
>
<send>%1</send>
</alias>
<alias
name="Wanted_Wis"
match="SetWis *"
enabled="y"
echo_alias="y"
group="Stats"
variable="ZWis"
omit_from_command_history="y"
send_to="9"
ignore_case="y"
sequence="100"
>
<send>%1</send>
</alias>
</aliases>

<variables>
<variable name="Cha">11</variable>
<variable name="Con">14</variable>
<variable name="Dex">12</variable>
<variable name="Int">15</variable>
<variable name="Lck">13</variable>
<variable name="Str">15</variable>
<variable name="Wis">15</variable>
<variable name="ZCha">9</variable>
<variable name="ZCon"></variable>
<variable name="ZDex">9</variable>
<variable name="ZInt"></variable>
<variable name="ZLck"></variable>
<variable name="ZStr">9</variable>
<variable name="ZWis"></variable>
</variables>
[Go to top] top

Posted by Crea3644   (13 posts)  [Biography] bio
Date Reply #1 on Sun 04 Jun 2006 03:49 PM (UTC)
Message
CONT..


--- Varibles not all set right yet, No problem seems to be there
The Triggers automaticaly grab the stats fine and store them to the vars
The Z Vars are the minimum number for wanted for each stat rolled

The Output I get from the mud is:

vv Command prompt
<Type HELP START>reroll
-- Me Typing Reroll command and output from mud below

Your character's base stats have been rerolled...
New Previous
Strength 15 13
Dexterity 12 14
Intelligence 15 15
Wisdom 15 15
Charisma 11 13
Constitution 14 14
Luck 13 11

The script I have got together so far is--

sub ReRoll_Check (thename, theoutput, thewildcards)

dim Str
dim ZStr
dim Dex
dim ZDex
dim Int
dim ZInt
dim Wis
dim ZWis
dim Cha
dim ZCha
dim Con
dim ZCon
dim Lck
dim ZLck

Str = world.GetVariable ("Str")
ZStr = world.GetVariable ("ZStr")
Dex = world.GetVariable ("Dex")
ZDex = world.GetVariable ("ZDex")
Int = world.GetVariable ("Int")
ZInt = world.GetVariable ("ZInt")
Wis = world.GetVariable ("Wis")
ZWis = world.GetVariable ("ZWis")
Cha = world.GetVariable ("Cha")
ZCha = world.GetVariable ("ZCha")
Con = world.GetVariable ("Con")
ZCon = world.GetVariable ("ZCon")
Lck = world.GetVariable ("Lck")
ZLck = world.GetVariable ("ZLck")

If Str => ZStr then
world.note "Strength is Good"
Else
world.note "Strength No Good"
world.send "ReRoll"
Exit Sub
End If

If Dex => ZDex then
world.note "Dexterity is Good"
Else
world.note "Dexterity No Good"
world.send "ReRoll"
Exit Sub
End If

If Int => ZInt then
world.note "Intelligence is Good"
Else
world.note "Intelligence No Good"
world.send "ReRoll"
Exit Sub
End If

If Wis => ZWis then
world.note "Wisdom is Good"
Else
world.note "Wisdom No Good"
world.send "ReRoll"
Exit Sub
End If

If Cha => ZCha then
world.note "Charisma is Good"
Else
world.note "Charisma No Good"
world.send "ReRoll"
Exit Sub
End If

If Con => ZCon then
world.note "Constitution is Good"
Else
world.note "Constitution No Good"
world.send "ReRoll"
Exit Sub
End If

If Lck => ZLck then
world.note "Luck is Good"
Else
world.note "Luck No Good"
world.send "ReRoll"
Exit Sub
End If

end sub

any help or suggestions on this would be helpful, any questions please ask
Thank you
Bill
[Go to top] top

Posted by Crea3644   (13 posts)  [Biography] bio
Date Reply #2 on Sun 04 Jun 2006 09:40 PM (UTC)
Message
Hmm Just noticed a couple posts that said Lua is better for scripting nowadays, Is it similar to VBScript? It's been quite awhile since I have done any scripts, Lua hard to learn? would I be better off starting out with out for this script rather than VBScript? before I get too far in and have to change 3 or 4 scripts over to it?
[Go to top] top

Posted by Ked   Russia  (524 posts)  [Biography] bio
Date Reply #3 on Mon 05 Jun 2006 05:13 AM (UTC)
Message
Anything is better than Vbscript, and Lua is definitely more usable. It's not hard to learn at all, especially since it is actually better documented: lua.org/docs.html has plenty of documentation, plus there is a score of general and Mushclient-specific examples posted here by Nick.
[Go to top] top

Posted by Nick Gammon   Australia  (21,669 posts)  [Biography] bio   Forum Administrator
Date Reply #4 on Mon 05 Jun 2006 10:44 PM (UTC)
Message
Just to show a part of your script in Lua:


if Cha >= ZCha then
  Note "Charisma is Good"
else
  Note "Charisma No Good"
  Send "ReRoll"
  return
end --If


It really is very similar to what you had (the world.xxx part is optional in both languages).

However capitalization is important in Lua. Thus "If" becomes "if" and "note" becomes "Note".

"Exit Sub" becomes "return".
The comparison "=>" should be ">=".

You could fix up those things with a quick find-and-replace.

I did a post here that shows how you can use the Global Replace dialog to fix up the capitalization of all function names very easily:

http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=6211


- Nick Gammon

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

Posted by Crea3644   (13 posts)  [Biography] bio
Date Reply #5 on Tue 06 Jun 2006 03:23 PM (UTC)
Message
Thanks, This thread can be closed :) any more to follow I will move to Lua Section.
[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.


4,641 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

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

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]