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
➜ General
➜ Problems With Scripting Variables
|
Problems With Scripting Variables
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Pages: 1
2
| Posted by
| Rhinoa
United Kingdom (37 posts) Bio
|
| Date
| Reply #15 on Wed 26 Dec 2001 01:22 PM (UTC) |
| Message
| Actually that didn't work.. and only seemed to work the first time I tried it =(
I've got it done now though, using the code you suggested..
sub CalculateBuyPokeBalls (strName, trig_line, arrWildCards)
if arrWildCards (2) * 100 > world.getvariable (arrWildCards (1) & "Gold") * 1 then
world.send "wh " & arrWildCards (1) & " You do not have enough Gold to purchase " & arrWildCards (2) & " Pokeballs!"
end if
if arrWildCards (2) * 100 =< world.getvariable (arrWildCards (1) & "Gold") * 1 then
world.send "wh " & arrWildCards (1) & " " & arrWildCards(2) & " Pokeballs have been added to your account! " & arrWildCards (2) * 100 & " Gold has been removed from your account!"
end if
end sub
The only thing missing was the * 1 with the Gold variable.. and the arrwildcards (1) and get variable needed to be switched. (Don't know why.. just seems to work that way)other then that, it all worked.
~Rhinoa~ | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #16 on Tue 01 Jan 2002 07:03 AM (UTC) |
| Message
|
Quote:
I know there is a character in VB to notify it to split a line in two, I cant remember it now though
That character is the underscore (_). eg.
if arrWildCards (2) * 100 > _
world.getvariable (arrWildCards (1) & "Gold") * 1 then
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Rhinoa
United Kingdom (37 posts) Bio
|
| Date
| Reply #17 on Thu 03 Jan 2002 04:16 PM (UTC) |
| Message
| New problem...
People that have a space in they're name (eg. Storm Dragon) are joining.. and no variable is being created for them (Because you can have spaces in variables)
How can I fix this?
No idea how to even start this... :(
~Rhinoa~ | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #18 on Thu 03 Jan 2002 09:12 PM (UTC) |
| Message
| | Replace the space in the variable name with an underscore, when storing it, and replace the underscore with a space if you need to get it back. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Storm Dragon
Denmark (45 posts) Bio
|
| Date
| Reply #19 on Thu 03 Jan 2002 09:34 PM (UTC) Amended on Thu 03 Jan 2002 09:35 PM (UTC) by Storm Dragon
|
| Message
| *cough* *cough*
Well.... lets see..
public SDfinal
sub SpaceToUnderscore(Incomming)
dim x
'This sub should convert spaces into underscores *shiver*
SDfinal = ""
for x = 1 to len(Incomming)
if mid(Incomming, x, 1) = " " then
SDfinal = SDfinal & "_"
else
SDfinal = SDfinal & mid(Incomming, x, 1)
end if
next
end sub
sub testscript(TrigName, TrigLine, WildCards)
call SpaceToUnderscore(WildCards(1))
world.setvariable SDfinal, "100"
end sub
I hope you can see what this does, I'm too lazy to explain at the moment and too lazy to include too many remark lines
good luck
ah yes, and you can easilly invert it too | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #20 on Fri 04 Jan 2002 12:44 AM (UTC) |
| Message
| I had in mind something a bit simpler, using "replace". :)
Try this:
/world.note replace ("Nick Gammon wrote MUSHclient", " ", "_")
So, just use "replace" when you store the variable name, eg.
world.setvariable replace (playername, " ", "_"), contents
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Storm Dragon
Denmark (45 posts) Bio
|
| Date
| Reply #21 on Fri 04 Jan 2002 12:00 PM (UTC) |
| Message
| ... Was not aware there was such a routine
*shrug* Well I only know the old basic stuff :P
and I have no manuals on VB either.. it is nice to learn new stuff :) | | Top |
|
| Posted by
| Rhinoa
United Kingdom (37 posts) Bio
|
| Date
| Reply #22 on Sat 05 Jan 2002 03:12 AM (UTC) |
| Message
| | Isn't there a simpler way of doing it (I have alot of variables) | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #23 on Sat 05 Jan 2002 06:05 AM (UTC) |
| Message
| Well, that only applies to the player name. If you have to set a lot of them you could make a small sub that sets a player name to a value, eg.
sub setvalue (playername, newvalue)
world.setvariable replace (playername, " ", "_"), newvalue
end sub
Then use that in place of the "setvariable" you currently do. You could do that with a global find-and-replace. |
- 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.
81,926 views.
This is page 2, subject is 2 pages long:
1
2
It is now over 60 days since the last post. This thread is closed.
Refresh page
top