... 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 :)
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
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)
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.
if world.getvariable (arrWildCards (1) & "Gold") < arrWildCards & (2) * 100 then world.send "say " & arrWildCards & (1) & ", You do not have enough Gold to purchase " & arrWildCards & (2) & " Potions!"
if world.getvariable (arrWildCards & (1) & "Gold")>= arrWildCards & (2) * 100 then world.send "say " & arrWildCards (1) & " " & arrWildCards & (2) & " Potions have been added to your account! " & arrWildCards & (2) * 100 & " Gold has been removed from your account!"
Wrong : arrWildCards & (1)
Right : arrWildcards(1)
you made those errors throughout most of the lines.
Now:
if world.getvariable (arrWildCards(1) & "Gold") < arrWildCards(2) * 100 then
world.send "say " & arrWildCards(1) & ", You do not have enough Gold to purchase " & arrWildCards(2) & " Potions!"
end if
if world.getvariable (arrWildCards(1) & "Gold") >= arrWildCards(2) * 100 then
world.send "say " & arrWildCards(1) & " " & arrWildCards(2) & " Potions have been added to your account! " & arrWildCards(2) * 100 & " Gold has been removed from your account!"
end if
Ok.. when writing your own code remember to make it look nice, I can understand it better if it is not cluttered up
split the lines, I know there is a character in VB to notify it to split a line in two, I cant remember it now though
I have Variables containing a "money" stat, and when the player gets enough money.. they can buy potions..
Now, the potions cost 100 each... so the player will say "Buy 5 potions" the potions will be added to the players stats, and the correct amount of money will be removed from the stats.
Now... how can I do this?
Like always, I've been experimenting, and have come up with this:
if world.getvariable (arrWildCards (1) & "Gold") < arrWildCards & (2) * 100 then world.send "say " & arrWildCards & (1) & ", You do not have enough Gold to purchase " & arrWildCards & (2) & " Potions!"
if world.getvariable (arrWildCards & (1) & "Gold")>= arrWildCards & (2) * 100 then world.send "say " & arrWildCards (1) & " " & arrWildCards & (2) & " Potions have been added to your account! " & arrWildCards & (2) * 100 & " Gold has been removed from your account!"
if mid(lcase(world.getvariable(arrWildCards(1) & "Slot1")),1,7) = "(empty)" then
world.send "say " & arrWildCards (1) & ", You do not currently have anything in that slot"
else
world.send "say " & arrWildCards (1) & "" & world.getvariable (arrWildCards (1) & "slot1") & ""
end if
Hmm... it did look alright before too, but try the above instead
Some of my variables contain "(Empty)" because they won't be used until that player does certain things...
Now... when someone says "Blah blah slot 1"
It says back all the variables that contain the "(empty)" word... and I don't want it to..
How can I fix this?
I've been experimenting, and have come up with this..
if world.getvariable (arrWildCards (1) & "Slot1") = ("(Empty)") then
world.send "say " & arrWildCards (1) & ", You do not currently have anything in that slot"
else
world.send "say " & arrWildCards (1) & "" & world.getvariable (arrWildCards (1) & "slot1") & ""
end if
But.. of course.. if that worked, I wouldn't be putting it here...
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.