Weapon /Text Processor/Alias Question [SOLVED]

Anonynn
26 Jul 2016, 21:11So I have a simple question! I'm not sure what the text processor would be for the weapons the player can equip in my game. I have one for clothing, for example, {if cute_headband.worn:You can't drop it.}. But I'm not sure what the weapon one would be. Here's the equip code.
if (this.parent = game.pov) {
if (not game.pov.equipped = null) {
msg ("You put away your " + game.pov.equipped.alias + " and draw your " + this.alias + ".")
game.pov.equipped.listalias = game.pov.equipped.alias
}
else {
msg ("You draw your " + this.alias + ".")
}
game.pov.equipped = this
this.inventoryverbs = Split ("Look at;Drop;Unequip", ";")
game.pov.equippedstatus = "Wielding: " + this.alias
this.listalias = this.alias + " (equipped)"
}
else {
msg ("You don't have it.")
}
I'm thinking... {if beating_stick.equipped:You hold your beating stick in hand.}
hegemonkhan
27 Jul 2016, 00:49I think it would be like this:
{if game.pov.equipped=beating_stick:You hold your beating stick in hand.}{if game.pov.equipped=sword:You hold your sword in hand.}{etc etc etc}

Anonynn
27 Jul 2016, 01:30Hey! I'll give it a try! Thanks, HK! :D

Anonynn
27 Jul 2016, 01:57Nope that didn't work! ^_^ Back to the drawing board!
Okay, so this worked.
{if player.equipped=beating_stick:}
So now I need to figure out the "not" that would apply to all of them!
The Pixie
27 Jul 2016, 07:04The text processor tries to fake Quest coding, but is a little limited, so it can cope with one dot (player.equipped), but not two (game.pov.equipped). It may be able to handle:
{if not player.equipped=beating_stick:}
If not, try this:
{if player.equipped<>beating_stick:}

Anonynn
27 Jul 2016, 15:30Oh! So like normal. I don't suppose there is a universal not equipped for that right? Like,
if (not player.equipped=null:} or anything?
The Pixie
27 Jul 2016, 16:44I do not know if that will work in the text processor or not. In code you can do:
if (not player.equipped = null) {
In the text processor it would be:
{if player.equipped<>null:You branish your weapon.}
... but it might not recognise null
.
hegemonkhan
27 Jul 2016, 19:36player.equipped=null // you have nothing equipped
if (player.equipped = null) // you have nothing equipped
// or, if you're using an Object, such as 'unarmed/naked' Object, as your 'null', then you can use that instead of 'null':
// if (player.equipped = unarmed)
// if (player.equipped = naked)
if (not player.equipped = null) // you have something equipped
if (not player.equipped = unarmed) // your 'unarmed' Object is NOT equipped
if (not player.equipped = naked) // your 'naked' Object is NOT equipped

Anonynn
27 Jul 2016, 22:32Nope nothing worked. I wonder if it's possible to take something from the unequip code.

Anonynn
29 Jul 2016, 01:49{if player.equipped=beating_stick:} actually didn't work suddenly >_>;;
Any suggestions?

Anonynn
29 Jul 2016, 04:04Okay! I so I figured out why I get 'rhs' text processor errors when I test it now. It's because I don't have a weapon equipped, so I think the game doesn't know what to do without them, which means it's important to find the opposite command. Maybe I can do an entire if-script for "not" equipped, like...
if (not player.equipped = null) {
}
hegemonkhan
29 Jul 2016, 04:12great job Anonynn! ya, you can use that script (if you want to switch over from using text processor commands to the "normal" scripting of 'if~else if~else' block scripts).
just making sure you understand, this:
if (not player.equipped = null) {
// here would go your scripting for when you ARE equipped with some weapon (not null)
} else {
// here would go your scripting for when you're NOT equipped with a weapon (null)
}
VS, this:
if (player.equipped = null) {
// here would go your scripting for when you're NOT equipped with a weapon (null)
} else {
// here would go your scripting for when you ARE equipped with some weapon (not null)
}

Anonynn
29 Jul 2016, 04:16The problem is, I need to figure out how to do that in the text processor at some point too. Otherwise, I may have to set up scripts in all my attack scripts :P
Thanks for the reminder, HK ^_^
hegemonkhan
29 Jul 2016, 13:03It seems as if the 'null' and 'not / <>' are not programmed into the text processor commands.
so, if you want to still use the text processor commands for this, then you'll need to equip a weapon/armor/clothing that will be your unarmed/naked/unequipped weapon/armor/clothing:
<object name="unarmed_or_naked">
<attr name="damage" type="int">1</attr> // if/for using 'unarmed' as your effectively 'non-weapon:null'
<attr name="defense" type="int">1</attr> // if/for using 'unarmed' as your effectively 'non-armor:null'
</object>
<object name="sword">
<attr name="damage" type="int">50</attr>
</object>
<object name="axe">
<attr name="damage" type="int">100</attr>
</object>
<object name="ring_mail">
<attr name="defense" type="int">50</attr>
</object>
<object name="shirt">
<attr name="fashion_or_sexiness" type="int">1</attr>
</object>
<object name="full_plate_mail">
<attr name="defense" type="int">100</attr>
</object>
<object name="player">
<attr name="equipped" type="object">unarmed</attr>
</object>
// or via in scripting:
player.equipped = unarmed_or_naked
// text processor command:
{if player.equipped=unarmed_or_naked:your msg for when you're effectively/conceptually NOT wearing anything}
unfortunately, it looks like when you're equipped with one of your real weapons/armor/clothing, you're going to have to have an 'if' text process command for every single one of them (see below)... NOT GOOD! Until/Unless the programming of the text processor command is expanded, you're going to have to abandon it, and use the normal 'if~else if~else' scripting blocks. Or, unless, Jay, Pixie, Pertex, and/or whoever else got a fancy trick up their sleeve for getting it to work...
{if player.equipped=unarmed_or_naked:blah} {if player.equipped=sword:blah} {if player.equipped=axe:blah} {if player.equipped=beating_stick:blah} {if player.equipped=spear:blah} {if player.equipped=whip:blah} etc etc etc

Anonynn
29 Jul 2016, 15:38Actually! I don't have an "unarmed" or "naked" weapon. The weapons for the game just add to the damage that the player does. So that in there lies the problem, I guess! Thanks though HK! I didn't know those two things weren't programmed in, aside from what Pixie had said.
Darn it all :P
hegemonkhan
29 Jul 2016, 18:26I think the text process commands were jsut added for more convenience/quickness/ease when you only need to do something more simple (less/not complex) with the msg'ing, they weren't meant to be a replacement for the normal scripting, which is able to handle the more complex stuff you might want to do with msg'ing (as well as the more simple stuff too). There's a lot of really cool string/msg manipulation and etc stuff you can do, if you got stuff in the game (or whateve the program you're making) that requires it. I only scratched the surface of it, whereas Pixie, Pertex, Jay, and etc good programmers, can do really amazing stuff with string/msg manipulation coding. There's a huge world of coding involved with string/msg manipulation, lots of really cool stuff that can be done! So, while the text process commands are nice when they're all you need (and when/what they can be used for or able to used, lol), you really should though also start to learn and get some practice into using the normal scripting with/for your msg scripts too, learning some of the cool and neat things that you can with them/it. Just concatenation, in it's simpliest form, enables you to do really neat/cool stuff, such as 'building up' a message based upon conditions being met or not.