How do I create an attribute that lowers in increments of one.

I'm trying to create a custom attribute for the player that starts at three upon starting the game, and then decreases by increments of one each time a verb is selected. I would also like warning messages to appear after the second time the verb is selected. I'm having trouble though because when i use the "set an object's attribute (named by an expression)" script, I get this error message

Error running script: Error compiling expression 'player.health = 0': CompareElement: Operation 'Equal' is not defined for types 'Boolean' and 'Int32'

Any idea how to fix this?


K.V.

Hello,

This line sets up the attribute (which I've named 'attribute' in this example) :
player.attribute = 3

This line subtracts 1:
player.attribute = player.attribute - 1

Of course, you could subtract whatever you pleased:
player.attribute = player.attribute - 42

Or you could add:
player.attribute = player.attribute + 1

To print the value:

msg (player.attribute)

Or to print in a sentence:

msg ("You have {player.attribute} whatever{if player.attribute<>1:s}.")


Or, in the GUI:

image


image


image


References:

http://docs.textadventures.co.uk/quest/tutorial/status_attributes.html

http://docs.textadventures.co.uk/quest/text_processor.html


If you get what KV is saying, you can ignore this. If not, read on.

Let's say you set that integer attribute on the player and call it PushCount. Select 3 for the integer value.

You can then select that little button in KV's 1st pic that says 'add change script'. This will add an attribute called changedPushCount.

Here you can put an IF script and choose the if object attribute equals option. Select object player and type in the attribute box PushCount = 2 and place your message in a print message script in the THEN section.

Do the same thing two more times in the ELSE IF's in this same IF script. ELSE IF PushCount = 1... ELSE IF PushCount = 0...print appropriate messages/run appropriate scripts here too.

Go to the verb you want to happen 3x (here it is push) and add a set variable script and type Player.PushCount (in the first box), equals expression (box 2) and Player.PushCount - 1 (3rd box).

Same things happens as KV says, just another way to do it.

Good luck.


Error running script: Error compiling expression 'player.health = 0': CompareElement: Operation 'Equal' is not defined for types 'Boolean' and 'Int32'
Any idea how to fix this?

"types 'Boolean' and 'Int32' " this says you have not set player.health to a number (like =3)
look for changed case...
Player.health =3
player.Health =3
Player.Health =3
are all different
Also, the boolean part thinks there is a True/false in there somewhere.


K.V.

"Boolean" is fun to say!

...but it knows not of numbers.


What does the 32 in Int32 mean, anyway? (K.V. braces himself for an answer he should have already deduced.)


Here you can put an IF script and choose the if object attribute equals option. Select object player and type in the attribute box PushCount = 2 and place your message in a print message script in the THEN section.

Do the same thing two more times in the ELSE IF's in this same IF script. ELSE IF PushCount = 1... ELSE IF PushCount = 0...print appropriate messages/run appropriate scripts here too.

Very good point:

I totally left out the part about putting a message at each increment. (I was too was busy copying and pasting screenshots... (What? I just learned how to do that, and it's fun!))


here's a guide on using Attributes and the 'if' Script:

ht.tp://textadventures.co.uk/forum/samples/topic/5559/attributes-and-if-script-guide-by-hk

here's a step by step walkthrough demo game that you create, teaching you the basics of Attribute usage:

ht.tp://textadventures.co.uk/forum/quest/topic/5387/i-really-need-help#37375


actually, based upon what you said in your post (paraphrasing):

"I'm trying to create a custom Attribute (Leifkin7)"

I'm assuming you created your own 'health' Attribute (which would over-ride/over-write the built-in 'health' Integer Attribute), but when you created it, you left it as a Boolean Attribute, and thus the error message saying that your 'player.health' Attribute is a Boolean Attribute which can't hold your Integer Value of '0', aka, Error: 'boolean' (Attribute) vs 'int32/int/integer' (Value).

So, you just need to change it to an Integer Attribute (though you might want to delete it, and name it something else, so you're not over-riding/over-writing the built-in 'health' Integer Attribute and its functionality. You could name it instead for common examples: 'life' or 'hp', or less common 'vitality' or 'condition'), and to change it:

'player' Player Object -> 'Attributes' Tab -> Attributes box -> (scroll through the Attributes until you find your 'health' Attribute) and change its drop down box/option from 'boolean' to 'int/integer'


@ K.V.

about int32:

not sure exactly but it probably refers to 32-bit systems and thus its Data Type size:

ht.tps://en.wikipedia.org/wiki/32-bit (32 bit = intel 80386, old modern intel x86 = 32 bit, middle modern intel x86 = 32/64 bit new modern intel x86 = 64 bit)
ht.tps://en.wikipedia.org/wiki/X86

ht.tps://en.wikipedia.org/wiki/Data_type (Data Types is how much memory/space it can hold of data/bits, for example/info using C++'s Data Types: http://www.cplusplus.com/doc/tutorial/variables/ )

this stuff gets into Assembly Language (low level language) and the actual computer/circuitry/chip parts (hardware), if you're interested:

ht.tps://en.wikipedia.org/wiki/Assembly_language

ht.tp://www.plantation-productions.com/Webster/www.artofasm.com/DOS/index.html (MASM32 documentation)

ht.tp://textadventures.co.uk/forum/general/topic/5944/help-assembly-language-masm-386 (Jay helping me with my assembly language class, I would have been dead without him! I had no clue how assembly worked, until Jay helped me with understanding it)

(be warned that you're messing with your computer memory, you need to know what you're doing, or you could mess up your computer. I think if you use most programs, they protect the computer, but some may not too...)


What does the 32 in Int32 mean, anyway? (K.V. braces himself for an answer he should have already deduced.)
32 bit integer...
or
-2,147,483,648 to 2,147,483,647
If that number is not big enough, then you need to rescale your project...
(-2 billion to +2 billion, but still much less than the US debt $20 Trillion)

FYI:
Distance to:
Saturn: 1,429,400,000 KM
Pluto: 5,913,520,000 KM

And now for something big, int64
Max value: 9,223,372,036,854,775,807
2,147,483,647

or 9,223 trillion...


FYI...
There is an increase object counter and a decrease object counter that will change the value by 1.


tera bytes ...or whatever we're at now...

and the ultimate:

DNA: initially 4 and now maybe only 1 gram of DNA can hold the entire internet (sum of all connected devices'-and/or-human-knowledge of stored data)

silicon, gold, silver, etc elements has about reached its limit under moore's law, we're now trying to harness DNA: organic/carbon (ultimate) memory storage:

ht.tps://www.extremetech.com/extreme/134672-harvard-cracks-dna-storage-crams-700-terabytes-of-data-into-a-single-gram
ht.tp://www.indiatimes.com/technology/science-and-future/just-one-gram-of-dna-can-potentially-hold-all-the-data-stored-on-the-internet-274786.html
ht.tps://www.sciencealert.com/microsoft-could-be-storing-data-on-dna-within-the-next-three-years
ht.tps://ischool.syr.edu/infospace/2013/04/25/digital-data-in-dna/

ht.tps://en.wikipedia.org/wiki/5_nanometer
ht.tp://www.economist.com/technology-quarterly/2016-03-12/after-moores-law
ht.tps://www.theguardian.com/technology/2015/jul/21/limit-law-scientists-molecule-sized-transistors-atoms-chips
ht.tp://www.nytimes.com/2013/02/20/technology/nanotubes-seen-as-an-alternative-to-silicon-circuits.html?mcubz=3


just awesomeness of computational+mechanical speed:

ht.tps://www.youtube.com/watch?v=staapsj3eRQ

laughs (I loved legos as a kid)


and just aweseomeness-scariness example of computational power:

ht.tp://www.zdnet.com/article/cheap-gpus-are-rendering-strong-passwords-useless/

dealing with brute force password cracking


the 'GRC' (gibson research center) site is a really good site by the way, as they provide some useful free/public knowledge and calculators about password security and etc cyber security stuff (ignoring their high end commercial data recovery services):

ht.tps://www.grc.com/intro.htm (look at the tabs at the top: services, freeware, research, other)

some good links really good about password strength:

ht.tps://www.grc.com/haystack.htm
ht.tps://www.grc.com/passwords.htm


Actually... Tera is less than Trillion
K- Kilo= thousand
M- Mega= million
G- Giga= billion
T- Tera= Trillion ( OOPS, my mistake... I thought there was an extra step in there somewhere!)
Not sure the rest or how high it goes...


supposedly there's 'pera/petra'... from one of my articles/links in my previous post... it's all gibberish to me, lol

I "understand" (ha... right, no human can) the words 'million', 'billion', 'trillion', and 'kB', mB', 'gB', but after that, the words are gibberish to me, lol.

and I know 'google' (10^100), of course too.


THEE BEST WAY TO UNDERSTAND THE SIZE OF A NUMBER: verbally try to count to it !!!

this is how you understand just how big numbers are.... 100 is a big number! 1000 is an even bigger number!

(when I was young, I would challenge myself to how high I could count to... lol. I think I got like about 10,000: took me the whole @$#@ day, and I lost my voice for like an entire week afterward, lol)


Check the following website:
https://www.computerhope.com/issues/chspace.htm
It lists different sizes of data storage devices and how many each can hold, including Petabyte and Hellabyte


1 bit: 2 states (on:true:yes:1:X_voltage or off:false:no:0:Y_voltage)

8 bits = 1 byte (smallest manipulate'able unit of memory)

binary numbering system:

2^0=1 (does not exist)
2^1=2 (1 bit)
2^2=4 (1 nibble = 4 bits)
2^3=8 (1 byte = 2 nibbles = 8 bits)
2^4=16 (old intel: 1 word, "16 bit" systems)*
2^5=32 (old intel: 1 double word: 1 dword, "32 bit" systems)*
2^6=64 (1 qword, "64 bit" systems)
2^7=128 (this is: 0 to 255, which was the size of old gaming consoles memory, and thus when you went over this amount for some in-game stat like strength or whatever, it'd reset the value to 0+extra, and also possibly shift the entire memory too, screwing/glitching up your game)
2^8=256
2^9=512
2^10=1024 (1 mB)
2^11=2048
2^12= ....
ETC ETC ETC

  • ht.tps://en.wikipedia.org/wiki/Word_(computer_architecture) (scroll to the bottom, to the table)

quantum computing:

quantum bit ("qubit"):

2 base states:

A. '1' or '0'
B. '1 and 0 (at the same time)'

but this actually means there's more than 2 states when in use:

2^4= 16 states, maybe? (or maybe it's: 2^3=8 or 2^5=32)

as best as I understand it, lol.

ht.tps://en.wikipedia.org/wiki/Qubit


Actually...
"and I know 'google' (10^100), of course too."
This popular place value is false...
all place values are in sets of 3...
so, there would not be a place value name for 100 zeros... 99 sure, but not 100...
So... 10 google would be a 1 followed by 100 zeros...

Don't you just love it when a thread gets hijacked and everyone forgets what the original question was, and everyone just watching the "show" is scratching their head and asking... "W! T! F! ???"
(LOL!!!!)


K.V.

DNA: initially 4 and now maybe only 1 gram of DNA can hold the entire internet (sum of all connected devices'-and/or-human-knowledge of stored data)

silicon, gold, silver, etc elements has about reached its limit under moore's law, we're now trying to harness DNA: organic/carbon (ultimate) memory storage

If that's not the beginnings of a good game idea, I don't know what is...


Going back to read all of the other information everyone posted now. That just stood out.


DL

What WAS the original question? Was it about a googol? (Googol: VERY fun to say!)

A googolplex is 10googol or 1010100.

https://en.wikipedia.org/wiki/Googolplex

Wait... I remember! The original question had something to do with an integer... and an attribute...

There is an increase object counter and a decrease object counter that will change the value by 1.

I never fool with that. It looks daunting to me.


HK,

Whoa! I've tried to wrap my mind around binary numbering before, but couldn't figure it out. THAT just opened my eyes, though!

I'm gonna read over that link with Jay explaining things, too (and all the others, of course, but especially that one). I always enjoy playing around with the things he posted about.


Doctor Agon,

The bytes and bits is a great link! I didn't know half of what I thought I did about so many things!

This forum rocks!


DarkLizerd,

Whaat???

What does the 32 in Int32 mean, anyway? (K.V. braces himself for an answer he should have already deduced.)
32 bit integer...
or
-2,147,483,648 to 2,147,483,647
If that number is not big enough, then you need to rescale your project...
(-2 billion to +2 billion, but still much less than the US debt $20 Trillion)

FYI:
Distance to:
Saturn: 1,429,400,000 KM
Pluto: 5,913,520,000 KM

And now for something big, int64
Max value: 9,223,372,036,854,775,807
2,147,483,647

or 9,223 trillion...

I may start a new post about this one tomorrow...


Leifkin7,

Sorry about that!

We did stick to topics which concerned integers, though...


Today's post was brought to you by the number 69,105. Which is how many LEAVES I counted today!


(filler for edited post to be updated/posted)


computers are digital, which is the binary numbering system, and thus hardware memory specs is some value of base 2 (2^X):

rosetta stone of numbering systems:

decimal: 10 digits: 0 to 9:
binary: 2 digits: 0 to 1
hexidecimal: 16 digits: 0 to 9, A (10) to F (15)
octal: 8 digits: 0 to 7

(digit value * base^power)
(start from the right at 'power = 0' and increment it by +1 as you go to the left)

decimal:

7,894,561,230 = (7 * 10^9) + (8 * 10^8) + (9 * 10^7) + (4 * 10^6) + (5 * 10^5) + (6 * 10^4) + (1 * 10^3) + (2 * 10^2) + (3 * 10^1) + (0 * 10^0)
255 = (2 * 10^2) + (5 * 10^1) + (5 * 10^0)
100 = (1 * 10^2) + (0 * 10^1) + (0 * 10^0)

binary:

255 d = 1111 1111 b = (1 * 2^7) + (1 * 2^6) + (1 * 2^5) + (1 * 2^4) + (1 * 2^3) + (1 * 2^2) + (1 * 2^1) + (1 * 2^0)
100 d = 0110 0100 b = (0 * 2^7) + (1 * 2^6) + (1 * 2^5) + (0 * 2^4) + (0 * 2^3) + (1 * 2^2) + (0 * 2^1) + (0 * 2^0)

hexidemal:

255 d = F F h = (F * 16^1) + (F * 16^0) // F = 15
100 d = 6 4 h = (6 * 16^1) + (4 * 16^0)

the quick math trick for any number system: keep dividing by the base each time until can't:

255 d = F F h
255 / 16 = 15 ---> F
255 - (15 * 16 = 240) = R 15
15 / 16 = 0
R 15 ---> F
F F h

100 d = 6 4 h
100 / 16 = 6 ---> 6
100 - (6 * 16 = 96) = R 4
4 / 16 = 0
R 4 ----> 4
6 4 h

255 = 1111 1111 b
255 / 2 = 127 ---> 1
127 / 2 = 63 ---> 1
63 / 2 = 31 ---> 1
31 / 2 = 15 ---> 1
15 / 2 = 7 ----> 1
7 / 2 = 3 ----> 1
3 / 2 = 1 ----> 1
1 / 2 = 0
R1 ---> 1
1111 1111 b

value | decimal (10^X) | binary (2^X) | hexi-decimal (16^X) } octal (8^X)

(while our concept of a 'value' is the decimal numbering system, you can see that actually the decimal numbering system, is doing the same pattern as the other number systems, albiet transitioning (and carry/+1 to the left digit) from '9' to '0', whereas the others are: '1' to '0' binary, 'F:15' to '0' hexidecimal, and '7' t0 '0' octal)

0000 0000 v | 0000 0000 d | 0000 0000 b | 0000 0000 h | 0000 0000 o
0000 0001 v | 0000 0001 d | 0000 0001 b | 0000 0001 h | 0000 0001 o
0000 0002 v | 0000 0002 d | 0000 0010 b | 0000 0002 h | 0000 0002 o
0000 0003 v | 0000 0003 d | 0000 0011 b | 0000 0003 h | 0000 0003 o
0000 0004 v | 0000 0004 d | 0000 0100 b | 0000 0004 h | 0000 0004 o
0000 0005 v | 0000 0005 d | 0000 0101 b | 0000 0005 h | 0000 0005 o
0000 0006 v | 0000 0006 d | 0000 0110 b | 0000 0006 h | 0000 0006 o
0000 0007 v | 0000 0007 d | 0000 0111 b | 0000 0007 h | 0000 0007 o
0000 0008 v | 0000 0008 d | 0000 1000 b | 0000 0008 h | 0000 0010 o
0000 0009 v | 0000 0009 d | 0000 1001 b | 0000 0009 h | 0000 0011 o
0000 0010 v | 0000 0010 d | 0000 1010 b | 0000 000A h | 0000 0012 o
0000 0011 v | 0000 0011 d | 0000 1011 b | 0000 000B h | 0000 0013 o
0000 0012 v | 0000 0012 d | 0000 1100 b | 0000 000C h | 0000 0014 o
0000 0013 v | 0000 0013 d | 0000 1101 b | 0000 000D h | 0000 0015 o
0000 0014 v | 0000 0014 d | 0000 1110 b | 0000 000E h | 0000 0016 o
0000 0015 v | 0000 0015 d | 0000 1111 b | 0000 000F h | 0000 0017 o
0000 0016 v | 0000 0016 d | 0001 0000 b | 0000 0010 h | 0000 0020 o
0000 0017 v | 0000 0017 d | 0001 0001 b | 0000 0011 h | 0000 0021 o
0000 0018 v | 0000 0018 d | 0001 0010 b | 0000 0012 h | 0000 0022 o
0000 0019 v | 0000 0019 d | 0001 0011 b | 0000 0013 h | 0000 0023 o
0000 0020 v | 0000 0020 d | 0001 0100 b | 0000 0014 h | 0000 0024 o
0000 0021 v | 0000 0021 d | 0001 0101 b | 0000 0015 h | 0000 0025 o
0000 0022 v | 0000 0022 d | 0001 0110 b | 0000 0016 h | 0000 0026 o
0000 0023 v | 0000 0023 d | 0001 0111 b | 0000 0017 h | 0000 0027 o
0000 0024 v | 0000 0024 d | 0001 1000 b | 0000 0018 h | 0000 0030 o
0000 0025 v | 0000 0025 d | 0001 1001 b | 0000 0019 h | 0000 0031 o
0000 0026 v | 0000 0026 d | 0001 1010 b | 0000 001A h | 0000 0032 o
0000 0027 v | 0000 0027 d | 0001 1011 b | 0000 001B h | 0000 0033 o
0000 0028 v | 0000 0028 d | 0001 1100 b | 0000 001C h | 0000 0034 o
0000 0029 v | 0000 0029 d | 0001 1101 b | 0000 001D h | 0000 0035 o
0000 0030 v | 0000 0030 d | 0001 1110 b | 0000 001E h | 0000 0036 o
0000 0031 v | 0000 0031 d | 0001 1111 b | 0000 001F h | 0000 0037 o
0000 0032 v | 0000 0032 d | 0010 0000 b | 0000 0020 h | 0000 0040 o
0000 0033 v | 0000 0033 d | 0010 0001 b | 0000 0021 h | 0000 0041 o
......
0000 0099 v | 0000 0099 d | 0110 0011 b | 0000 0063 h | 0000 0143 0
0000 0100 v | 0000 0100 d | 0110 0100 b | 0000 0064 h | 0000 0144 o
0000 0101 v | 0000 0101 d | 0110 0101 b | 0000 0065 h | 0000 0145 o
.....
ETC ETC ETC, hopefully you get the pattern: upon reaching the max digit, you carry over (+1) to the next (left) digit


in networking's packets, individual data and flags, are 8 binary digits (1 byte) is known as an 'octet', and a URL is actually made up of 4 octects:

1111 1111 . 1111 1111 . 1111 1111 . 1111 1111 // short-quick/easy form: 255.255.255.255
0000 1111 . 0000 1111 . 0000 1111 . 0000 1111 // short-quick/easy form: 8.8.8.8
0000 0000 . 0000 0000 . 0000 0000 . 0000 0000 // short-quick/easy form: 0.0.0.0


https://en.wikipedia.org/wiki/Network_packet

url IPs actually use the same octets (4 octets): try typing into the url: 8.8.8.8

8.8.8.8 (NON-human-friendly binary name/address) = google.com (human-friendly string name/address)

https://en.wikipedia.org/wiki/Google_Public_DNS

in a computers (PC: command prompt/line/box) (Apple: terminal box), you can type this, try both of them:

nslookup 8.8.8.8

nslookup // hit enter, and then in the line below, type in:
google.com
// type in this to exit out of it: exit

nslookup // hit enter, and then in the line below, type in:
youtube.com
// type in this to exit out of it: exit

now type in this:
nslookup 98.139.180.149
// XXX.yahoo.com

and, try typing in this IP into the url: 98.139.180.149, you'll go to 'youtube.com' site


so, you can go back and forth between binary IP and human-friendly name string IP:

nslookup X.X.X.X // binary IP name/address to domain name/address (human friendly name string)

and

nslookup // hit enter, and then in the line below, type:
XXX.XXX // site name + ext, for example: google.com
// domain name/address (human friendly name string) to binary IP name/address


nslookup
textadventures.co.uk
// 104.28.15.47

// url: 104.28.15.47 ---> the hosting site of quest (cloudflare) blocks direct IP access to the quest site, but-as otherwise, it'd take you to the quest site, just as if you typed into te url: textadventures.co.uk

// err... maybe cloudflare is the hosting site for my old laptop apple computer that I'm using, lol ... that is blocking it... meh... whatever.


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums