Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Stowslee
Wanderer


Joined: 20 Apr 2008
Posts: 69
Location: Watervliet, NY

PostPosted: Thu Dec 25, 2014 3:29 pm   

#IF Statement returning incorrect result
 
I have the following line of code
Code:
#if (@Prone) {#var Status_Window_Prone "Yes"} {#var Status_Window_Prone "No"}


@Prone = 0

When this runs it give @Status_Window_Prone the value of "Yes"

Any thoughts?
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4252
Location: Pensacola, FL, USA

PostPosted: Thu Dec 25, 2014 9:28 pm   
 
Sounds like a duplicate variable somewhere.
_________________
Discord: Shalimar#3679
Reply with quote
Stowslee
Wanderer


Joined: 20 Apr 2008
Posts: 69
Location: Watervliet, NY

PostPosted: Fri Dec 26, 2014 5:24 am   
 
That was one of the first things I checked for, there is only one variable @Prone in the system.
Reply with quote
Stowslee
Wanderer


Joined: 20 Apr 2008
Posts: 69
Location: Watervliet, NY

PostPosted: Sat Dec 27, 2014 2:22 am   
 
Ok so a little more testing resulted in the following:

Command line: #if (@Prone) {#ECHO TRUE} {#ECHO FALSE}

Returns the value False

If that exact same line is placed within an alias

Returns the value True.

When tested as an alias offline... works perfectly. Connect to the server, it no longer works as it should.

Also checked to see if it was specific to this particular line, as I have multiple lines which are very similar in essence the only thing different is the variable used. None of the work properly, I really hope this is just something stupid I am missing. Below is posted the entire area of code which relates.

This sets the initial variables:

Code:
#var Current_Health %gmcp.char.vitals.hp
#var Max_Health %gmcp.char.vitals.maxhp
#var Percent_Health %int(%eval(%float(@Current_Health) / %float(@Max_Health)) * 100)
#var Current_Mana %gmcp.char.vitals.mp
#var Max_Mana %gmcp.char.vitals.maxmp
#var Percent_Mana %int(%eval(%float(@Current_Mana) / %float(@Max_Mana)) * 100)
#var Current_Endurance %gmcp.char.vitals.ep
#var Max_Endurance %gmcp.char.vitals.maxep
#var Percent_Endurance %int(%eval(%float(@Current_Endurance) / %float(@Max_Endurance)) * 100)
#var Current_Willpower %gmcp.char.vitals.wp
#var Max_Willpower %gmcp.char.vitals.maxwp
#var Percent_Willpower %int(%eval(%float(@Current_Willpower) / %float(@Max_Willpower) * 100))
#var Current_Experience %gmcp.char.vitals.xp
#var Next_Level_Experience %gmcp.char.vitals.maxxp
XP_Percent_Calc
#var Bleeding %gmcp.char.vitals.bleeding
#var Prone %gmcp.char.vitals.prone
#var Slice_Balance %gmcp.char.vitals.herb
#var Syringe_Balance %gmcp.char.vitals.pipe
#var Healing_Serum_Balance %gmcp.char.vitals.elixir
#var Kidney_Balance %gmcp.char.vitals.moss
#var Affliction_Serum_Balance %gmcp.char.vitals.affelixir
#var Focus_Balance %gmcp.char.vitals.focus
#var Residual_Ylem %gmcp.char.vitals.residual
#var Physical_Balance %gmcp.char.vitals.balance
#var EQ_Balance %gmcp.char.vitals.equilibrium

GMCP_Status_Window


This sets the values for the status window displays

Code:
#if (@Slice_Balance) {#var Status_Window_Slice_Balance "Yes"} {#var Status_Window_Slice_Balance "No"}
#if (@Syringe_Balance) {#var Status_Window_Syringe_Balance "Yes"} {#var Status_Window_Syringe_Balance "No"}
#if (@Healing_Serum_Balance) {#var Status_Window_Healing_Serum_Balance "Yes"} {#var Status_Window_Healing_Serum_Balance "No"}
#if (@Kidney_Balance) {#var Status_Window_Kidney_Balance "Yes"} {#var Status_Window_Kidney_Balance "No"}
#if (@Affliction_Serum_Balance) {#var Status_Window_Affliction_Serum_Balance "Yes"} {#var Status_Window_Affliction_Serum_Balance "No"}
#if (@Focus_Balance) {#var Status_Window_Focus_Balance "Yes"} {#var Status_Window_Focus_Balance "No"}
#if (@Physical_Balance) {#var Status_Window_Physical_Balance "Yes"} {#var Status_Window_Physical_Balance "No"}
#if (@EQ_Balance) {#var Status_Window_EQ_Balance "Yes"} {#var Status_Window_EQ_Balance "No"}
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sun Dec 28, 2014 1:20 pm   
 
You're missing something, but it's not really stupid or trivial. Your problem is, barring something with data corruption, script context. Essentially, your testing was being done within the context of the main window and the main window is going to have access to things like %gmcp and the automapper (both of these things are attached specifically to the window, rather than to the larger session consisting of various packages with multiple windows/modules). Meanwhile, during "live play" the script is actually taking on the context of a child window and since the child window has blank values for %gmcp it ends up getting bum data to work with.
_________________
EDIT: I didn't like my old signature
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net