ID:268869
 
mob/proc/rupyupdate()
for(var/obj/rupy/number/n1/N in src.client.screen)
N.icon_state = copytext(src.rupies,3)
for(var/obj/rupy/number/n2/Q in src.client.screen)
Q.icon_state = copytext(src.rupies,2)
for(var/obj/rupy/number/n3/P in src.client.screen)
P.icon_state = copytext(src.rupies,1)



I made the mob's rupies variable equal to 0, but yet it doesn't change the icon_state...:(

Should I just study more on this/stuff like this before I attempt it?

Also, thanks for reading.
  1. It's spelled "rupee"
  2. You're trying to use copytext() on a number
  3. Hope this helps :)
In response to Wizkidd0123
<_Also, what else would I use? There's no copynum proc. =/
In response to Hell Ramen
whoamg sorry nao for another question, I fixed the last question, 'cept it still has one bug:
mob/proc/rupyupdate()
var/O = num2text(src.rupies)
for(var/obj/rupy/number/n1/N in src.client.screen)
N.icon_state = copytext(O,3)
if(!N.icon_state)
N.icon_state = "0"
for(var/obj/rupy/number/n2/Q in src.client.screen)
Q.icon_state = copytext(O,2)
if(!Q.icon_state)
Q.icon_state = "0"
for(var/obj/rupy/number/n3/P in src.client.screen)
P.icon_state = copytext(O,1)
if(!P.icon_state)
P.icon_state = "0"


If the number exceeds the limit(ex: 10), the last part is cut off. :O If it's 100, all it'll show is the first 1, if it's 10 it'll show 01. If it's 1, it'll show 001.
Thus, I'm here, and I say.
hlp plx
Thanks for reading...
In response to Hell Ramen
N.icon_state = copytext(O,3)


If O was equal to "100", that would output the second 0. coppytext(), by default, is defined like so:

copytext(text/T,Start=0,End=T+1)


The last character it actually copies is actually the character that comes right before "[End]".
In response to Wizkidd0123
mob/proc/rupyupdate()
var/O = num2text(src.rupies)
for(var/obj/rupy/number/n1/N in src.client.screen)
N.icon_state = copytext(O,3,3)
if(!N.icon_state)
N.icon_state = "0"
for(var/obj/rupy/number/n2/Q in src.client.screen)
Q.icon_state = copytext(O,2,3)
if(!Q.icon_state)
Q.icon_state = "0"
for(var/obj/rupy/number/n3/P in src.client.screen)
P.icon_state = copytext(O,1,2
if(!P.icon_state)
P.icon_state = "0"

kk, I tried what you said (don't ask how I came up with something like that), but it goes backwards after the ones place, like...
001
002
003
004
005
006
007
008
009
001
011
021
031
etc.
How would I fix that?
And, thanks for the help so far, Wizzie.
In response to Hell Ramen
Well, for one, in the DM Ref, End is defined like so:

"End: The text character position immediately following the last character to be copied. "

So, if you start at 3 and end at 3, you're telling it to start copying at the 3rd character, and the last character copied should be the 2nd.
In response to Wizkidd0123
Okay...
So like,
2,3,4?
Or, 4,4,4?
In response to Hell Ramen
Hell Ramen wrote:
Okay...
So like,
2,3,4?
Or, 4,4,4?

Whaaa? I have no idea what you're talking about now lol
In response to Wizkidd0123
For the end text thingy...
Make it one greater then the whole number, or just 4? :9
Either way, it makes them come out backwards. >_>
In response to Hell Ramen
You should make it one greater than the # of digits.
In response to Wizkidd0123
@_@
Then it goes like...
001
002
003
004
005
006
007
008
009
00
01
02
03
etc.

Ugh... @_@ Confusling.
In response to Hell Ramen
At this point, It must have something to do with your src. rupies var value I recommend putting in Debug Messages. For more information (If you don't know what a debug message is) read Crashed's Markers article on BYONDscape. However, remember, there's no reason not to use embedded text within debug messages:
src << "rupies: [src.rupies]"
In response to Wizkidd0123
It turns out correctly(I even did a debug message for the O thingy), but the HUD doesn't. @_@
In response to Hell Ramen
Hell Ramen wrote:
It turns out correctly(I even did a debug message for the O thingy), but the HUD doesn't. @_@

Well, then, uhhh...

Look at your HUD icons; they must be backwards or something. Either that, or there's some code you haven't posted.
In response to Wizkidd0123
They're numbered from 0-9 correctly. @_@
And here's everything that deals with the rupies
mob/proc/rupyupdate()
var/O = num2text(src.rupies)
for(var/obj/rupy/number/n1/N in src.client.screen)
N.icon_state = copytext(O,3,4)
if(!N.icon_state)
N.icon_state = "0"
for(var/obj/rupy/number/n2/Q in src.client.screen)
Q.icon_state = copytext(O,2,3)
if(!Q.icon_state)
Q.icon_state = "0"
for(var/obj/rupy/number/n3/P in src.client.screen)
P.icon_state = copytext(O,1,2)
if(!P.icon_state)
P.icon_state = "0"


obj/rupy
layer = MOB_LAYER+2
icon = 'hud.dmi'
icon_state = "rupy"
screen_loc = "4,14:+4"
number
icon = 'numbers.dmi'
icon_state = "0"
n1
screen_loc = "4,14:-10"
n2
screen_loc = "5:-14,14:0:-10"
n3
screen_loc = "6:-28,14:0:-10"

mob/var/rupies = 0

NOTE: If you're wondering why I'm on, I got snowday'd.
Well, thanks for the help so far Wizzie.
In response to Hell Ramen
        n2
screen_loc = "5:-14,14:0:-10"
n3
screen_loc = "6:-28,14:0:-10"


That doesn't make sense. The format for client.screen pixel offsets is screen_loc="[x]:[x_offset],[y]:[y_offset]". The above code doesn't fit that format. You should instead do

        n2
screen_loc = "5:-14,14:-10"
n3
screen_loc = "6:-28,14:-10"
In response to Wizkidd0123
Whoops.
_>
Forgot to delete that part...
Thanks...but I still wonder why it goes backwards. @_@
In response to Hell Ramen
Hell Ramen wrote:
Whoops.
_>
Forgot to delete that part...
Thanks...but I still wonder why it goes backwards. @_@

The spacing/pixel_offsets in screen_loc are probably screwed up. I'm too lazy to do the math right now, but realy, if the debug messages are outputting what you want them to, that's the only conceivable problem.
In response to Wizkidd0123
The pixel offsets/loc can mess up the icon_states? :o
Page: 1 2 3