|
Amylon Novice
Joined: 31 Jan 2003 Posts: 49 Location: Australia
|
Posted: Tue Apr 27, 2004 3:40 am
Button problem regarding #pr, #pi and #yesno |
Greetings Zmudians,
I am having a problem with a button I have created. Here is the code for it:
#pr refill {Number of refills?}
#pi {p:Type of refill is?} {o:1} {*Health: rtype = health;cost = @healthcost} {Mana: rtype=mana;cost=@manacost} {Immunity: rtype=immunity;cost=@immunitycost}
#YESNO "Filling for?" {Self:} {Free: sale=1} {For Sale: sale=2};#IF (@sale > 0) {#pr target {Filling them for?}} {}
#YESNO "Do you wish to continue" {Yes: @rtype @refill} {Abort refilling: #var refill 0}
The first problem is that the item in red causes a syntax error.
The second problem is much more annoying, all the cancel buttons when this is used cause it just to skip that step and proceed to the next one. Is there a way to make them work to abort the whole process? eg If I am at the first prompt " Number of refills?" and I press cancel it will abort the whole process? {The part in green is my hack around at present)
Any help would be greatly appreciated.
Amylon
Ammended
PS Here is how it looks in a .txt file
#CLASS {Refilling|BUTTONS}
#BUTTON 29 {Elixirs} {#pr refill {Number of refills?}
#pi {p:Type of refill is?} {o:1} {*Health: rtype = health;cost = @healthcost} {Mana: rtype=mana;cost=@manacost} {Immunity: rtype=immunity;cost=@immunitycost}
#YESNO "Filling for?" {Self:} {Free: sale=1} {For Sale: sale=2};#IF (@sale > 0) {#pr target {Filling them for?}} {}
#YESNO "Do you wish to continue" {Yes: @rtype @refill} {Abort refilling: #var refill 0}} {} {} {} {} {} {} {} {} {Pos} {1} {388} {} {} {} {} "" {Explore|Right} {} {} {3}
#CLASS 0
#If there is another way to do the same thing but so it works that would be cool too :) |
|
|
|
Lirril Novice
Joined: 23 Oct 2000 Posts: 44 Location: Ireland
|
Posted: Wed Apr 28, 2004 11:26 am |
First, to get rid of the syntax error define an alias eg:
#alias clearRefills {#var refill 0}
Then replace the '#var refill 0' after 'Abort refilling:', with 'clearRefills' instead.
To get the cancel bit working, here's a bit of a workaround:
1) At the start of the button script, run the 'clearRefills' alias again. (Note, that previously if you ran script once and created 5 elixirs, then ran it again the number of elixirs would default to 5. Unfortunately this change will force it to show zero each time you run it.)
2) After the '#pr refill {Number of refills?}' line, insert a new line as follows:
#if @refill=0 {#abort 1}
What this means, is that when the user clicks the button they are asked to enter a number of refills (which now always starts at zero). If they press cancel, or enter zero, the rest of the script execution will abort. If they enter anything non zero the script will continue as usual.
Hope that helps,
- Lirril |
|
|
|
|
|
|
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
|
|