items with variable.

Zordon

Golden Oldie
Golden Oldie
Apr 26, 2008
1,176
20
145
Manchester, UK
Ok, do variables work with items like armors? I.e

If I have a script like such...

[@ArmourExchange]
#Say
Would you like to exchange your armor for a different sex?\
<Devine(M)/@ItemExchane(Devine(F))>\

Would that work?? Because I've tried using a script like that with a variable and I don't think it works because of the extra brackets... How would I do it?

Alternatively, If I used an inputstr would there be anyway of taking the (M) or (F) off of the end and then using an addstr A1 (M) command etc etc?? Something like such?

#ACT
FORMATSTR A1 -(F)
addstr A1 (M)

or does it not work in that way?
 
Last edited:

idaBigA

Holley Mir 3!!
VIP
Oct 28, 2003
1,966
110
310
Stoke, UK
Yeah, it sort of works that way..

Here >>

Code:
#SAY
Are you Male or Female (I know I can check this with a #IF but its a demo!)\
<[ Male ]/@GiveArmour(M)>\
<[ Female ]/@GiveArmour(F)>\

[@GiveArmour()]
#ACT
Mov  A0  "DragonArmour("
Mov  A1  %ARG(1)
AddStr A0 %A1
AddStr A0 ")"
Give A0 1
#SAY
Here is your <$OUTPUT(A0)>\

This will either give

DragonArmour(M) or DragonArmour(F)

P.S. I haven't checked this in game.. but it should work :P
 
Upvote 0

Zordon

Golden Oldie
Golden Oldie
Apr 26, 2008
1,176
20
145
Manchester, UK
Yeah, it sort of works that way..

Here >>

Code:
#SAY
Are you Male or Female (I know I can check this with a #IF but its a demo!)\
<[ Male ]/@GiveArmour(M)>\
<[ Female ]/@GiveArmour(F)>\

[@GiveArmour()]
#ACT
Mov  A0  "DragonArmour("
Mov  A1  %ARG(1)
AddStr A0 %A1
AddStr A0 ")"
Give A0 1
#SAY
Here is your <$OUTPUT(A0)>\
This will either give

DragonArmour(M) or DragonArmour(F)

P.S. I haven't checked this in game.. but it should work :P

thanks for that, but it's different to what I'm trying to do. I just did this myself a bit long, but hey, I've been trying to get this work, but it wont. I'm going wrong somewhere but I'm not sure where. It keeps pulling the char name from somewhere although I have no idea where from. Also for some reason it won't reformat the last part, I'm trying to get it to exchange armor from male to female and in reverse, female to male. But it adds the string for male and then tries adding the char name, so obviously won't give the item as it doesn't exist.

SCREEN0098.jpg
 

Attachments

  • ArmorExchange-GM.txt
    952 bytes · Views: 12
Last edited:
Upvote 0

idaBigA

Holley Mir 3!!
VIP
Oct 28, 2003
1,966
110
310
Stoke, UK
When people Enter the name of the Armour they will be writing either (M) or (F) at the end, and at the end of your script you are adding (M) or (F) again.

Some issues with script..

Code:
Mov A3 %A1       ;Puts A1 into A3
Mov A3 ""        ;Then clears A3??
Addstr A3 %A1    ;Then adds it again.. remove this line and the last one
Addstr A3 "(F)"  ;This adds (F) to the A3 - Good
Mov A3 %A2       ;Where does A2 come from?
Addstr A3 "(M)"  ;You then add (M) to it as well.. 
GOTO @ArmorMake

See below for a Fixed script :)

Code:
[@Main]
#Say
Would you like to exchange your armor for a different sex?\
Please do NOT enter the (M) or (F) Part!!\     ;They should just enter DragonArmour NOT DragonArmour(M) or (F)
<Yes Enter ArmorName/@@InputArmor>\
<No/@Exit>\\

[@@InputArmor]
#ACT
Mov A1 %INPUTSTR
GOTO @ArmorCheck

[@ArmorCheck]
#say
You have {FCOLOR/11}<$OUTPUT(A1)>{FCOLOR/12}\
Would you like to exchange this?\
<Make Male/@ArmorMakeM>\
<Make Female/@ArmorMakeF>\
<No/@Exit>\\

[@ArmorMakeM]
#ACT
Mov A3 %A1
Addstr A3 "(F)"  ;A3 now contains the Female Version for Item Checking
Mov A2 %A1
Addstr A2 "(M)"  ;A2 now contains the Male Version for Item Giving

GOTO @ArmorMake

[@ArmorMakeF]
#ACT
Mov A3 %A1
Addstr A3 "(M)"  ;A3 now contains the Male Version for Item Checking
Mov A2 %A1
Addstr A2 "(F)"  ;A2 now contains the Female Version for Item Giving

GOTO @ArmorMake

[@ArmorMake]
#IF
CheckItem %A3 1
CheckGold 15000
#ACT
TAKE %A3 1
TAKE GOLD 15000
GIVE %A2 1
#SAY
Here is your {FCOLOR/11}<$OUTPUT(A2)>{FCOLOR/12}\
<Thanks/@Exit>\\
#ELSESAY
You do not have a <$OUTPUT(A3)>!!!\
<Exit/@exit>\\

P.S. As shown at the top, you are pulling A2 for no reason, that probably contains the string with your char name in.. usually from another script or a hard coded script. If you are using a variable, ALWAYS reset it back to nothing before adding something to it.
 
Last edited:
Upvote 0

Zordon

Golden Oldie
Golden Oldie
Apr 26, 2008
1,176
20
145
Manchester, UK
thanks for that, i probably forgot to delete that bit after making adjustments to it. Just tested this scipt and it's working perfectly. :D thanks ida
 
Last edited:
Upvote 0